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

code_on_top_scope warns about node definitions #580

Closed
paran1 opened this issue Dec 12, 2016 · 5 comments
Closed

code_on_top_scope warns about node definitions #580

paran1 opened this issue Dec 12, 2016 · 5 comments
Labels

Comments

@paran1
Copy link
Contributor

paran1 commented Dec 12, 2016

Example input

$ cat node.pp 
node 'faran'
{
}

Expected: no warnings

Actual result:

$ puppet-lint node.pp 
WARNING: code outside of class or define block - node on line 1
WARNING: code outside of class or define block - faran on line 1
WARNING: code outside of class or define block - { on line 2
WARNING: code outside of class or define block - } on line 3
$ 

Tested with version 3.0.0 and latest master (041b430) with same result.

@paran1
Copy link
Contributor Author

paran1 commented Dec 13, 2016

I just realized that 3.0.0 is a branch rather than a tagged version, so please ignore that. The code_on_top_scope check is not in any released version.

@rnelson0
Copy link
Collaborator

This is by design; ALL code on the top scope is flagged when this check is left enabled.

@paran1
Copy link
Contributor Author

paran1 commented Dec 20, 2016

Yes, and that design is wrong. Node definitions are supposed to be in the main manifests, top scope.

@rnelson0
Copy link
Collaborator

In that case, it would be appropriate to disable the check for the file with a flag or control comment. A node statement anywhere other than manifests/site.pp is incorrect, but puppet-lint is looking at the content rather than whether the file is the site manifest.

@paran1
Copy link
Contributor Author

paran1 commented Jan 30, 2017

NNode definitions is a standard language feature, not deprecated by the style guide. I expect to be able to run puppet-lint on such manifests without me having to add control comments or use flags.

Also, node definitions can be in any file name, as the site manifests might be specified using a manifests directory.

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

No branches or pull requests

2 participants