Run puppet parser validate on *.pp files.
Details
- Reviewers
joshuaspence epriestley - Group Reviewers
Blessed Reviewers - Required Signatures
L28 Phacility Individual Contributor License Agreement
Add following code to your .arclint linters section:
"puppet": { "type": "puppet", "include": "(\\.pp$)" }
Create puppet (*.pp) file with syntax error and run arc lint on it. Expect error.
Diff Detail
- Repository
- rARC Arcanist
- Branch
- puppet_linter
- Lint
Lint Passed - Unit
Test Failures - Build Status
Buildable 5768 Build 5787: [Placeholder Plan] Wait for 30 Seconds
Time | Test | |
---|---|---|
389 ms | ArcanistFlake8LinterTestCase::testLinter | |
104 ms | ArcanistChmodLinterTestCase::testLinter | |
56 ms | ArcanistClosureLinterTestCase::testVersion | |
101 ms | ArcanistCommitLinterTestCase::testLinter | |
62 ms | ArcanistCpplintLinterTestCase::testVersion | |
View Full Test Results (1 Failed · 37 Passed · 18 Skipped) |
Event Timeline
To clarify, this is a completely different linter than the existing PuppetLintLinter? Why are there two different Puppet linters -- aren't puppet files basically configuration files? What advantages does this linter have over puppet-lint?
puppet-lint is a third party tool which aims to check that Puppet code adheres to the official style guide. pupppet parser validate is more of a syntax check. Because it is a built-in tool, you can use it to check against specific versions, whereas puppet-lint aims to be version-agnostic.
Yes, @joshuaspence mentioned everything what was needed. Actually we are using both because each of them catching different errors.
src/lint/linter/ArcanistPuppetLinter.php | ||
---|---|---|
5 | Change this to Runs `puppet parser validate` for Puppet files.. | |
12 | I think that Puppet is a more reasonable name for this linter. | |
21 | Missing space after "or" | |
23 | This isn't correct, there is no %s in the string. | |
55 | Prefer to write this as pht('Install puppet using `%s` or similar.', 'apt-get install puppet') | |
60 | Kill this blank line. | |
78 | Prefer to use getLintMessageSeverity so that the severity is configurable. | |
80 | This should be translatable, so pht('Puppet Error'). Also, perhaps "Puppet Parser Error" would be more clear. |
Some minor inlines, otherwise looks good.
src/lint/linter/ArcanistPuppetLinter.php | ||
---|---|---|
8 | Unused variable, just remove this. | |
53 | The first argument should be on a newline. | |
58 | Kill this blank line. | |
68 | Try to be a bit more restrictive with the regular expression... I think /^Error: (.*)at (.*):(\d+)$/ would be better. | |
76–77 | Not quite, the argument should be the linter code, so $this->getLintMessageSeverity($this->getLinterName()) |
src/lint/linter/ArcanistPuppetLinter.php | ||
---|---|---|
69 | Puppet output is with color codes. Code will look more complex if I'll try cleaning them. In other case puppet parser validate always returns only the first error. |
src/lint/linter/ArcanistPuppetLinter.php | ||
---|---|---|
69 | Ah OK. In that case, you should add --color false to the command to disable colored output. |