Page MenuHomePhabricator

Basic linter for Java
ClosedPublic

Authored by CLOVIS on Jun 28 2018, 4:22 PM.

Details

Summary

This is a simple script&regex linter that calls the gradle scripts. As of now, what it does is:

  • The linter fails when the gradle build fails (tested for: syntax error, unit test error; untested for static code analysis)
  • The linter succeeds when the gradle build succeeds
  • The linter ignores lines that contain "warning" (because there are currently some warnings emitted by the javadoc generator, see T221)

As of now, the linter executes:

  • Compilation
  • Unit testing
  • Static code analysis
  • Exportation of Javadoc

As of now, the linter is not able to detail what the problem is. It is only able to execute/fail on the afore-mentioned cases. If it fails, you have to call the Gradle script yourself to get more details.

Test Plan

Call 'arc lint' and check that any error in the code is reported.

Diff Detail

Repository
rLIBWFJVA WildFyre Java Libary
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

CLOVIS edited the summary of this revision. (Show Details)
  • Newline at end of file

So, let me explain the situation.

This is a simple script&regex linter that calls the gradle scripts. As of now, what it does is:

  • The linter fails when the gradle build fails (tested for: syntax error, unit test error; untested for static code analysis)
  • The linter succeeds when the gradle build succeeds
  • The linter ignores lines that contain "warning" (because there are currently some warnings emitted by the javadoc generator, see T221)

As of now, the linter executes:

  • Compilation
  • Unit testing
  • Static code analysis
  • Exportation of Javadoc

As of now, the linter is not able to detail what the problem is. It is only able to execute/fail on the afore-mentioned cases. If it fails, you have to call the Gradle script yourself to get more details.

.arclint
26

Normally, the script&regex linter works by being invoked on each file one-by-one. Because Gradle already works using a daemon and parallel execution, it is more beneficial to call the Gradle script once and let it handle parallelism.

For this reason, I'm including only one file in the linter's files, to ensure it is only called once (so it doesn't overlap with Gradle's handling).

27

[see comment before] Because the linter appends the filename at the end of the command, I added a # to make it a comment -- this way the command is called as is.

28

Ignores everything that begins by -- and sets the severity as warning when the line contains the word "warning".

build.gradle
23

Added -- so the line ignored by the linter (otherwise the linter would abort and consider it as an error), see previous comment.

37

As expected, HTML is more easily readable but also slower to generate. I'm not sure about whether to keep the generation to HTML or only XML.

.idea/vcs.xml
7

This is a generated file, everytime it regenerates the EOL is stripped, and the file should be kept in versionning according to the IntelliJ devs.

Info-Screen edited the summary of this revision. (Show Details)
This revision is now accepted and ready to land.Jun 29 2018, 2:18 PM

I set the description you posted as comment as the summary, so it lands in the commit

I set the description you posted as comment as the summary, so it lands in the commit

Thanks

This revision was automatically updated to reflect the committed changes.