Showing 85 of 85 total issues
Generator
has 55 methods (exceeds 20 allowed). Consider refactoring. Open
public final class Generator {
private final Diagrams diagrams;
private final Javadocs javadocs;
ASTBuilder
has 52 methods (exceeds 20 allowed). Consider refactoring. Open
public final class ASTBuilder extends AgBaseVisitor<ASTNode> {
private final Map<String, RuleExpression> fragments = new HashMap<>();
@Override
File ASTBuilder.java
has 420 lines of code (exceeds 250 allowed). Consider refactoring. Open
package silverchain.parser.adapter;
import java.util.HashMap;
import java.util.Map;
import org.antlr.v4.runtime.Token;
File Generator.java
has 352 lines of code (exceeds 250 allowed). Consider refactoring. Open
package silverchain.generator;
import static java.lang.String.join;
import static java.util.Collections.emptyList;
import static java.util.stream.Collectors.joining;
File Tests.java
has 285 lines of code (exceeds 250 allowed). Consider refactoring. Open
package diagram;
import static org.assertj.core.api.Assertions.assertThat;
import java.io.ByteArrayInputStream;
Javadocs
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
public final class Javadocs {
private final String path;
private final WarningHandler handler;
Method bulkTestData
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
static Arguments[] bulkTestData() {
return new Arguments[] {
args(AgParser::qualifiedName, "foo"),
args(AgParser::qualifiedName, "foo.bar"),
args(AgParser::qualifiedName, "foo.bar.baz"),
File Javadocs.java
has 257 lines of code (exceeds 250 allowed). Consider refactoring. Open
package silverchain.javadoc;
import static java.util.Arrays.stream;
import static java.util.stream.Collectors.joining;
Similar blocks of code found in 3 locations. Consider refactoring. Open
@Test
void test8() {
test("Foo { Qux bar(Bar bar) | baz(Baz baz); }")
.name("Foo")
.typeParameterCount(0)
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 117.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
@Test
void test10() {
test("Foo { Qux bar(Bar bar); Qux baz(Baz baz); }")
.name("Foo")
.typeParameterCount(0)
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 117.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
@Test
void test4() {
test("Foo { Baz bar(Bar bar) baz(Baz baz)*; }")
.name("Foo")
.typeParameterCount(0)
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 117.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method generateState
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void generateState(State state) {
beginFile(getFilePath(getStateQualifiedName(state)));
writePackageDeclaration(getStatePackageName(state));
// Class declaration
Method generateIAction
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void generateIAction(Diagram diagram) {
beginFile(getFilePath(getIActionQualifiedName(diagram)));
writePackageDeclaration(getIActionPackageName(diagram));
// Interface declaration
Method test12
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Test
void test12() {
test("Foo<T;S> { Qux bar(T t) baz(S s)*; }")
.name("Foo")
.typeParameterCount(2)
Method importMap
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public Map<String, QualifiedName> importMap() {
Map<String, QualifiedName> map = new HashMap<>();
if (importStatements().isPresent()) {
for (ImportStatement i : importStatements().get()) {
QualifiedName fullName = i.qualifiedName();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method test11
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Test
void test11() {
test("Foo<T;S> { Qux<T,S> bar(T t) baz(S s); }")
.name("Foo")
.typeParameterCount(2)
Similar blocks of code found in 13 locations. Consider refactoring. Open
@Override
public Type visitClassDeclarationHead(AgParser.ClassDeclarationHeadContext ctx) {
QualifiedName n = visitQualifiedName(ctx.qualifiedName());
TypeParameters ps = null;
if (ctx.classTypeParameterDeclarations() != null) {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 66.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 13 locations. Consider refactoring. Open
@Override
public RuleExpression visitRuleExpression(AgParser.RuleExpressionContext ctx) {
RuleTerm t = visitRuleTerm(ctx.ruleTerm());
RuleExpression e = null;
if (ctx.ruleExpression() != null) {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 66.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
private static Diagrams compile(InputStream stream) {
Diagrams diagrams = new Diagrams();
Input input = parse(stream);
for (Grammar grammar : input.grammars()) {
Diagram diagram = grammar.diagram(input.importMap());
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 66.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
private static Diagrams compile(InputStream stream) {
Diagrams diagrams = new Diagrams();
Input input = parse(stream);
for (Grammar grammar : input.grammars()) {
Diagram diagram = grammar.diagram(input.importMap());
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 66.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76