jlong/radius

View on GitHub
lib/radius/parser/JavaScanner.java

Summary

Maintainability
F
1 wk
Test Coverage

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

          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

              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

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

                    private static byte[] init__parser_trans_targs_0()
                    {
                        return new byte [] {
                           49,    1,    2,    3,    4,    3,   12,   52,    4,    5,   12,   52,
                           49,    6,    5,    7,    6,    7,    8,   42,    9,   10,   13,    9,
                    Severity: Major
                    Found in lib/radius/parser/JavaScanner.java and 1 other location - About 4 hrs to fix
                    lib/radius/parser/JavaScanner.java on lines 247..262

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

                    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

                    private static byte[] init__parser_trans_actions_0()
                    {
                        return new byte [] {
                           27,    0,   31,    3,    5,    0,    5,    5,    0,   11,    0,    0,
                           29,   13,    0,   13,    0,    0,    0,    0,   15,   43,   15,    0,
                    Severity: Major
                    Found in lib/radius/parser/JavaScanner.java and 1 other location - About 4 hrs to fix
                    lib/radius/parser/JavaScanner.java on lines 227..242

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

                    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 7 locations. Consider refactoring.
                    Open

                    private static byte[] init__parser_to_state_actions_0()
                    {
                        return new byte [] {
                            0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
                            0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
                    Severity: Major
                    Found in lib/radius/parser/JavaScanner.java and 6 other locations - About 2 hrs to fix
                    lib/radius/parser/JavaScanner.java on lines 82..91
                    lib/radius/parser/JavaScanner.java on lines 143..152
                    lib/radius/parser/JavaScanner.java on lines 157..166
                    lib/radius/parser/JavaScanner.java on lines 171..180
                    lib/radius/parser/JavaScanner.java on lines 281..290
                    lib/radius/parser/JavaScanner.java on lines 295..304

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

                    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 7 locations. Consider refactoring.
                    Open

                    private static byte[] init__parser_range_lengths_0()
                    {
                        return new byte [] {
                            0,    4,    4,    4,    4,    5,    1,    1,    0,    0,    4,    4,
                            0,    0,    4,    4,    5,    1,    1,    4,    0,    0,    0,    4,
                    Severity: Major
                    Found in lib/radius/parser/JavaScanner.java and 6 other locations - About 2 hrs to fix
                    lib/radius/parser/JavaScanner.java on lines 82..91
                    lib/radius/parser/JavaScanner.java on lines 143..152
                    lib/radius/parser/JavaScanner.java on lines 171..180
                    lib/radius/parser/JavaScanner.java on lines 267..276
                    lib/radius/parser/JavaScanner.java on lines 281..290
                    lib/radius/parser/JavaScanner.java on lines 295..304

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

                    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 7 locations. Consider refactoring.
                    Open

                    private static short[] init__parser_index_offsets_0()
                    {
                        return new short [] {
                            0,    0,    8,   15,   25,   35,   45,   49,   54,   57,   60,   70,
                           80,   82,   85,   97,  109,  121,  127,  133,  145,  149,  153,  157,
                    Severity: Major
                    Found in lib/radius/parser/JavaScanner.java and 6 other locations - About 2 hrs to fix
                    lib/radius/parser/JavaScanner.java on lines 82..91
                    lib/radius/parser/JavaScanner.java on lines 143..152
                    lib/radius/parser/JavaScanner.java on lines 157..166
                    lib/radius/parser/JavaScanner.java on lines 267..276
                    lib/radius/parser/JavaScanner.java on lines 281..290
                    lib/radius/parser/JavaScanner.java on lines 295..304

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

                    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 7 locations. Consider refactoring.
                    Open

                    private static short[] init__parser_key_offsets_0()
                    {
                        return new short [] {
                            0,    0,   11,   21,   34,   47,   61,   65,   70,   72,   74,   87,
                          100,  101,  103,  118,  133,  149,  155,  161,  176,  179,  182,  185,
                    Severity: Major
                    Found in lib/radius/parser/JavaScanner.java and 6 other locations - About 2 hrs to fix
                    lib/radius/parser/JavaScanner.java on lines 143..152
                    lib/radius/parser/JavaScanner.java on lines 157..166
                    lib/radius/parser/JavaScanner.java on lines 171..180
                    lib/radius/parser/JavaScanner.java on lines 267..276
                    lib/radius/parser/JavaScanner.java on lines 281..290
                    lib/radius/parser/JavaScanner.java on lines 295..304

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

                    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 7 locations. Consider refactoring.
                    Open

                    private static short[] init__parser_eof_trans_0()
                    {
                        return new short [] {
                            0,    1,    1,    1,    1,   13,   13,   13,   13,   13,   13,   13,
                           13,   13,   13,   13,   13,   13,   13,   13,   13,   13,   13,   13,
                    Severity: Major
                    Found in lib/radius/parser/JavaScanner.java and 6 other locations - About 2 hrs to fix
                    lib/radius/parser/JavaScanner.java on lines 82..91
                    lib/radius/parser/JavaScanner.java on lines 143..152
                    lib/radius/parser/JavaScanner.java on lines 157..166
                    lib/radius/parser/JavaScanner.java on lines 171..180
                    lib/radius/parser/JavaScanner.java on lines 267..276
                    lib/radius/parser/JavaScanner.java on lines 281..290

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

                    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 7 locations. Consider refactoring.
                    Open

                    private static byte[] init__parser_from_state_actions_0()
                    {
                        return new byte [] {
                            0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
                            0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
                    Severity: Major
                    Found in lib/radius/parser/JavaScanner.java and 6 other locations - About 2 hrs to fix
                    lib/radius/parser/JavaScanner.java on lines 82..91
                    lib/radius/parser/JavaScanner.java on lines 143..152
                    lib/radius/parser/JavaScanner.java on lines 157..166
                    lib/radius/parser/JavaScanner.java on lines 171..180
                    lib/radius/parser/JavaScanner.java on lines 267..276
                    lib/radius/parser/JavaScanner.java on lines 295..304

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

                    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 7 locations. Consider refactoring.
                    Open

                    private static byte[] init__parser_single_lengths_0()
                    {
                        return new byte [] {
                            0,    3,    2,    5,    5,    4,    2,    3,    2,    2,    5,    5,
                            1,    2,    7,    7,    6,    4,    4,    7,    3,    3,    3,    7,
                    Severity: Major
                    Found in lib/radius/parser/JavaScanner.java and 6 other locations - About 2 hrs to fix
                    lib/radius/parser/JavaScanner.java on lines 82..91
                    lib/radius/parser/JavaScanner.java on lines 157..166
                    lib/radius/parser/JavaScanner.java on lines 171..180
                    lib/radius/parser/JavaScanner.java on lines 267..276
                    lib/radius/parser/JavaScanner.java on lines 281..290
                    lib/radius/parser/JavaScanner.java on lines 295..304

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

                    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

                    There are no issues that match your filters.

                    Category
                    Status