This repository has been archived by the owner on May 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add maven project to lintchecker config
- Loading branch information
1 parent
3a73f57
commit ead2de5
Showing
27 changed files
with
424 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...cker-core/src/main/java/uk/gov/justice/raml/maven/lintchecker/LintCheckConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,30 @@ | ||
package uk.gov.justice.raml.maven.lintchecker; | ||
|
||
import uk.gov.justice.raml.maven.lintchecker.rules.LintCheckRule; | ||
|
||
import org.apache.maven.plugin.logging.Log; | ||
import org.apache.maven.project.MavenProject; | ||
|
||
/** | ||
* Contains any configuration needed by any of the {@link LintCheckRule}s. Currently this class | ||
* contains nothing, but to future proof the {@link LintCheckRule} interface we pass this class | ||
* in the execute() method. Add any configuration your rule may need here. | ||
*/ | ||
public class LintCheckConfiguration { | ||
|
||
private final MavenProject mavenProject; | ||
private final Log log; | ||
|
||
public LintCheckConfiguration(final MavenProject mavenProject, final Log log) { | ||
this.mavenProject = mavenProject; | ||
this.log = log; | ||
} | ||
|
||
public MavenProject getMavenProject() { | ||
return mavenProject; | ||
} | ||
|
||
public Log getLog() { | ||
return log; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...er-core/src/main/java/uk/gov/justice/raml/maven/lintchecker/LintCheckPluginException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package uk.gov.justice.raml.maven.lintchecker; | ||
|
||
public class LintCheckPluginException extends LintCheckerException { | ||
|
||
public LintCheckPluginException(final String message) { | ||
super(message); | ||
} | ||
|
||
public LintCheckPluginException(final String message, final Throwable cause) { | ||
super(message, cause); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...ore/src/main/java/uk/gov/justice/raml/maven/lintchecker/LintCheckRuleFailedException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package uk.gov.justice.raml.maven.lintchecker; | ||
|
||
public class LintCheckRuleFailedException extends LintCheckerException { | ||
|
||
public LintCheckRuleFailedException(final String message) { | ||
super(message); | ||
} | ||
|
||
public LintCheckRuleFailedException(final String message, final Throwable cause) { | ||
super(message, cause); | ||
} | ||
} |
9 changes: 8 additions & 1 deletion
9
...hecker-core/src/main/java/uk/gov/justice/raml/maven/lintchecker/LintCheckerException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,18 @@ | ||
package uk.gov.justice.raml.maven.lintchecker; | ||
|
||
import uk.gov.justice.raml.maven.lintchecker.rules.LintCheckRule; | ||
|
||
/** | ||
* Exception that is thrown if any of the {@link LintCheckRule}s fail. | ||
*/ | ||
public class LintCheckerException extends Exception { | ||
public abstract class LintCheckerException extends Exception { | ||
|
||
public LintCheckerException(final String message) { | ||
super(message); | ||
} | ||
|
||
public LintCheckerException(final String message, final Throwable cause) { | ||
super(message, cause); | ||
} | ||
|
||
} |
5 changes: 4 additions & 1 deletion
5
...raml/maven/lintchecker/LintCheckRule.java → ...aven/lintchecker/rules/LintCheckRule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...-core/src/test/java/uk/gov/justice/raml/maven/lintchecker/LintCheckConfigurationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package uk.gov.justice.raml.maven.lintchecker; | ||
|
||
import static org.hamcrest.core.Is.is; | ||
import static org.junit.Assert.assertThat; | ||
|
||
import org.apache.maven.plugin.logging.Log; | ||
import org.apache.maven.project.MavenProject; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.mockito.Mock; | ||
import org.mockito.runners.MockitoJUnitRunner; | ||
|
||
@RunWith(MockitoJUnitRunner.class) | ||
public class LintCheckConfigurationTest { | ||
|
||
@Mock | ||
private MavenProject mavenProject; | ||
|
||
@Mock | ||
private Log log; | ||
|
||
@Test | ||
public void shouldCreateConfiguration() { | ||
|
||
final LintCheckConfiguration lintCheckConfiguration = new LintCheckConfiguration(mavenProject, log); | ||
|
||
assertThat(lintCheckConfiguration.getLog(), is(log)); | ||
assertThat(lintCheckConfiguration.getMavenProject(), is(mavenProject)); | ||
|
||
|
||
} | ||
|
||
} |
13 changes: 13 additions & 0 deletions
13
...ore/src/test/java/uk/gov/justice/raml/maven/lintchecker/LintCheckPluginExceptionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package uk.gov.justice.raml.maven.lintchecker; | ||
|
||
import org.junit.Test; | ||
|
||
public class LintCheckPluginExceptionTest { | ||
|
||
@Test | ||
public void shouldCreateException() { | ||
final LintCheckPluginException exception = new LintCheckPluginException("test"); | ||
new LintCheckPluginException("test", exception); | ||
} | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
...src/test/java/uk/gov/justice/raml/maven/lintchecker/LintCheckRuleFailedExceptionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package uk.gov.justice.raml.maven.lintchecker; | ||
|
||
import org.junit.Test; | ||
|
||
public class LintCheckRuleFailedExceptionTest { | ||
|
||
|
||
@Test | ||
public void shouldCreateException() { | ||
final LintCheckerException exception = new LintCheckRuleFailedException("test"); | ||
new LintCheckRuleFailedException("test", exception); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
.../src/main/java/uk/gov/justice/raml/maven/lintchecker/processor/LintCheckerGoalConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package uk.gov.justice.raml.maven.lintchecker.processor; | ||
|
||
import uk.gov.justice.raml.maven.lintchecker.rules.LintCheckRule; | ||
|
||
import java.io.File; | ||
import java.util.List; | ||
|
||
import org.apache.maven.plugin.logging.Log; | ||
import org.apache.maven.project.MavenProject; | ||
|
||
public class LintCheckerGoalConfig { | ||
private final File sourceDirectory; | ||
private final List<LintCheckRule> rules; | ||
private final List<String> includes; | ||
private final List<String> excludes; | ||
private final MavenProject currentProject; | ||
private final Log log; | ||
|
||
public LintCheckerGoalConfig(final File sourceDirectory, | ||
final List<LintCheckRule> rules, | ||
final List<String> includes, | ||
final List<String> excludes, | ||
final MavenProject currentProject, | ||
final Log log) { | ||
this.sourceDirectory = sourceDirectory; | ||
this.rules = rules; | ||
this.includes = includes; | ||
this.excludes = excludes; | ||
this.currentProject = currentProject; | ||
this.log = log; | ||
} | ||
|
||
public File getSourceDirectory() { | ||
return sourceDirectory; | ||
} | ||
|
||
public List<LintCheckRule> getRules() { | ||
return rules; | ||
} | ||
|
||
public List<String> getIncludes() { | ||
return includes; | ||
} | ||
|
||
public List<String> getExcludes() { | ||
return excludes; | ||
} | ||
|
||
public MavenProject getCurrentProject() { | ||
return currentProject; | ||
} | ||
|
||
public Log getLog() { | ||
return log; | ||
} | ||
} |
Oops, something went wrong.