-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: incorrect printout how to fix formatting issues #138
Comments
Should the fix command not just be |
Issue AnalysisThe issue arises due to the way
Getingt the correct suggestion outputThe following command lists all current targets: bazel query '//tools/format:*' Output
To get the correct suggestion output, run the check command of the bazel run //tools/format:format.fix_YAML_with_yamlfmt.check Output
Proposed Improvement: Renaming TargetsWe can improve usability by renaming the targets as follows: tools\format\BUILD:format_multirun(
name = "format",
...
)
format_test(
name = "format_test",
...
) After Renaming, the targets would be:
Now, the following commands will be used:
Note
|
@nradakovic can you provide feedback here? |
@AlexanderLanin @nicu1989 I've took a look and I don't see how renaming targets will lead to a better command suggestion. Tried this:
The problem lies in the implementation in rules_lint. The suggestion just uses the same command as run for check: https://github.com/aspect-build/rules_lint/blob/3bf498bc3b92ac96818165a8ee989ba7ad06cdcd/format/private/format.sh#L47 |
True, that's my conclusion also. There is not much what we can do about it. But by changing the target names we can address somewhat the usecase presented in the ticket(having the same outputed suggestion as the command): Current:
Modified target names:
|
I think easiest would be to just have a note somewhere that one can fix any of the 'formatting' issues via the |
It's in README. This ticket was created because CI checks print incorrect output. |
@nicu1989 how about we merge this one here AND create an issue upstream? |
I have created an issue to aspect-build/rules_lint: aspect-build/rules_lint#482 |
When a yaml is formatted incorrectly (e.g. github workflow) the error message is:
However, running said command just produces the output above.
The correct command is:
bazel run //tools/format:format.fix_YAML_with_yamlfmt
.Same for python:
bazel run //tools/format:format.check_Python_with_ruff
does not "fix" the formatting issues.The check must report the correct command which is needed to fix formatting issues.
Full example:
The text was updated successfully, but these errors were encountered: