julianthome/autorex

View on GitHub

Showing 25 of 25 total issues

Method eliminate has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

    public String eliminate(Gnfa a) {
        handleTrivialCases(a);

        while (a.vertexSet().size() > 2) {

Severity: Minor
Found in src/main/java/org/snt/autorex/StateEliminator.java - About 5 hrs to fix

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

AbstractGraph has 29 methods (exceeds 20 allowed). Consider refactoring.
Open

public class AbstractGraph implements DirectedGraph<State, Transition> {

    private final DirectedPseudograph<State, Transition> delegate;

    public AbstractGraph() {
Severity: Minor
Found in src/main/java/org/snt/autorex/autograph/AbstractGraph.java - About 3 hrs to fix

    AutomatonTrans has 26 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public class AutomatonTrans {
    
        final static Logger LOGGER = LoggerFactory.getLogger(AutomatonTrans.class);
    
        public enum Kind {
    Severity: Minor
    Found in src/main/java/org/snt/autorex/AutomatonTrans.java - About 3 hrs to fix

      File AutomatonTrans.java has 283 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /**
       * autorex - fsm state eliminator
       *
       * The MIT License (MIT)
       *
      Severity: Minor
      Found in src/main/java/org/snt/autorex/AutomatonTrans.java - About 2 hrs to fix

        Method eliminate has 54 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public String eliminate(Gnfa a) {
                handleTrivialCases(a);
        
                while (a.vertexSet().size() > 2) {
        
        
        Severity: Major
        Found in src/main/java/org/snt/autorex/StateEliminator.java - About 2 hrs to fix

          Method toDot has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public String toDot() {
          
                  StringBuilder sb = new StringBuilder();
                  sb.append("digraph {\n" +
                          "\trankdir=TB;\n");
          Severity: Major
          Found in src/main/java/org/snt/autorex/autograph/Gnfa.java - About 2 hrs to fix

            Method getGnfaFromAutomaton has 50 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public Gnfa getGnfaFromAutomaton(Automaton auto, LabelTranslator ltrans) {
                    Gnfa ag = new Gnfa();
                    AutomatonTrans at = new AutomatonTrans(auto, ltrans);
            
                    Map<State,org.snt.autorex.autograph.State> smap = new HashMap<>();
            Severity: Minor
            Found in src/main/java/org/snt/autorex/Converter.java - About 2 hrs to fix

              Method convertToCamelCaseAutomaton has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected void convertToCamelCaseAutomaton() {
              
                      Set<Transition> handled = new HashSet<Transition>();
              
                      for (State s : auto.getStates()) {
              Severity: Minor
              Found in src/main/java/org/snt/autorex/AutomatonTrans.java - About 1 hr to fix

              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 convertToCamelCaseAutomaton has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected void convertToCamelCaseAutomaton() {
              
                      Set<Transition> handled = new HashSet<Transition>();
              
                      for (State s : auto.getStates()) {
              Severity: Minor
              Found in src/main/java/org/snt/autorex/AutomatonTrans.java - About 1 hr to fix

                Method toDot has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    public String toDot() {
                
                        StringBuilder sb = new StringBuilder();
                        sb.append("digraph {\n" +
                                "\trankdir=TB;\n");
                Severity: Minor
                Found in src/main/java/org/snt/autorex/autograph/Gnfa.java - About 1 hr to fix

                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

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                                    if (a.containsEdge(qrip, qrip) && a.getEdge(qrip, qrip)
                                            .getLabel().length() > 0) {
                                        lbl.append("(");
                                        lbl.append(a.getEdge(qrip, qrip).getLabel());
                                        lbl.append(")*");
                Severity: Major
                Found in src/main/java/org/snt/autorex/StateEliminator.java and 2 other locations - About 50 mins to fix
                src/main/java/org/snt/autorex/StateEliminator.java on lines 91..95
                src/main/java/org/snt/autorex/StateEliminator.java on lines 105..110

                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 62.

                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

                Further Reading

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                                    if (a.containsEdge(qrip, qj) && a.getEdge(qrip, qj)
                                            .getLabel().length() > 0) {
                                        lbl.append("(");
                                        lbl.append(a.getEdge(qrip, qj).getLabel());
                                        lbl.append(")");
                Severity: Major
                Found in src/main/java/org/snt/autorex/StateEliminator.java and 2 other locations - About 50 mins to fix
                src/main/java/org/snt/autorex/StateEliminator.java on lines 91..95
                src/main/java/org/snt/autorex/StateEliminator.java on lines 98..103

                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 62.

                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

                Further Reading

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                                    if (a.containsEdge(qi, qrip) && a.getEdge(qi, qrip).getLabel().length() > 0) {
                                        lbl.append("(");
                                        lbl.append(a.getEdge(qi, qrip).getLabel());
                                        lbl.append(")");
                                    }
                Severity: Major
                Found in src/main/java/org/snt/autorex/StateEliminator.java and 2 other locations - About 50 mins to fix
                src/main/java/org/snt/autorex/StateEliminator.java on lines 98..103
                src/main/java/org/snt/autorex/StateEliminator.java on lines 105..110

                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 62.

                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

                Further Reading

                Avoid deeply nested control flow statements.
                Open

                                        if (lbl.length() > 0)
                                            lbl.append("|");
                Severity: Major
                Found in src/main/java/org/snt/autorex/StateEliminator.java - About 45 mins to fix

                  Method clone has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      @Override
                      public AutomatonTrans clone() {
                  
                          AutomatonTrans a = new AutomatonTrans();
                  
                  
                  Severity: Minor
                  Found in src/main/java/org/snt/autorex/AutomatonTrans.java - About 45 mins to fix

                  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

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                              Set<State> in = a.getConnectedInStates(qrip).stream()
                                      .filter(v -> v.getKind() != State.Kind.ACCEPT)
                                      .filter(v -> !v.equals(qrip)).collect
                                              (Collectors.toSet());
                  Severity: Minor
                  Found in src/main/java/org/snt/autorex/StateEliminator.java and 1 other location - About 40 mins to fix
                  src/main/java/org/snt/autorex/StateEliminator.java on lines 79..82

                  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 52.

                  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

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                              Set<State> out = a.getConnectedOutStates(qrip).stream()
                                      .filter(v -> v.getKind() != State.Kind.START)
                                      .filter(v -> !v.equals(qrip)).collect
                                              (Collectors.toSet());
                  Severity: Minor
                  Found in src/main/java/org/snt/autorex/StateEliminator.java and 1 other location - About 40 mins to fix
                  src/main/java/org/snt/autorex/StateEliminator.java on lines 74..77

                  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 52.

                  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

                  Further Reading

                  Method getStateFrom has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                              (Set<org.snt.autorex.autograph.State> start,
                               Set<org.snt.autorex.autograph.State> accepting,
                               Map<State,org.snt.autorex.autograph.State> smap,
                               AutomatonTrans a, State s) {
                  Severity: Minor
                  Found in src/main/java/org/snt/autorex/Converter.java - About 35 mins to fix

                    Method convertToLenAutomaton has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected void convertToLenAutomaton() {
                    
                            Map<Transition, State> transitions = new HashMap<>();
                    
                            for (State s : auto.getStates()) {
                    Severity: Minor
                    Found in src/main/java/org/snt/autorex/AutomatonTrans.java - About 35 mins to fix

                    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 subgraph has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private Gnfa subgraph(Collection<State> vertices) {
                            Gnfa g = new Gnfa();
                    
                            for (State n : vertices) {
                                g.addVertex(n);
                    Severity: Minor
                    Found in src/main/java/org/snt/autorex/autograph/Gnfa.java - About 35 mins to fix

                    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

                    Severity
                    Category
                    Status
                    Source
                    Language