apache / apache/buildstream

RFE: Add "bst fmt" (or similar) to rewrite .bst files to canonical format

Open
#485 20 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
140
Forks
45
Avg merge
1d 3h
Merged PRs (30d)
6

Description

[See original issue on GitLab](https://gitlab.com/BuildStream/buildstream/-/issues/485)
In GitLab by [[Gitlab user @jjardon]](https://gitlab.com/jjardon) on Jul 19, 2018, 23:47

## Background
This can be useful to keep same style format in all the files in the project

## Task description
This is actually done already when running `bst track`

## Possible solutions
We have simply used this in https://gitlab.com/freedesktop-sdk/freedesktop-sdk/merge_requests/626
```
#!/usr/bin/python3

from ruamel.yaml import round_trip_load, round_trip_dump

import sys

for filename in sys.argv[1:]:
print(filename)
with open(filename) as f:
content = round_trip_load(f)

with open(filename, 'w') as f:
round_trip_dump(content, f)
```

## Acceptance Criteria
New command is available

Contributor guide

Open the contributing guide

Research direction

Start by reading the existing `bst track` command and its handling of `.bst` files, then compare it with the proposed Python round-trip YAML script. Done means a new `bst fmt` or equivalent command is available and rewrites `.bst` files into the project's canonical format.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system, cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.