zcommon/src/main/java/org/zkoss/json/parser/Yylex.java

Summary

Maintainability
F
4 days
Test Coverage

Method yylex has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
Open

  public Yytoken yylex() throws java.io.IOException, ParseException {
    int zzInput;
    int zzAction;

    // cached fields:
Severity: Minor
Found in zcommon/src/main/java/org/zkoss/json/parser/Yylex.java - 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 yylex has 176 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public Yytoken yylex() throws java.io.IOException, ParseException {
    int zzInput;
    int zzAction;

    // cached fields:
Severity: Major
Found in zcommon/src/main/java/org/zkoss/json/parser/Yylex.java - About 7 hrs to fix

    File Yylex.java has 444 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* The following code was generated by JFlex 1.4.2 */
    
    package org.zkoss.json.parser;
    
    class Yylex {
    Severity: Minor
    Found in zcommon/src/main/java/org/zkoss/json/parser/Yylex.java - About 6 hrs to fix

      Method zzRefill has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        private boolean zzRefill() throws java.io.IOException {
      
          /* first: make room (if you can) */
          if (zzStartRead > 0) {
            System.arraycopy(zzBuffer, zzStartRead,
      Severity: Minor
      Found in zcommon/src/main/java/org/zkoss/json/parser/Yylex.java - About 1 hr to fix

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

          private boolean zzRefill() throws java.io.IOException {
        
            /* first: make room (if you can) */
            if (zzStartRead > 0) {
              System.arraycopy(zzBuffer, zzStartRead,
        Severity: Minor
        Found in zcommon/src/main/java/org/zkoss/json/parser/Yylex.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 Yytoken(Yytoken.TYPE_COLON,null);
        Severity: Major
        Found in zcommon/src/main/java/org/zkoss/json/parser/Yylex.java - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                    { Double val=Double.valueOf(yytext()); return new Yytoken(Yytoken.TYPE_VALUE, val);
          Severity: Major
          Found in zcommon/src/main/java/org/zkoss/json/parser/Yylex.java - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                      { return new Yytoken(Yytoken.TYPE_LEFT_BRACE,null);
            Severity: Major
            Found in zcommon/src/main/java/org/zkoss/json/parser/Yylex.java - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                        { return new Yytoken(Yytoken.TYPE_LEFT_SQUARE,null);
              Severity: Major
              Found in zcommon/src/main/java/org/zkoss/json/parser/Yylex.java - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                          { return new Yytoken(Yytoken.TYPE_RIGHT_SQUARE,null);
                Severity: Major
                Found in zcommon/src/main/java/org/zkoss/json/parser/Yylex.java - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                return new Yytoken(Yytoken.TYPE_VALUE, val);
                  Severity: Major
                  Found in zcommon/src/main/java/org/zkoss/json/parser/Yylex.java - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                return null;
                    Severity: Major
                    Found in zcommon/src/main/java/org/zkoss/json/parser/Yylex.java - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                { return new Yytoken(Yytoken.TYPE_COMMA,null);
                      Severity: Major
                      Found in zcommon/src/main/java/org/zkoss/json/parser/Yylex.java - About 30 mins to fix

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

                          private static int zzUnpackAttribute(String packed, int offset, int [] result) {
                            int i = 0;       /* index in packed string  */
                            int j = offset;  /* index in unpacked array */
                            int l = packed.length();
                            while (i < l) {
                        Severity: Major
                        Found in zcommon/src/main/java/org/zkoss/json/parser/Yylex.java and 1 other location - About 1 hr to fix
                        zcommon/src/main/java/org/zkoss/json/parser/Yylex.java on lines 61..71

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

                        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 int zzUnpackAction(String packed, int offset, int [] result) {
                            int i = 0;       /* index in packed string  */
                            int j = offset;  /* index in unpacked array */
                            int l = packed.length();
                            while (i < l) {
                        Severity: Major
                        Found in zcommon/src/main/java/org/zkoss/json/parser/Yylex.java and 1 other location - About 1 hr to fix
                        zcommon/src/main/java/org/zkoss/json/parser/Yylex.java on lines 208..218

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

                        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

                            if (zzCurrentPos >= zzBuffer.length) {
                              /* if not: blow it up */
                              char newBuffer[] = new char[zzCurrentPos*2];
                              System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length);
                              zzBuffer = newBuffer;
                        Severity: Minor
                        Found in zcommon/src/main/java/org/zkoss/json/parser/Yylex.java and 1 other location - About 45 mins to fix
                        zel/src/main/java/org/zkoss/zel/impl/parser/SimpleNode.java on lines 72..76

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

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

                          private static int [] zzUnpackRowMap() {
                            int [] result = new int[45];
                            int offset = 0;
                            offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
                            return result;
                        Severity: Minor
                        Found in zcommon/src/main/java/org/zkoss/json/parser/Yylex.java and 2 other locations - About 30 mins to fix
                        zcommon/src/main/java/org/zkoss/json/parser/Yylex.java on lines 54..59
                        zcommon/src/main/java/org/zkoss/json/parser/Yylex.java on lines 201..206

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

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

                          private static int [] zzUnpackAction() {
                            int [] result = new int[45];
                            int offset = 0;
                            offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
                            return result;
                        Severity: Minor
                        Found in zcommon/src/main/java/org/zkoss/json/parser/Yylex.java and 2 other locations - About 30 mins to fix
                        zcommon/src/main/java/org/zkoss/json/parser/Yylex.java on lines 87..92
                        zcommon/src/main/java/org/zkoss/json/parser/Yylex.java on lines 201..206

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

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

                          private static int [] zzUnpackAttribute() {
                            int [] result = new int[45];
                            int offset = 0;
                            offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
                            return result;
                        Severity: Minor
                        Found in zcommon/src/main/java/org/zkoss/json/parser/Yylex.java and 2 other locations - About 30 mins to fix
                        zcommon/src/main/java/org/zkoss/json/parser/Yylex.java on lines 54..59
                        zcommon/src/main/java/org/zkoss/json/parser/Yylex.java on lines 87..92

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

                        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