aurasphere/gomorra-sql

View on GitHub

Showing 9 of 13 total issues

Method transitionToNextState has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @Override
    public AbstractState transitionToNextState(String token) throws CaggiaFaException {
        if (token.equalsIgnoreCase(Keywords.SELECT_KEYWORD)) {
            queryInfo.setType(QueryType.SELECT);
            return new SelectColumnsState(queryInfo);
Severity: Minor
Found in src/main/java/co/aurasphere/gomorrasql/states/InitialState.java - About 1 hr to fix

    Method execute has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public GomorraSqlQueryResult execute(String gomorraSqlQuery) {
            QueryInfo queryInfo = parseQuery(gomorraSqlQuery);
            String sqlQuery = buildSqlQuery(queryInfo);
            GomorraSqlQueryResult result = new GomorraSqlQueryResult();
    
    
    Severity: Minor
    Found in src/main/java/co/aurasphere/gomorrasql/GomorraSqlInterpreter.java - About 1 hr to fix

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

          public static void main(String[] args) throws Exception {
              Scanner scanner = new Scanner(System.in, StandardCharsets.ISO_8859_1.name());
              System.out.print("Insert a JDBC string to connect to a database: ");
              String url = scanner.nextLine();
              Connection connection = DriverManager.getConnection(url);
      Severity: Minor
      Found in src/main/java/co/aurasphere/gomorrasql/GomorraSqlShell.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 transitionToNextState has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          @Override
          public AbstractState transitionToNextState(String token) throws CaggiaFaException {
              if (token.equals(",")) {
                  if (lastWasComma) {
                      // Case ", ,"

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

          @Override
          public AbstractState transitionToNextState(String token) throws CaggiaFaException {
              if (Keywords.WHERE_OPERATORS.contains(token) || token.equalsIgnoreCase(Keywords.IS_KEYWORD)) {
                  if (token.equalsIgnoreCase(Keywords.IS_NOT_KEYWORDS[0])) {
                      condition.setOperator("IS NOT");

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

          @Override
          public AbstractState transitionToNextState(String token) throws CaggiaFaException {
              if (token.equalsIgnoreCase(Keywords.SELECT_KEYWORD)) {
                  queryInfo.setType(QueryType.SELECT);
                  return new SelectColumnsState(queryInfo);
      Severity: Minor
      Found in src/main/java/co/aurasphere/gomorrasql/states/InitialState.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

      Avoid too many return statements within this method.
      Open

                  return new GreedyMatchKeywordState(queryInfo, Keywords.BEGIN_TRANSACTION_KEYWORDS, FinalState::new);
      Severity: Major
      Found in src/main/java/co/aurasphere/gomorrasql/states/InitialState.java - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                    return new GreedyMatchKeywordState(queryInfo, Keywords.COMMIT_KEYWORDS, FinalState::new);
        Severity: Major
        Found in src/main/java/co/aurasphere/gomorrasql/states/InitialState.java - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return new FinalState(queryInfo);
          Severity: Major
          Found in src/main/java/co/aurasphere/gomorrasql/states/InitialState.java - About 30 mins to fix
            Severity
            Category
            Status
            Source
            Language