Page MenuHomePhabricator

Add an `ArcanistCoffeeLintLinter` linter.
ClosedPublic

Authored by joshuaspence on May 11 2014, 3:28 AM.
Tags
None
Referenced Files
F14016988: D9051.id21766.diff
Mon, Nov 4, 12:41 PM
F13971662: D9051.id21597.diff
Thu, Oct 17, 2:36 PM
F13971520: D9051.id21650.diff
Thu, Oct 17, 1:47 PM
F13971512: D9051.id21658.diff
Thu, Oct 17, 1:44 PM
F13971501: D9051.id21765.diff
Thu, Oct 17, 1:41 PM
F13971486: D9051.id21766.diff
Thu, Oct 17, 1:38 PM
F13956088: D9051.id21765.diff
Mon, Oct 14, 4:09 AM
Unknown Object (File)
Sat, Oct 12, 9:00 AM
Subscribers

Details

Summary

Add a wrapper around CoffeeLint as an ArcanistExternalLinter.

Depends on D9041.

Test Plan

Wrote and executed unit tests.

Diff Detail

Repository
rARC Arcanist
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

joshuaspence retitled this revision from to Add an `ArcanistCoffeeLintLinter` linter..
joshuaspence updated this object.
joshuaspence edited the test plan for this revision. (Show Details)
joshuaspence added a reviewer: epriestley.

I'm not sure what the correct way (or if there is even any means to do so) to set .arclint configuration from the *.lint-test file. This is why the unit tests are currently failing.

epriestley edited edge metadata.

Two minor issues, and my guesses on the config thing. I'm open to any approach, but tend to think a full-strength approach (e.g., provide a mechanism for test linters to execute in an arbitrary environment populated with nice config files) is probably not worth it and would be more than satisfied with a "don't bother unit testing it" approach: as long as it works in manual tests, it seems very unlikely to break by surprise (provided coffeelint doesn't, like, ignore unrecognized arguments or consider a bad config file to mean "whatever, ignore it and keep going").

src/lint/linter/ArcanistCoffeeLintLinter.php
92–94

Rebase for type/help, namespace.

103

(Leftover debugging code?)

src/lint/linter/__tests__/coffeelint/arrow_spacing.lint-test
7–9 ↗(On Diff #21492)

I would expect this to work, so if it doesn't that's probably a bug of some kind.

A possible issue is that this path may be interpreted relative to the working copy during test execution -- I think? -- not relative to the arcanist root, so it will not exist. I'd expect coffeelint to fatal ("unable to read config file...") but maybe it has some kind of bizarre behavior like ignoring specified but nonexistent config files?

This could also just be straight-up bugged.

If writing the file is an issue, fixing it is probably messy.

Maybe the easiest thing for now is to not try to cover this behavior with tests.

This revision now requires changes to proceed.May 12 2014, 3:29 PM
In D9051#8, @epriestley wrote:

I'm open to any approach, but tend to think a full-strength approach (e.g., provide a mechanism for test linters to execute in an arbitrary environment populated with nice config files) is probably not worth it and would be more than satisfied with a "don't bother unit testing it" approach

I think that if it is easy enough for us to test, then we probably should. If nothing else, it makes sense to provide a range of test cases so that we can easily check if we remain compatible with the latest version of the external linter.

src/lint/linter/ArcanistCoffeeLintLinter.php
103

Yeah, good catch.

src/lint/linter/__tests__/coffeelint/arrow_spacing.lint-test
7–9 ↗(On Diff #21492)

This was my main motivation for D9067. I believe that ArcanistLinterTestCase was calling setConfig when I was expecting it to call setLinterConfigurationValue. I will have to verify the behaviour again after that diff closed.

Ok, so specifying a config file works more than previously, but still ultimately fails because the UnitTestableLintEngine has a temporary working copy. I'll just remove these tests for now.

joshuaspence edited edge metadata.

Rebased and made some minor changes as requested.

joshuaspence edited edge metadata.

Fix method name in test case.

src/lint/linter/ArcanistCoffeeLintLinter.php
39

It seems somewhat confusing now... we have getInfoName, getLinterName and getLinterConfigurationName.

55

This is pretty common... maybe it should be moved to a function somewhere.

138–150

This is used in a few places, maybe we should create an ArcanistLintSeverity::getLintSeverityFromString method.

epriestley edited edge metadata.

Minor inlines.

src/lint/linter/ArcanistCoffeeLintLinter.php
14

Make this private?

15–22

Share this with the similar code in D9112?

86

I think this causes double escaping.

This revision now requires changes to proceed.May 17 2014, 2:07 AM
joshuaspence edited edge metadata.

Made the requested changes.

epriestley edited edge metadata.
This revision is now accepted and ready to land.May 17 2014, 4:57 AM
epriestley updated this revision to Diff 21766.

Closed by commit rARC1493e043e1e0 (authored by @joshuaspence, committed by @epriestley).