Page MenuHomePhabricator

Add an `ArcanistCoffeeLintLinter` linter.
ClosedPublic

Authored by joshuaspence on May 11 2014, 3:28 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Dec 20, 6:52 PM
Unknown Object (File)
Tue, Dec 17, 6:19 AM
Unknown Object (File)
Tue, Dec 17, 4:58 AM
Unknown Object (File)
Mon, Dec 16, 4:28 AM
Unknown Object (File)
Sun, Dec 15, 6:27 AM
Unknown Object (File)
Fri, Dec 6, 3:38 AM
Unknown Object (File)
Thu, Nov 28, 8:56 PM
Unknown Object (File)
Nov 19 2024, 12:00 PM
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).