Skip to content
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

The regal fix command should explain which violations are fixable #665

Closed
anderseknert opened this issue Apr 20, 2024 · 0 comments · Fixed by #726
Closed

The regal fix command should explain which violations are fixable #665

anderseknert opened this issue Apr 20, 2024 · 0 comments · Fixed by #726
Labels
documentation Improvements or additions to documentation

Comments

@anderseknert
Copy link
Member

The regal fix command should inform the user of what fixes it may apply before the command is run, as it's currently not clear what the impact of running the command might be. We'll probably want to say something like:

Fix Rego source files with linter violations. Note that this command is intended to help
fix style-related issues, and could be considered as a stricter `opa-fmt` command.
Issues like bugs should be fixed manually, as it is important to understand why the
were flagged. The linter rules with automatic fixes available are currently:

- opa-fmt
- use-rego-v1
- ...
- ...

It would also be helpful if we updated the docs for each rule where a fix is available with a note saying it's so. Perhaps in the header where we already provide things like name and category.

Current output of running regal fix --help:

Fix Rego source files with linter violations.

Usage:
  main fix <path> [path [...]] [flags]

Flags:
  -c, --config-file string        set path of configuration file
      --debug                     enable debug logging (including print output from custom policy)
  -d, --disable string            disable specific rule(s). This flag can be repeated.
  -D, --disable-all               disable all rules
      --disable-category string   disable all rules in a category. This flag can be repeated.
  -e, --enable string             enable specific rule(s). This flag can be repeated.
  -E, --enable-all                enable all rules
      --enable-category string    enable all rules in a category. This flag can be repeated.
  -f, --format string             set output format (pretty is the only supported format) (default "pretty")
  -h, --help                      help for fix
      --ignore-files string       ignore all files matching a glob-pattern. This flag can be repeated.
      --no-color                  Disable color output
  -o, --output-file string        set file to use for fixing output, defaults to stdout
      --pprof string              enable profiling (must be one of cpu, clock, mem_heap, mem_allocs, trace, goroutine, mutex, block, thread_creation)
  -r, --rules string              set custom rules file(s). This flag can be repeated.
      --timeout duration          set timeout for fixing (default unlimited)
@anderseknert anderseknert added the documentation Improvements or additions to documentation label Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant