jlong/radius

View on GitHub

Showing 20 of 29 total issues

Method operate has a Cognitive Complexity of 159 (exceeds 5 allowed). Consider refactoring.
Open

  public RubyArray operate(String tag_prefix, String input) {
    char[] data = input.toCharArray();
    String disposable_string;

    String name = "";
Severity: Minor
Found in lib/radius/parser/JavaScanner.java - About 3 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

Method operate has 259 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public RubyArray operate(String tag_prefix, String input) {
    char[] data = input.toCharArray();
    String disposable_string;

    String name = "";
Severity: Major
Found in lib/radius/parser/JavaScanner.java - About 1 day to fix

    File JavaScanner.java has 523 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    
    // line 1 "JavaScanner.rl"
    
    // line 84 "JavaScanner.rl"
    
    
    Severity: Major
    Found in lib/radius/parser/JavaScanner.java - About 1 day to fix

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

          def operate(prefix, data)
            data = Radius::OrdString.new data
            @nodes = ['']
            
            re = scanner_regex(prefix)
      Severity: Minor
      Found in lib/radius/parser/scanner.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 init__parser_trans_keys_0 has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      private static char[] init__parser_trans_keys_0()
      {
          return new char [] {
             58,   63,   95,   45,   46,   48,   57,   65,   90,   97,  122,   63,
             95,   45,   46,   48,   58,   65,   90,   97,  122,   32,   47,   62,
      Severity: Minor
      Found in lib/radius/parser/JavaScanner.java - About 1 hr to fix

        Method init__parser_indicies_0 has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        private static byte[] init__parser_indicies_0()
        {
            return new byte [] {
                2,    1,    1,    1,    1,    1,    1,    0,    3,    3,    3,    3,
                3,    3,    0,    4,    6,    7,    5,    5,    4,    5,    5,    5,
        Severity: Minor
        Found in lib/radius/parser/JavaScanner.java - About 1 hr to fix

          Method construct_tag_set has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

                  def construct_tag_set(name, options, &block)
                    if block
                      @context.definitions[name.to_s] = block
                    else
                      lp = last_part(name)
          Severity: Minor
          Found in lib/radius/tag_definitions.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 stack_up has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def stack_up
                @tokens.each do |t|
                  if t.is_a? String
                    @stack.last.contents << t
                    next
          Severity: Minor
          Found in lib/radius/parser.rb - About 55 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 array_to_s has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

                def self.array_to_s(c)
                  c.map do |x| 
                    res = (x.is_a?(Array) ? array_to_s(x) : x.to_s)
                    (res.frozen? ? res.dup : res).force_encoding(Encoding::UTF_8) 
                  end.join
          Severity: Minor
          Found in lib/radius/utility.rb - About 55 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 method_missing has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def method_missing(method, *args, &block)
                symbol = (method.to_s =~ /^(.*?)=$/) ? $1.intern : method
                if (0..1).include?(args.size)
                  if args.size == 1
                    @hash[symbol] = args.first
          Severity: Minor
          Found in lib/radius/delegating_open_struct.rb - About 55 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 deeply nested control flow statements.
          Open

                      if ( _upper < _lower )
                          break;
          Severity: Major
          Found in lib/radius/parser/JavaScanner.java - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                        switch ( _parser_actions[_acts++] )
                        {
                case 0:
            // line 4 "JavaScanner.rl"
                { mark_pfx = p; }
            Severity: Major
            Found in lib/radius/parser/JavaScanner.java - About 45 mins to fix

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

                    def numeric_specificity(tag_name, nesting_parts)
                      nesting_parts = nesting_parts.dup
                      name_parts = tag_name.split(':')
                      specificity = 0
                      value = 1
              Severity: Minor
              Found in lib/radius/context.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 validate_params has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                      def validate_params(name, options, &block)
                        unless options.has_key? :for
                          raise ArgumentError.new("tag definition must contain a :for option or a block") unless block
                          raise ArgumentError.new("tag definition must contain a :for option when used with the :expose option") unless options[:expose].empty?
                        end
              Severity: Minor
              Found in lib/radius/tag_definitions.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

              Avoid deeply nested control flow statements.
              Open

                          if ( data[p] < _parser_trans_keys[_mid] )
                              _upper = _mid - 2;
                          else if ( data[p] > _parser_trans_keys[_mid+1] )
                              _lower = _mid + 2;
                          else {
              Severity: Major
              Found in lib/radius/parser/JavaScanner.java - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                            if ( _upper < _lower )
                                break;
                Severity: Major
                Found in lib/radius/parser/JavaScanner.java - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                              if ( data[p] < _parser_trans_keys[_mid] )
                                  _upper = _mid - 1;
                              else if ( data[p] > _parser_trans_keys[_mid] )
                                  _lower = _mid + 1;
                              else {
                  Severity: Major
                  Found in lib/radius/parser/JavaScanner.java - About 45 mins to fix

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

                        def initialize(context, locals, name, attributes, block)
                    Severity: Minor
                    Found in lib/radius/tag_binding.rb - About 35 mins to fix

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

                          def render_tag(name, attributes = {}, &block)
                            if name =~ /^(.+?):(.+)$/
                              render_tag($1) { render_tag($2, attributes, &block) }
                            else
                              tag_definition_block = @definitions[qualified_tag_name(name.to_s)]
                      Severity: Minor
                      Found in lib/radius/context.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

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

                            def qualified_tag_name(name)
                              nesting_parts = @tag_binding_stack.collect { |tag| tag.name }
                              nesting_parts << name unless nesting_parts.last == name
                              specific_name = nesting_parts.join(':') # specific_name always has the highest specificity
                              unless @definitions.has_key? specific_name
                      Severity: Minor
                      Found in lib/radius/context.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

                      Severity
                      Category
                      Status
                      Source
                      Language