-
Notifications
You must be signed in to change notification settings - Fork 144
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
Update Lint to default to Puppet Approved criteria #80
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -210,15 +210,21 @@ def revision(scm, target, ref) | |
FileUtils.rm_rf("pkg/") | ||
end | ||
|
||
desc "Check puppet manifests with puppet-lint" | ||
task :lint do | ||
require 'puppet-lint/tasks/puppet-lint' | ||
PuppetLint.configuration.relative = true | ||
PuppetLint.configuration.disable_class_inherits_from_params_class | ||
PuppetLint.configuration.ignore_paths ||= [] | ||
PuppetLint.configuration.ignore_paths << "spec/fixtures/**/*.pp" | ||
PuppetLint.configuration.ignore_paths << "pkg/**/*.pp" | ||
PuppetLint.configuration.ignore_paths << "vendor/**/*.pp" | ||
require 'puppet-lint/tasks/puppet-lint' | ||
# Must clear as it will not override the existing puppet-lint rake task since we require to import for | ||
# the PuppetLint::RakeTask | ||
Rake::Task[:lint].clear | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also fixed in 1.1.1 |
||
# Relative is not able to be set within the context of PuppetLint::RakeTask | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For the record, this is fixed in rodjek/puppet-lint@c033c37 (to be 1.1.1). |
||
PuppetLint.configuration.relative = true | ||
PuppetLint::RakeTask.new(:lint) do |config| | ||
config.fail_on_warnings = true | ||
config.disable_checks = [ | ||
'80chars', | ||
'class_inherits_from_params_class', | ||
'class_parameter_defaults', | ||
'documentation', | ||
'single_quote_string_with_variables'] | ||
config.ignore_paths = ["tests/**/*.pp", "vendor/**/*.pp","examples/**/*.pp" "spec/**/*.pp", "pkg/**/*.pp"] | ||
end | ||
|
||
require 'puppet-syntax/tasks/puppet-syntax' | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I don't believe that you need to clear the
:lint
task here, as this would be the only:lint
defined at this point in time.The reason I had to do it in my module
Rakefile
was because I was overriding this task. Once theignore_paths
have been set, they cannot be changed. As mentioned, only the first:lint
task will be the one run by Rake, so if you wish to changeignore_paths
, then you have to ensure that there is one task.For reference, my module uses this code:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If notice that we are not just creating the rake task but using the PuppetLint::RakeTask class which upon import will define a lint Rake task.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, you've removed
task :lint
, and replaced it withPuppetLint::RakeTask.new(:lint)
, which is fine (and the same thing my example does).My point is that there are no tasks defined prior to calling
Rake::Task[:lint].clear
, making that line unnecessary.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
require 'puppet-lint/tasks/puppet-lint' creates the task by default. Since we have to require it prior to creating the Task via PuppetLint::RakeTask.new you have to clear it.