Open a-t-0 opened 2 years ago
Thanks for moving this over. I know the first one would be tricky to implement too. Not all tools support both styles.
Maybe in both cases this checker could evaluate these patterns on a per command basis? This way it doesn't need to know anything about the tool itself, only the style you've picked is consistent for that command and if there's an edge case where a tool supports long flags but for some reason doesn't have one for a specific flag there would be a way to ignore that flag similar to how you can ignore specific ShellCheck rules -- in this case this checker could let you ignore just that 1 flag.
This is the first issue parsed from a related Hacker News post.
2 things https://github.com/nickjj would love to see in a checker would be:
[ ] Warn me when I'm using
-h
instead of--help
. When writing persisted scripts it's often more descriptive and self documenting to use long form flags when a tool gives you both options. Related source: https://nickjanetakis.com/blog/when-to-use-long-word-or-short-letter-command-line-flags[ ] Warn user when I mix using "-p 8000:8000" and "-p=8000:8000".
Note, the requester is aware it's technically not possible to give a definitive answer here because supporting spaces vs equals comes down to the CLI tool itself. However, one can pick up when you mix the 2 styles and leave it up to the script author to pick a style and stick with it when possible.