Page MenuHomePhabricator

Created ArcanistPuppetLinter
Needs RevisionPublic

Authored by Pawka on Mar 16 2015, 2:43 PM.
Referenced Files
F14025614: D12090.diff
Thu, Nov 7, 6:58 PM
F13974574: D12090.id30613.diff
Fri, Oct 18, 6:15 AM
F13971096: D12090.id.diff
Thu, Oct 17, 11:34 AM
F13957495: D12090.id29086.diff
Mon, Oct 14, 9:38 AM
Unknown Object (File)
Oct 7 2024, 3:57 AM
Unknown Object (File)
Oct 7 2024, 1:24 AM
Unknown Object (File)
Oct 6 2024, 4:59 PM
Unknown Object (File)
Oct 6 2024, 3:54 AM

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

Unit TestsFailed

TimeTest
389 msArcanistFlake8LinterTestCase::testLinter
104 msArcanistChmodLinterTestCase::testLinter
56 msArcanistClosureLinterTestCase::testVersion
101 msArcanistCommitLinterTestCase::testLinter
62 msArcanistCpplintLinterTestCase::testVersion
View Full Test Results (1 Failed · 37 Passed · 18 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
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())

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
75–76

This is not correct, see discussion.

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