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

Lint Option #22

Open
discreet opened this issue Feb 11, 2018 · 3 comments
Open

Lint Option #22

discreet opened this issue Feb 11, 2018 · 3 comments

Comments

@discreet
Copy link

discreet commented Feb 11, 2018

A tusk lint option would be useful for verifying complex Tusk files. I'm not sure how this might be implemented though since tusk lint could potentially be a task a user has written.

@rliebz
Copy link
Owner

rliebz commented Feb 13, 2018

Built-in linting would be really helpful. It would fit nicely as a global flag, like --lint, which would function the same way --help and --version do now. Both errors and warnings make sense, and I might also consider style messages to help with consistency for things like using hyphens instead of underscores in flag names, although I'm not sure how opinionated tusk should be there.

Here's a few examples of things that tusk can add linting for (I may edit this):

  • Error: Invalid YAML
  • Error: Incompatible types (e.g., boolean flag defaults to "foo")
  • Error: Short flag name longer than one character
  • Error: Duplicate short flag definition
  • Error/Warning: Unknown YAML key name (currently a run-time error)
  • Warning: Duplicate YAML map keys
  • Warning: Deprecated constructs
  • Warning: Unknown OS (based on GOOS values)
  • Warning: No usage defined for task
  • Warning: No usage defined for option

This is lower on my priority list, but I'd be happy to accept contributions here.

@discreet
Copy link
Author

I think that is a good list and should cover just about all cases I can think of reasonably. I'm on the side that tusk should be as opinionated as it needs to be to consistent in regards to style. I do not think that those lint violations should result in errors though. I would like to see them as warnings.

I might be a little biased but I really like the way puppet-lint works.

@smyrman
Copy link

smyrman commented Feb 16, 2022

It would be possible, either as an initia proto-type or as a final approach to do this as a separate program tusk-lint. Would allow flags/config to the linter itself if that's relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants