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 4902 Build 4920: [Placeholder Plan] Wait for 30 Seconds
| Time | Test | |
|---|---|---|
| 910 ms | ArcanistFlake8LinterTestCase::testLinter | |
| 211 ms | ArcanistChmodLinterTestCase::testLinter | |
| 119 ms | ArcanistClosureLinterTestCase::testVersion | |
| 204 ms | ArcanistCommitLinterTestCase::testLinter | |
| 120 ms | ArcanistCpplintLinterTestCase::testVersion | |
| View Full Test Results (1 Failed · 35 Passed · 20 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 | ||
|---|---|---|
| 4 | Change this to Runs `puppet parser validate` for Puppet files.. | |
| 11 | I think that Puppet is a more reasonable name for this linter. | |
| 20 | Missing space after "or" | |
| 22 | This isn't correct, there is no %s in the string. | |
| 54 | Prefer to write this as pht('Install puppet using `%s` or similar.', 'apt-get install puppet') | |
| 59 | Kill this blank line. | |
| 77 | Prefer to use getLintMessageSeverity so that the severity is configurable. | |
| 79 | 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 | ||
|---|---|---|
| 9 | Unused variable, just remove this. | |
| 54 | The first argument should be on a newline. | |
| 59 | Kill this blank line. | |
| 69 | Try to be a bit more restrictive with the regular expression... I think /^Error: (.*)at (.*):(\d+)$/ would be better. | |
| 77–78 | 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. | |