-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implementation of #113 Plugin Facility for Sputnik Processors #131
Merged
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
537ad67
Implementation of #113 Plugin Facility for Sputnik Processors
mirkosertic c209b20
Implementation of #113 Plugin Facility for Sputnik Processors
1c37bef
Implementation of #113 Plugin Facility for Sputnik Processors
b4d0f02
Implementation of #113 Plugin Facility for Sputnik Processors
efb1291
Implemented #130
mirkosertic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
11 changes: 11 additions & 0 deletions
11
src/main/java/pl/touk/sputnik/processor/ReviewProcessorFactory.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,11 @@ | ||
package pl.touk.sputnik.processor; | ||
|
||
import pl.touk.sputnik.configuration.Configuration; | ||
import pl.touk.sputnik.review.ReviewProcessor; | ||
|
||
public interface ReviewProcessorFactory<T extends ReviewProcessor> { | ||
|
||
boolean isEnabled(Configuration configuration); | ||
|
||
T create(Configuration configuration); | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/pl/touk/sputnik/processor/checkstyle/CheckstyleReviewProcessorFactory.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,18 @@ | ||
package pl.touk.sputnik.processor.checkstyle; | ||
|
||
import pl.touk.sputnik.configuration.Configuration; | ||
import pl.touk.sputnik.configuration.GeneralOption; | ||
import pl.touk.sputnik.processor.ReviewProcessorFactory; | ||
|
||
public class CheckstyleReviewProcessorFactory implements ReviewProcessorFactory<CheckstyleProcessor> { | ||
|
||
@Override | ||
public boolean isEnabled(Configuration configuration) { | ||
return Boolean.valueOf(configuration.getProperty(GeneralOption.CHECKSTYLE_ENABLED)); | ||
} | ||
|
||
@Override | ||
public CheckstyleProcessor create(Configuration configuration) { | ||
return new CheckstyleProcessor(configuration); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/pl/touk/sputnik/processor/codenarc/NodeCardReviewProcessorFactory.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,18 @@ | ||
package pl.touk.sputnik.processor.codenarc; | ||
|
||
import pl.touk.sputnik.configuration.Configuration; | ||
import pl.touk.sputnik.configuration.GeneralOption; | ||
import pl.touk.sputnik.processor.ReviewProcessorFactory; | ||
|
||
public class NodeCardReviewProcessorFactory implements ReviewProcessorFactory<CodeNarcProcessor> { | ||
|
||
@Override | ||
public boolean isEnabled(Configuration configuration) { | ||
return Boolean.valueOf(configuration.getProperty(GeneralOption.CODE_NARC_ENABLED)); | ||
} | ||
|
||
@Override | ||
public CodeNarcProcessor create(Configuration configuration) { | ||
return new CodeNarcProcessor(configuration); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/pl/touk/sputnik/processor/findbugs/FindbugsReviewProcessorFactory.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,18 @@ | ||
package pl.touk.sputnik.processor.findbugs; | ||
|
||
import pl.touk.sputnik.configuration.Configuration; | ||
import pl.touk.sputnik.configuration.GeneralOption; | ||
import pl.touk.sputnik.processor.ReviewProcessorFactory; | ||
|
||
public class FindbugsReviewProcessorFactory implements ReviewProcessorFactory<FindBugsProcessor> { | ||
|
||
@Override | ||
public boolean isEnabled(Configuration configuration) { | ||
return Boolean.valueOf(configuration.getProperty(GeneralOption.FINDBUGS_ENABLED)); | ||
} | ||
|
||
@Override | ||
public FindBugsProcessor create(Configuration configuration) { | ||
return new FindBugsProcessor(configuration); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/pl/touk/sputnik/processor/jshint/JsHintReviewProcessorFactory.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,18 @@ | ||
package pl.touk.sputnik.processor.jshint; | ||
|
||
import pl.touk.sputnik.configuration.Configuration; | ||
import pl.touk.sputnik.configuration.GeneralOption; | ||
import pl.touk.sputnik.processor.ReviewProcessorFactory; | ||
|
||
public class JsHintReviewProcessorFactory implements ReviewProcessorFactory<JsHintProcessor> { | ||
|
||
@Override | ||
public boolean isEnabled(Configuration configuration) { | ||
return Boolean.valueOf(configuration.getProperty(GeneralOption.JSHINT_ENABLED)); | ||
} | ||
|
||
@Override | ||
public JsHintProcessor create(Configuration configuration) { | ||
return new JsHintProcessor(configuration); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/pl/touk/sputnik/processor/jslint/JsLintReviewProcessorFactory.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,18 @@ | ||
package pl.touk.sputnik.processor.jslint; | ||
|
||
import pl.touk.sputnik.configuration.Configuration; | ||
import pl.touk.sputnik.configuration.GeneralOption; | ||
import pl.touk.sputnik.processor.ReviewProcessorFactory; | ||
|
||
public class JsLintReviewProcessorFactory implements ReviewProcessorFactory<JsLintProcessor> { | ||
|
||
@Override | ||
public boolean isEnabled(Configuration configuration) { | ||
return Boolean.valueOf(configuration.getProperty(GeneralOption.JSLINT_ENABLED)); | ||
} | ||
|
||
@Override | ||
public JsLintProcessor create(Configuration configuration) { | ||
return new JsLintProcessor(configuration); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/pl/touk/sputnik/processor/pmd/PmdReviewProcessorFactory.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,18 @@ | ||
package pl.touk.sputnik.processor.pmd; | ||
|
||
import pl.touk.sputnik.configuration.Configuration; | ||
import pl.touk.sputnik.configuration.GeneralOption; | ||
import pl.touk.sputnik.processor.ReviewProcessorFactory; | ||
|
||
public class PmdReviewProcessorFactory implements ReviewProcessorFactory<PmdProcessor> { | ||
|
||
@Override | ||
public boolean isEnabled(Configuration configuration) { | ||
return Boolean.valueOf(configuration.getProperty(GeneralOption.PMD_ENABLED)); | ||
} | ||
|
||
@Override | ||
public PmdProcessor create(Configuration configuration) { | ||
return new PmdProcessor(configuration); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/pl/touk/sputnik/processor/scalastyle/ScalastyleReviewProcessorFactory.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,18 @@ | ||
package pl.touk.sputnik.processor.scalastyle; | ||
|
||
import pl.touk.sputnik.configuration.Configuration; | ||
import pl.touk.sputnik.configuration.GeneralOption; | ||
import pl.touk.sputnik.processor.ReviewProcessorFactory; | ||
|
||
public class ScalastyleReviewProcessorFactory implements ReviewProcessorFactory<ScalastyleProcessor> { | ||
|
||
@Override | ||
public boolean isEnabled(Configuration configuration) { | ||
return Boolean.valueOf(configuration.getProperty(GeneralOption.SCALASTYLE_ENABLED)); | ||
} | ||
|
||
@Override | ||
public ScalastyleProcessor create(Configuration configuration) { | ||
return new ScalastyleProcessor(configuration); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/pl/touk/sputnik/processor/sonar/SonarReviewProcessorFactory.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,18 @@ | ||
package pl.touk.sputnik.processor.sonar; | ||
|
||
import pl.touk.sputnik.configuration.Configuration; | ||
import pl.touk.sputnik.configuration.GeneralOption; | ||
import pl.touk.sputnik.processor.ReviewProcessorFactory; | ||
|
||
public class SonarReviewProcessorFactory implements ReviewProcessorFactory<SonarProcessor> { | ||
|
||
@Override | ||
public boolean isEnabled(Configuration configuration) { | ||
return Boolean.valueOf(configuration.getProperty(GeneralOption.SONAR_ENABLED)); | ||
} | ||
|
||
@Override | ||
public SonarProcessor create(Configuration configuration) { | ||
return new SonarProcessor(configuration); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/resources/META-INF/services/pl.touk.sputnik.processor.ReviewProcessorFactory
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,8 @@ | ||
pl.touk.sputnik.processor.checkstyle.CheckstyleReviewProcessorFactory | ||
pl.touk.sputnik.processor.pmd.PmdReviewProcessorFactory | ||
pl.touk.sputnik.processor.findbugs.FindbugsReviewProcessorFactory | ||
pl.touk.sputnik.processor.scalastyle.ScalastyleReviewProcessorFactory | ||
pl.touk.sputnik.processor.codenarc.NodeCardReviewProcessorFactory | ||
pl.touk.sputnik.processor.jslint.JsLintReviewProcessorFactory | ||
pl.touk.sputnik.processor.jshint.JsHintReviewProcessorFactory | ||
pl.touk.sputnik.processor.sonar.SonarReviewProcessorFactory |
34 changes: 34 additions & 0 deletions
34
src/test/java/pl/touk/sputnik/processor/checkstyle/CheckstyleReviewProcessorFactoryTest.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,34 @@ | ||
package pl.touk.sputnik.processor.checkstyle; | ||
|
||
import pl.touk.sputnik.configuration.Configuration; | ||
import pl.touk.sputnik.configuration.GeneralOption; | ||
import pl.touk.sputnik.processor.ReviewProcessorFactory; | ||
|
||
import org.junit.Test; | ||
|
||
import static org.junit.Assert.*; | ||
import static org.mockito.Matchers.eq; | ||
import static org.mockito.Mockito.mock; | ||
import static org.mockito.Mockito.when; | ||
|
||
public class CheckstyleReviewProcessorFactoryTest { | ||
|
||
@Test | ||
public void testIsEnabled() throws Exception { | ||
Configuration configuration = mock(Configuration.class); | ||
when(configuration.getProperty(eq(GeneralOption.CHECKSTYLE_ENABLED))).thenReturn("true"); | ||
|
||
ReviewProcessorFactory factory = new CheckstyleReviewProcessorFactory(); | ||
assertTrue(factory.isEnabled(configuration)); | ||
} | ||
|
||
@Test | ||
public void testCreate() throws Exception { | ||
Configuration configuration = mock(Configuration.class); | ||
when(configuration.getProperty(eq(GeneralOption.CHECKSTYLE_ENABLED))).thenReturn("true"); | ||
|
||
ReviewProcessorFactory factory = new CheckstyleReviewProcessorFactory(); | ||
assertNotNull(factory.create(configuration)); | ||
} | ||
|
||
} |
34 changes: 34 additions & 0 deletions
34
src/test/java/pl/touk/sputnik/processor/codenarc/NodeCardReviewProcessorFactoryTest.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,34 @@ | ||
package pl.touk.sputnik.processor.codenarc; | ||
|
||
import pl.touk.sputnik.configuration.Configuration; | ||
import pl.touk.sputnik.configuration.GeneralOption; | ||
import pl.touk.sputnik.processor.ReviewProcessorFactory; | ||
|
||
import org.junit.Test; | ||
|
||
import static org.junit.Assert.*; | ||
import static org.mockito.Matchers.eq; | ||
import static org.mockito.Mockito.mock; | ||
import static org.mockito.Mockito.when; | ||
|
||
public class NodeCardReviewProcessorFactoryTest { | ||
|
||
@Test | ||
public void testIsEnabled() throws Exception { | ||
Configuration configuration = mock(Configuration.class); | ||
when(configuration.getProperty(eq(GeneralOption.CODE_NARC_ENABLED))).thenReturn("true"); | ||
|
||
ReviewProcessorFactory factory = new NodeCardReviewProcessorFactory(); | ||
assertTrue(factory.isEnabled(configuration)); | ||
} | ||
|
||
@Test | ||
public void testCreate() throws Exception { | ||
Configuration configuration = mock(Configuration.class); | ||
when(configuration.getProperty(eq(GeneralOption.CODE_NARC_ENABLED))).thenReturn("true"); | ||
|
||
ReviewProcessorFactory factory = new NodeCardReviewProcessorFactory(); | ||
assertNotNull(factory.create(configuration)); | ||
} | ||
|
||
} |
33 changes: 33 additions & 0 deletions
33
src/test/java/pl/touk/sputnik/processor/findbugs/FindbugsReviewProcessorFactoryTest.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 pl.touk.sputnik.processor.findbugs; | ||
|
||
import pl.touk.sputnik.configuration.Configuration; | ||
import pl.touk.sputnik.configuration.GeneralOption; | ||
import pl.touk.sputnik.processor.ReviewProcessorFactory; | ||
|
||
import org.junit.Test; | ||
|
||
import static org.junit.Assert.*; | ||
import static org.mockito.Matchers.eq; | ||
import static org.mockito.Mockito.mock; | ||
import static org.mockito.Mockito.when; | ||
|
||
public class FindbugsReviewProcessorFactoryTest { | ||
|
||
@Test | ||
public void testIsEnabled() throws Exception { | ||
Configuration configuration = mock(Configuration.class); | ||
when(configuration.getProperty(eq(GeneralOption.FINDBUGS_ENABLED))).thenReturn("true"); | ||
|
||
ReviewProcessorFactory factory = new FindbugsReviewProcessorFactory(); | ||
assertTrue(factory.isEnabled(configuration)); | ||
} | ||
|
||
@Test | ||
public void testCreate() throws Exception { | ||
Configuration configuration = mock(Configuration.class); | ||
when(configuration.getProperty(eq(GeneralOption.FINDBUGS_ENABLED))).thenReturn("true"); | ||
|
||
ReviewProcessorFactory factory = new FindbugsReviewProcessorFactory(); | ||
assertNotNull(factory.create(configuration)); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/test/java/pl/touk/sputnik/processor/jshint/JsHintReviewProcessorFactoryTest.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,34 @@ | ||
package pl.touk.sputnik.processor.jshint; | ||
|
||
import pl.touk.sputnik.configuration.Configuration; | ||
import pl.touk.sputnik.configuration.GeneralOption; | ||
import pl.touk.sputnik.processor.ReviewProcessorFactory; | ||
import pl.touk.sputnik.processor.checkstyle.CheckstyleReviewProcessorFactory; | ||
|
||
import org.junit.Test; | ||
|
||
import static org.junit.Assert.*; | ||
import static org.mockito.Matchers.eq; | ||
import static org.mockito.Mockito.mock; | ||
import static org.mockito.Mockito.when; | ||
|
||
public class JsHintReviewProcessorFactoryTest { | ||
|
||
@Test | ||
public void testIsEnabled() throws Exception { | ||
Configuration configuration = mock(Configuration.class); | ||
when(configuration.getProperty(eq(GeneralOption.JSHINT_ENABLED))).thenReturn("true"); | ||
|
||
ReviewProcessorFactory factory = new JsHintReviewProcessorFactory(); | ||
assertTrue(factory.isEnabled(configuration)); | ||
} | ||
|
||
@Test | ||
public void testCreate() throws Exception { | ||
Configuration configuration = mock(Configuration.class); | ||
when(configuration.getProperty(eq(GeneralOption.JSHINT_ENABLED))).thenReturn("true"); | ||
|
||
ReviewProcessorFactory factory = new JsHintReviewProcessorFactory(); | ||
assertNotNull(factory.create(configuration)); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Checkstyle] ERROR: Unused import - pl.touk.sputnik.processor.checkstyle.CheckstyleReviewProcessorFactory.