julianthome/autorex

View on GitHub

Showing 16 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

                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

                  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

                    Method unescapeSpecialCharacters has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public static String unescapeSpecialCharacters(String s) {
                            if (s == null)
                                return "";
                    
                            StringBuilder out = new StringBuilder();
                    Severity: Minor
                    Found in src/main/java/org/snt/autorex/utils/EscapeUtils.java - About 25 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