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

Consider using cookstyle instead of rubocop in lint.rb #24

Open
mattstratton opened this issue Oct 27, 2016 · 3 comments
Open

Consider using cookstyle instead of rubocop in lint.rb #24

mattstratton opened this issue Oct 27, 2016 · 3 comments
Labels
Type: Enhancement Adds new functionality.

Comments

@mattstratton
Copy link
Contributor

I could happily submit the PR to make this change, but wanted to bring it up for discussion.

The current chef generate in chefdk results in a cookbook that fails rubocop (and therefore these lint tests). Is there any reason to not switch to cookstyle for the lint tests?

@phillipbroberts
Copy link

I second the idea of switching to cookstyle. If cookstyle is the preferred method of linting cookbooks and is the defacto standard, why wouldn't it be the standard in delivery? (or anywhere else for that matter)

@mattstratton
Copy link
Contributor Author

I'm working on a PR for this, and wonder about two possible implementations (I don't think we want to just immediately cut over, because it's possible that someone has older builders that don't have cookstyle installed)

These are the two options as I see them:

  1. If cookstyle is installed, run cookstyle instead of rubocop. Period.
  2. Set an option in config.json to over-ride and enable cookstyle instead of rubocop, which makes using cookstyle an opt-in.

I am more in favor of option 1, as it should be the default. Perhaps actually there is a Secret Option 3, which would be this:

If cookstyle is installed, run it. Unless enable_rubocop is set in the config.json. That way if someone really wants to use rubocop they can. This will also not break things for older builders.

@mattstratton
Copy link
Contributor Author

mattstratton commented Dec 3, 2016

It looks like cookstyle was added to ChefDK in v0.14 (2016-05-17).

Since that was quite some time ago, I think that it's fairly safe to go with option 1. I have a fork where if cookstyle is installed, it will run cookstyle tests in lint. If not, it will run rubocop.

I have not been able to yet test it on a builder with an older version of ChefDK that does not have cookstyle though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Adds new functionality.
Development

No branches or pull requests

3 participants