Skip to content

Commit

Permalink
Merge branch '__rultor'
Browse files Browse the repository at this point in the history
  • Loading branch information
rultor committed Nov 23, 2015
2 parents 3e0e025 + 7c9225c commit cdffba0
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 16 deletions.
4 changes: 4 additions & 0 deletions qulice-maven-plugin/src/it/js-violations/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
<version>@project.version@</version>
<configuration>
<license>file:${basedir}/LICENSE.txt</license>
<excludes>
<exclude>jslint:other_*.js</exclude>
<exclude>jslint:**/bar/**</exclude>
</excludes>
</configuration>
<executions>
<execution>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

var a = "b" + c;

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

var a = "b" + c;

2 changes: 2 additions & 0 deletions qulice-maven-plugin/src/it/js-violations/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@

def log = new File(basedir, 'build.log')
assert log.text.findAll('violations.js:.*\'c\' has not been fully defined yet.').size() == 1
assert log.text.findAll('other_viol.js:.*\'c\' has not been fully defined yet.').size() == 0
assert log.text.findAll('new.js:.*\'c\' has not been fully defined yet.').size() == 0
Original file line number Diff line number Diff line change
Expand Up @@ -40,27 +40,25 @@
*/
public final class JslintValidator implements MavenValidator {

// @checkstyle RedundantThrows (4 lines)
@Override
public void validate(final MavenEnvironment env)
throws ValidationException {
final Properties config = new Properties();
config.setProperty("sourceJsFolder", "${basedir}/src/main");
final String jslint = "jslint";
if (!env.exclude(jslint, "")) {
try {
env.executor().execute(
"org.codehaus.mojo:jslint-maven-plugin:1.0.1",
jslint,
config
);
} catch (final IllegalStateException ex) {
// @checkstyle MethodBodyCommentsCheck (1 line)
// JsLint throws error if it can't find the sourceJsFolder
if (!(ex.getMessage().contains("basedir")
&& ex.getMessage().contains("does not exist"))) {
throw ex;
}
config.setProperty("sourceJsFolder", "${basedir}/src/main");
config.put("excludes", env.excludes(jslint));
try {
env.executor().execute(
"org.codehaus.mojo:jslint-maven-plugin:1.0.1",
jslint,
config
);
} catch (final IllegalStateException ex) {
// @checkstyle MethodBodyCommentsCheck (1 line)
// JsLint throws error if it can't find the sourceJsFolder
if (!(ex.getMessage().contains("basedir")
&& ex.getMessage().contains("does not exist"))) {
throw ex;
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions qulice-maven-plugin/src/site/apt/example-exclude.apt.vm
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ Exclude
2) <<<codenarc:**/src/ex1/Main.groovy,**/src/ex2/Main2.groovy>>> excludes
<<<Main.groovy>>> and <<<Main2.groovy>>> in appropriate packages.

Exclude for jslint also uses ant-style expressions, for example:
1) <<jslint:**/*.js>> excludes all <<.js>> files in all folders;
2) <<jslint:**/bar/main.js,**/foo/other.js>> excludes <<main.js>> and
<<other.js>> in the appropriate fodlers.

Exclude for Findbug is a bit different, as expression has to be either an
exact class name or start with the ~ character the rest of content is
interpreted as a Java regular expression. For example:
Expand Down

0 comments on commit cdffba0

Please sign in to comment.