Page MenuHomePhabricator

Created ArcanistPuppetLinter
Needs RevisionPublic

Authored by Pawka on Mar 16 2015, 2:43 PM.
Referenced Files
F13264078: D12090.diff
Mon, May 27, 2:18 PM
F13262914: D12090.diff
Mon, May 27, 4:56 AM
F13245873: D12090.diff
Thu, May 23, 6:24 AM
F13235469: D12090.diff
Tue, May 21, 5:27 AM
F13220060: D12090.id30554.diff
Sat, May 18, 11:03 PM
F13197484: D12090.diff
Mon, May 13, 12:13 AM
F13178767: D12090.diff
Wed, May 8, 8:40 PM
Unknown Object (File)
May 6 2024, 9:58 PM

Details

Summary

Run puppet parser validate on *.pp files.

Test Plan

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 5857
Build 5877: [Placeholder Plan] Wait for 30 Seconds

Unit TestsFailed

TimeTest
461 msArcanistFlake8LinterTestCase::testLinter
296 msArcanistXMLLinterTestCase::testLinter
103 msArcanistChmodLinterTestCase::testLinter
56 msArcanistClosureLinterTestCase::testVersion
60 msArcanistCpplintLinterTestCase::testVersion
View Full Test Results (2 Failed · 35 Passed · 20 Skipped)

Event Timeline

Pawka retitled this revision from to Created ArcanistPuppetLinter.
Pawka updated this object.
Pawka edited the test plan for this revision. (Show Details)

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.

joshuaspence edited edge metadata.
joshuaspence added inline comments.
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.

This revision now requires changes to proceed.May 5 2015, 8:50 AM
Pawka edited edge metadata.

Updated code regarding comments.

joshuaspence edited edge metadata.

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())

Some minor inlines, otherwise looks good.

Pawka edited edge metadata.

Few more updates.

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.

Updated error matching regexp.

LGTM. FWIW, I'm looking forward to this change.

Does this require any input from me (as I can not land the diff)?
/cc @epriestley

epriestley edited edge metadata.

The handling of codes and severities is not correct, and means that severity and severity.rules will not be respected in .arclint. See discussion in D12034 for a specific example and how to resolve this issue. See D11657 for general discussion.

src/lint/linter/ArcanistPuppetLinter.php
74–75

This is not correct, see discussion.

This revision now requires changes to proceed.May 19 2015, 3:16 PM