Page MenuHomePhabricator

Better linter using GREP.

Authored by CLOVIS on Jul 3 2018, 9:58 PM.



Created script Documentation available in its header.

Test Plan

Write random errors in the code and call arc lint.

Diff Detail

rLIBWFJVA WildFyre Java Libary
T229-better-linter (branched from master)
Lint Passed
No Test Coverage
Build Status
Buildable 478
Build 478: arc lint + arc unit

Event Timeline

Removed javadoc generation

Why not create the file in the .git dir, like git and arc do

would generate problems, if multiple users (or on user in multiple different dirs) would run arc lint, because the file doesn't link to the project.

This revision now requires changes to proceed.Jul 4 2018, 2:03 PM
  • Changed file location from /tmp to .git

Also, I *know* this is bad, but it's the only way I found to wait until the Gradle daemon is ready (because every gradle task is performed by the daemon)

This should be approved by infoscreen, I'm only approving to remove it from my queue


During gradle build, when there's an error, this is what happens:

  • The detail of the error is printed to stderr,
  • A single line with the name of the project and of the task is printed to stdout, such has: > Task libwf-java:javadoc FAILED

Arcanist expects the linters to work as in "a line is an error", so I ignore stderr (by forwarding it to /dev/null) and GREP the word 'FAILED' so that every line printed to stdout that does NOT contain the word is ignored (for example, the Gradle script prints the version number of the project). At the end, all is left as a result is the one-liners that only contain the name of the project & the task. This is enough to be sure that the linter will fail if there's an error and display the full name of the task that failed... if you need more information about the failure, you can re-run that single task yourself to get the details.

Of course that's not as perfect as an actual linter written for Arcanist in PHP, but it's pretty good to the point that:

  • If there's an error, Arcanist will fail and point to the specific task that failed (but it's up to you to rerun it to get the details)
  • If there's no errors, Arcanist will not fail.

That's not *perfect*, but that's reliable and is good enough that it won't cause any problems.

Info-Screen added inline comments.

Add a comment that explains the reason of the line.


Add this explanation to the file as a comment

This revision now requires changes to proceed.Jul 9 2018, 8:16 PM

@WyldBot you can resign from the revision, instead of just approving it.

CLOVIS marked 4 inline comments as done.
  • Merge branch 'master'
  • More comments
This comment was removed by CLOVIS.
  • Added linter for text length...
This revision is now accepted and ready to land.Jul 11 2018, 10:10 PM
This revision was automatically updated to reflect the committed changes.