BallAerospace/COSMOS

View on GitHub
cosmos/lib/cosmos/config/config_parser.rb

Summary

Maintainability
F
3 days
Test Coverage

Method parse_loop has a Cognitive Complexity of 79 (exceeds 5 allowed). Consider refactoring.
Open

      def parse_loop(io, yield_non_keyword_lines, remove_quotes, size, rx)
        line_continuation = false

        @line_number = 0
        @keyword = nil
Severity: Minor
Found in cosmos/lib/cosmos/config/config_parser.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 calculate_range_value has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def self.calculate_range_value(type, data_type, bit_size)
      value = 0 # Default for UINT minimum

      case data_type
      when :INT
Severity: Minor
Found in cosmos/lib/cosmos/config/config_parser.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

Avoid deeply nested control flow statements.
Open

                if !((string.length > 1) && (string[1] == '{'))
                  break
                end
Severity: Major
Found in cosmos/lib/cosmos/config/config_parser.rb - About 45 mins to fix

    Method parse_file has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def parse_file(filename,
                       yield_non_keyword_lines = false,
                       remove_quotes = true,
                       run_erb = true,
                       variables = {},
    Severity: Minor
    Found in cosmos/lib/cosmos/config/config_parser.rb - About 45 mins to fix

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

          def parse_file(filename,
                         yield_non_keyword_lines = false,
                         remove_quotes = true,
                         run_erb = true,
                         variables = {},
      Severity: Minor
      Found in cosmos/lib/cosmos/config/config_parser.rb - 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 parse_loop has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

            def parse_loop(io, yield_non_keyword_lines, remove_quotes, size, rx)
      Severity: Minor
      Found in cosmos/lib/cosmos/config/config_parser.rb - About 35 mins to fix

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

            def create_parsed_output_file(filename, run_erb, variables)
              begin
                output = nil
                if run_erb
                  Cosmos.set_working_dir(File.dirname(filename)) do
        Severity: Minor
        Found in cosmos/lib/cosmos/config/config_parser.rb - 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 2147483647
        Severity: Major
        Found in cosmos/lib/cosmos/config/config_parser.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                    return 0
          Severity: Major
          Found in cosmos/lib/cosmos/config/config_parser.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                      return -Float::MAX
            Severity: Major
            Found in cosmos/lib/cosmos/config/config_parser.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                        return -9223372036854775808
              Severity: Major
              Found in cosmos/lib/cosmos/config/config_parser.rb - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                          return 18446744073709551615
                Severity: Major
                Found in cosmos/lib/cosmos/config/config_parser.rb - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                            return Float::INFINITY
                  Severity: Major
                  Found in cosmos/lib/cosmos/config/config_parser.rb - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                              return 255
                    Severity: Major
                    Found in cosmos/lib/cosmos/config/config_parser.rb - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                return Float::MAX
                      Severity: Major
                      Found in cosmos/lib/cosmos/config/config_parser.rb - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                              return value
                        Severity: Major
                        Found in cosmos/lib/cosmos/config/config_parser.rb - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                    return -3.402823e38
                          Severity: Major
                          Found in cosmos/lib/cosmos/config/config_parser.rb - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                      return 65535
                            Severity: Major
                            Found in cosmos/lib/cosmos/config/config_parser.rb - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                        return 4294967295
                              Severity: Major
                              Found in cosmos/lib/cosmos/config/config_parser.rb - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                          return 3.402823e38
                                Severity: Major
                                Found in cosmos/lib/cosmos/config/config_parser.rb - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                            return 32767
                                  Severity: Major
                                  Found in cosmos/lib/cosmos/config/config_parser.rb - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                              return 9223372036854775807
                                    Severity: Major
                                    Found in cosmos/lib/cosmos/config/config_parser.rb - About 30 mins to fix

                                      Avoid too many return statements within this method.
                                      Open

                                                return -Float::INFINITY
                                      Severity: Major
                                      Found in cosmos/lib/cosmos/config/config_parser.rb - About 30 mins to fix

                                        Avoid too many return statements within this method.
                                        Open

                                                  return -2147483648
                                        Severity: Major
                                        Found in cosmos/lib/cosmos/config/config_parser.rb - About 30 mins to fix

                                          There are no issues that match your filters.

                                          Category
                                          Status