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

variables_not_enclosed sometimes fires where it shouldn't. #191

Closed
incase opened this issue Mar 19, 2013 · 5 comments
Closed

variables_not_enclosed sometimes fires where it shouldn't. #191

incase opened this issue Mar 19, 2013 · 5 comments

Comments

@incase
Copy link

incase commented Mar 19, 2013

Easy reproduction using this in a manifest:

$path_line = "PATH=${path}"

This seemingly triggers whenever the variable name in front of the = sign starts the same as the variable in the quoted string.

@incase
Copy link
Author

incase commented Mar 19, 2013

The culprit here seems to be line 46(?) of check_strings.rb:
if line.is_a? String and line.include? "$#{t.last[:value]}"
Which matches whenever the variable name exists in unquoted from on the line given. The include? probably needs to be changed to a regexp match, but I don't have the time currently to figure out an appropriate check.

@incase
Copy link
Author

incase commented Mar 19, 2013

Okay, here is a spec test for the correct behaviour:

describe 'variable properly enclosed, second variable with similar name' do
let(:code) { '$abc_test = "${abc}"' }

its(:problems) { should be_empty }
end

However, still no time to write appropriate function.

@incase
Copy link
Author

incase commented Mar 19, 2013

Oh boy, forget about this. I didn't realize I was running such an old version of puppet-lint (0.1.2)

@incase incase closed this as completed Mar 19, 2013
@rodjek
Copy link
Owner

rodjek commented Mar 19, 2013

So, it's all good under the latest version? :)

@incase
Copy link
Author

incase commented Mar 20, 2013

Yes. Now I just need to add our changes to the current version:
Allow to specify more than one path/file per call
Allow to ignore the 80chars check on lines matching a (set of) regular expression(s)
Allow specifying an rc file to set parameters
And port my check on certain paths (from 0.1.2)
The last one is my biggest problem.

Regards,
Sven

PS: if it isn't there yet, you might still want to add a test case for this.

Tim Sharpe [email protected] schrieb:

So, it's all good under the latest version? :)


Reply to this email directly or view it on GitHub.

bastelfreak pushed a commit to bastelfreak/puppet-lint that referenced this issue Mar 22, 2024
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

No branches or pull requests

2 participants