Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Example configuration:
</excludes>
<reporter>jslint</reporter>
<reportFile>target/jshint.xml</reportFile>
<failOnWarning>false</failOnWarning>
<failOnError>false</failOnError>
</configuration>
</plugin>
Expand Down Expand Up @@ -72,14 +73,15 @@ Configuration options:

| Option | Default value | Explanation |
| ---------------: | :---------------------------: | -------------|
| version | 2.4.1 | Selects which embedded version of jshint will be used |
| version | 2.4.3 | Selects which embedded version of jshint will be used |
| options | | List of comma-separated [JSHint options](http://www.jshint.com/docs/#options) |
| globals | | List of comma-separated [JSHint globals](http://www.jshint.com/docs/#usage) |
| configFile | | Path to a JSHint JSON config file. Its contents will override values set in `options` and `globals`, if present. Please note that block and line comments will be stripped prior to processing so it's OK to include them. |
| configFile | | Path to a JSHint JSON config file. Its contents will override values set in `options` and `globals`, if present. Can be relative or absolute file path. If not set or found, a search from project base up to the file system root will be made, looking for a file named '.jshintrc'. If none found, only the configured `globals` will be used for configuration. Please note that block and line comments will be stripped prior to processing so it's OK to include them. |
| directories | `<directory>src</directory>` | Locations in which the plugin will search for *.js files |
| excludes | | Excludes are resolved relative to the basedir of the module |
| reporter | | If present, JSHint will generate a reporting file which can be used for some CI tools. Currently, only `jslint` and `checkstyle` format are supported. |
| reportFile | target/jshint.xml | Path to an output reporting file |
| failOnError | true | Controls whether the plugin fails the build when JSHint is unhappy. Setting this to `false` is discouraged, as it removes most of the benefit of using this plugin. Instead, if you have problem files that you can't fix [disable/override JSHint on a per-file basis](http://www.jshint.com/docs/#config), or tell the plugin to specifically exclude them in the `excludes` section |
| failOnWarning | true | Same as `failOnError`, but with warnings. Setting this to true is recommended and the default behavior as in jshint-mojo <=v1.3.0. |


87 changes: 45 additions & 42 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,25 @@
<version>1.3.1-SNAPSHOT</version>
<packaging>maven-plugin</packaging>

<name>${project.artifactId}</name>
<name>${project.artifactId}</name>

<build>

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.4</version>
</plugin>
</plugins>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.4</version>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
Expand Down Expand Up @@ -66,35 +65,39 @@
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
</dependencies>

<!-- BEGIN: STUFF REQUIRED BY THE CENTRAL REPO -->
<description>a maven mojo that integrates the 'jshint' javascript preprocessor</description>
<url>https://github.com/cjdev/httpobjects</url>
<licenses>
<license>
<name>GPL 2 + classpath exception</name>
<url>https://raw.github.com/cjdev/jshint-mojo/master/LICENSE</url>
</license>
</licenses>
<url>https://github.com/cjdev/httpobjects</url>
<licenses>
<license>
<name>GPL 2 + classpath exception</name>
<url>https://raw.github.com/cjdev/jshint-mojo/master/LICENSE</url>
</license>
</licenses>
<scm>
<connection>scm:git:[email protected]:cjdev/jshint-mojo.git</connection>
<url>scm:git:[email protected]:cjdev/jshint-mojo.git</url>
<developerConnection>scm:git:[email protected]:cjdev/jshint-mojo.git</developerConnection>
<tag>HEAD</tag>
</scm>
<connection>scm:git:[email protected]:cjdev/jshint-mojo.git</connection>
<url>scm:git:[email protected]:cjdev/jshint-mojo.git</url>
<developerConnection>scm:git:[email protected]:cjdev/jshint-mojo.git</developerConnection>
<tag>HEAD</tag>
</scm>

<developers>
<developer>
<id>stu</id>
<name>Stu Penrose</name>
<email>[email protected]</email>
</developer>
<developers>
<developer>
<id>stu</id>
<name>Stu Penrose</name>
<email>[email protected]</email>
</developer>
<developer>
<id>Sebl29</id>
<email>[email protected]</email>
</developer>
</developers>
<!-- END: STUFF REQUIRED BY THE CENTRAL REPO -->
<!-- END: STUFF REQUIRED BY THE CENTRAL REPO -->
</project>
15 changes: 8 additions & 7 deletions src/main/java/com/cj/jshintmojo/DumpCacheMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,25 @@ public class DumpCacheMojo extends AbstractMojo {
* @required
*/
private File basedir;

public void execute() throws MojoExecutionException, MojoFailureException {

@Override
public void execute() throws MojoExecutionException, MojoFailureException {
try {

final File cachePath = new File(basedir, "target/lint.cache");

final Map<String, Result> entries;
if(cachePath.exists()){
entries = Util.readObject(cachePath);
}else{
entries = new HashMap<String, Result>();
}

for(Result r : entries.values()){
String status = r.errors.isEmpty()?"[OK]":"[BAD]";
String status = r.hints.isEmpty()?"[OK]":"[BAD]";
System.out.println(status + " " + r.path);
}

} catch (Exception e) {
throw new MojoExecutionException("Something bad happened", e);
}
Expand Down
Loading