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

Add ChefCorrectness/InvalidDefaultAction cop #685

Merged
merged 3 commits into from
Jul 17, 2020
Merged

Conversation

tas50
Copy link
Contributor

@tas50 tas50 commented Jul 17, 2020

Detect when people are setting it to something that isn't a variable, symbol, or array.

Signed-off-by: Tim Smith tsmith@chef.io

Detect when people are setting it to something that isn't a variable, symbol, or array.

Signed-off-by: Tim Smith <tsmith@chef.io>
@tas50 tas50 requested review from a team as code owners July 17, 2020 17:45
config/cookstyle.yml Outdated Show resolved Hide resolved
it 'does not register an offense with a variable' do
expect_no_offenses('default_action [:create, :enable]')
end
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might add a test for an array of non-symbols.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now I just sorta pass on detecting that. Any array is fine. I saw my first case of someone using that while writing this and I don't think anyone really realizes it's even an option.

tas50 and others added 2 commits July 17, 2020 10:59
Signed-off-by: Tim Smith <tsmith@chef.io>

Co-authored-by: pete higgins <pete@peterhiggins.org>
Signed-off-by: Tim Smith <tsmith@chef.io>

Co-authored-by: pete higgins <pete@peterhiggins.org>
@tas50 tas50 merged commit 3dfdb63 into master Jul 17, 2020
@tas50 tas50 deleted the non_symbol_default_action branch September 10, 2020 04:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants