gabynaiman/nql

View on GitHub

Showing 38 of 38 total issues

Method _nt_comparator has a Cognitive Complexity of 138 (exceeds 5 allowed). Consider refactoring.
Open

    def _nt_comparator
      start_index = index
      if node_cache[:comparator].has_key?(index)
        cached = node_cache[:comparator][index]
        if cached
Severity: Minor
Found in lib/nql/grammar.rb - About 2 days 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

File grammar.rb has 757 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module NQL
  module Syntax
    include Treetop::Runtime

    def root
Severity: Major
Found in lib/nql/grammar.rb - About 1 day to fix

    Method _nt_primary has a Cognitive Complexity of 81 (exceeds 5 allowed). Consider refactoring.
    Open

        def _nt_primary
          start_index = index
          if node_cache[:primary].has_key?(index)
            cached = node_cache[:primary][index]
            if cached
    Severity: Minor
    Found in lib/nql/grammar.rb - About 1 day 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 _nt_text has a Cognitive Complexity of 72 (exceeds 5 allowed). Consider refactoring.
    Open

        def _nt_text
          start_index = index
          if node_cache[:text].has_key?(index)
            cached = node_cache[:text][index]
            if cached
    Severity: Minor
    Found in lib/nql/grammar.rb - About 1 day 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 _nt_comparator has 128 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def _nt_comparator
          start_index = index
          if node_cache[:comparator].has_key?(index)
            cached = node_cache[:comparator][index]
            if cached
    Severity: Major
    Found in lib/nql/grammar.rb - About 5 hrs to fix

      Method _nt_primary has 123 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def _nt_primary
            start_index = index
            if node_cache[:primary].has_key?(index)
              cached = node_cache[:primary][index]
              if cached
      Severity: Major
      Found in lib/nql/grammar.rb - About 4 hrs to fix

        Method _nt_text has 109 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def _nt_text
              start_index = index
              if node_cache[:text].has_key?(index)
                cached = node_cache[:text][index]
                if cached
        Severity: Major
        Found in lib/nql/grammar.rb - About 4 hrs to fix

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

              def _nt_boolean
                start_index = index
                if node_cache[:boolean].has_key?(index)
                  cached = node_cache[:boolean][index]
                  if cached
          Severity: Major
          Found in lib/nql/grammar.rb and 1 other location - About 3 hrs to fix
          lib/nql/grammar.rb on lines 401..442

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

          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

              def _nt_comparison
                start_index = index
                if node_cache[:comparison].has_key?(index)
                  cached = node_cache[:comparison][index]
                  if cached
          Severity: Major
          Found in lib/nql/grammar.rb and 1 other location - About 3 hrs to fix
          lib/nql/grammar.rb on lines 85..126

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

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

              def _nt_boolean
                start_index = index
                if node_cache[:boolean].has_key?(index)
                  cached = node_cache[:boolean][index]
                  if cached
          Severity: Minor
          Found in lib/nql/grammar.rb - About 2 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

          Method _nt_comparison has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

              def _nt_comparison
                start_index = index
                if node_cache[:comparison].has_key?(index)
                  cached = node_cache[:comparison][index]
                  if cached
          Severity: Minor
          Found in lib/nql/grammar.rb - About 2 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

          Method _nt_coordinator has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

              def _nt_coordinator
                start_index = index
                if node_cache[:coordinator].has_key?(index)
                  cached = node_cache[:coordinator][index]
                  if cached
          Severity: Minor
          Found in lib/nql/grammar.rb - About 2 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

          Method _nt_alphanumeric has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              def _nt_alphanumeric
                start_index = index
                if node_cache[:alphanumeric].has_key?(index)
                  cached = node_cache[:alphanumeric][index]
                  if cached
          Severity: Minor
          Found in lib/nql/grammar.rb - 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 2 locations. Consider refactoring.
          Open

              def _nt_symbol
                start_index = index
                if node_cache[:symbol].has_key?(index)
                  cached = node_cache[:symbol][index]
                  if cached
          Severity: Major
          Found in lib/nql/grammar.rb and 1 other location - About 1 hr to fix
          lib/nql/grammar.rb on lines 814..834

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

          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

              def _nt_utf8
                start_index = index
                if node_cache[:utf8].has_key?(index)
                  cached = node_cache[:utf8][index]
                  if cached
          Severity: Major
          Found in lib/nql/grammar.rb and 1 other location - About 1 hr to fix
          lib/nql/grammar.rb on lines 791..811

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

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

              def _nt_space
                start_index = index
                if node_cache[:space].has_key?(index)
                  cached = node_cache[:space][index]
                  if cached
          Severity: Minor
          Found in lib/nql/grammar.rb - 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 _nt_boolean has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def _nt_boolean
                start_index = index
                if node_cache[:boolean].has_key?(index)
                  cached = node_cache[:boolean][index]
                  if cached
          Severity: Minor
          Found in lib/nql/grammar.rb - About 1 hr to fix

            Method _nt_coordinator has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def _nt_coordinator
                  start_index = index
                  if node_cache[:coordinator].has_key?(index)
                    cached = node_cache[:coordinator][index]
                    if cached
            Severity: Minor
            Found in lib/nql/grammar.rb - About 1 hr to fix

              Method _nt_comparison has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def _nt_comparison
                    start_index = index
                    if node_cache[:comparison].has_key?(index)
                      cached = node_cache[:comparison][index]
                      if cached
              Severity: Minor
              Found in lib/nql/grammar.rb - About 1 hr to fix

                Method invalid_attributes has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                    def invalid_attributes(node, valid_attributes)
                      return [] unless node
                
                      node.deep_symbolize_keys.flat_map do |k, v|
                        if k == :a
                Severity: Minor
                Found in lib/nql/query.rb - 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

                Severity
                Category
                Status
                Source
                Language