sleekbyte/tailor

View on GitHub

Showing 185 of 185 total issues

Function blendFrameDstBytes has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

func blendFrameDstBytes(dstBytes: Array<UnsafeMutablePointer<UInt8>>,
                        srcBytes: Array<UnsafeMutablePointer<UInt8>>,
                        blendOP: UInt8,
                        offsetX: UInt32,
                        offsetY: UInt32,
Severity: Major
Found in src/test/swift/com/sleekbyte/tailor/grammar/Generics.swift - About 50 mins to fix

    Method analyzeFile has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        private void analyzeFile(File inputFile,
                                 Optional<CommonTokenStream> optTokenStream,
                                 Optional<TopLevelContext> optTree,
                                 Formatter formatter,
                                 Severity maxSeverity,
    Severity: Major
    Found in src/main/java/com/sleekbyte/tailor/Tailor.java - About 50 mins to fix

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

          func indexIsValidForRow(row: Int, column: Int) -> Bool {
              return row >= 0 && row < rows && column >= 0 && column < columns
          }
      Severity: Minor
      Found in src/test/swift/com/sleekbyte/tailor/grammar/Subscripts.swift and 1 other location - About 50 mins to fix
      src/test/swift/com/sleekbyte/tailor/grammar/Subscripts.swift on lines 39..41

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

      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

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

      func indexIsValidForRow(row: Int, column: Int) -> Bool {
          return row >= 0 && row < rows && column >= 0 && column < columns
      }
      Severity: Minor
      Found in src/test/swift/com/sleekbyte/tailor/grammar/Subscripts.swift and 1 other location - About 50 mins to fix
      src/test/swift/com/sleekbyte/tailor/grammar/Subscripts.swift on lines 21..23

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

      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

          @Override
          public void enterDictionaryType(SwiftParser.DictionaryTypeContext ctx) {
              Token left = ctx.sType(0).getStop();
              Token right = ctx.sType(1).getStart();
              Token colon = ((TerminalNodeImpl) ctx.getChild(2)).getSymbol();
      src/main/java/com/sleekbyte/tailor/listeners/whitespace/ColonWhitespaceListener.java on lines 26..33

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

      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

          @Override
          public void enterDictionaryLiteralItem(SwiftParser.DictionaryLiteralItemContext ctx) {
              Token left = ctx.expression(0).getStop();
              Token right = ctx.expression(1).getStart();
              Token colon = ((TerminalNodeImpl) ctx.getChild(1)).getSymbol();
      src/main/java/com/sleekbyte/tailor/listeners/whitespace/ColonWhitespaceListener.java on lines 48..55

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

      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

          public static ParseTree getLeftNode(ParseTree ctx) {
              while (true) {
                  if (ctx == null) {
                      return null;
                  }
      Severity: Minor
      Found in src/main/java/com/sleekbyte/tailor/utils/ParseTreeUtil.java and 1 other location - About 50 mins to fix
      src/main/java/com/sleekbyte/tailor/utils/ParseTreeUtil.java on lines 120..131

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

      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

          public static ParseTree getRightNode(ParseTree ctx) {
              while (true) {
                  if (ctx == null) {
                      return null;
                  }
      Severity: Minor
      Found in src/main/java/com/sleekbyte/tailor/utils/ParseTreeUtil.java and 1 other location - About 50 mins to fix
      src/main/java/com/sleekbyte/tailor/utils/ParseTreeUtil.java on lines 101..112

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

      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

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

          private void addExpectedMessage(int line, int column, String msg) {
              this.expectedMessages.add(
                  Printer.genOutputStringForTest(
                      Rules.COLON_WHITESPACE,
                      inputFile.getName(),
      src/test/java/com/sleekbyte/tailor/functional/ArrowWhitespaceTest.java on lines 48..59

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

      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

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

          private void addExpectedMessage(int line, int column, String msg) {
              this.expectedMessages.add(
                  Printer.genOutputStringForTest(
                      Rules.ARROW_WHITESPACE,
                      inputFile.getName(),
      src/test/java/com/sleekbyte/tailor/functional/ColonWhitespaceTest.java on lines 127..138

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

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

          private void verifyBlankLinesAroundFunction(SwiftParser.FunctionDeclarationContext ctx) {
              SwiftParser.DeclarationContext declCtx = (SwiftParser.DeclarationContext) ctx.getParent();
      
              ParseTree left = ParseTreeUtil.getLeftNode(declCtx);
              if (left != null) {
      Severity: Minor
      Found in src/main/java/com/sleekbyte/tailor/listeners/BlankLineListener.java - 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 genOutputStringForTest has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public static String genOutputStringForTest(Rules rule, String filePath, int line, int column, Severity severity,
                                                      String msg) {
      Severity: Minor
      Found in src/main/java/com/sleekbyte/tailor/output/Printer.java - About 45 mins to fix

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

            private void addExpectedMsg(Rules rule, int line, int column, String msg, int length,
                                        int limit) {
        Severity: Minor
        Found in src/test/java/com/sleekbyte/tailor/functional/ConstructLengthTest.java - About 45 mins to fix

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

              private void verifyEnumBraceStyle(ParserRuleContext ctx) {
                  for (ParseTree child : ctx.children) {
                      if (child instanceof TerminalNodeImpl && child.getText().equals("{")) {
                          Token openBrace = ((TerminalNodeImpl) child).getSymbol();
                          Location openBraceLocation = ListenerUtil.getTokenLocation(openBrace);
          Severity: Minor
          Found in src/main/java/com/sleekbyte/tailor/listeners/BraceStyleListener.java - 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 syntaxError has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine,
                                      String msg, RecognitionException ex) {
          Severity: Minor
          Found in src/main/java/com/sleekbyte/tailor/listeners/ErrorListener.java - About 45 mins to fix

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

                public Set<String> getFilesToAnalyze() throws IOException, CLIArgumentParserException {
                    Optional<String> srcRoot = getSrcRoot();
                    List<String> pathNames = new ArrayList<>();
                    String[] cliPaths = cmd.getArgs();
            
            
            Severity: Minor
            Found in src/main/java/com/sleekbyte/tailor/utils/Configuration.java - 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 evaluatePattern has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                private void evaluatePattern(SwiftParser.PatternContext pattern) {
                    if (pattern.identifierPattern() != null) {
                        extractIdentifier(pattern.identifierPattern());
            
                    } else if (pattern.tuplePattern() != null && pattern.tuplePattern().tuplePatternElementList() != null) {
            Severity: Minor
            Found in src/main/java/com/sleekbyte/tailor/listeners/DeclarationListener.java - 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 createErrorMessage has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                protected void createErrorMessage(Rules rule, int constructLength, ParserRuleContext ctx, String constructType,
                                                  int length, String msg) {
            Severity: Minor
            Found in src/main/java/com/sleekbyte/tailor/listeners/lengths/LengthListener.java - About 45 mins to fix

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

              func +- (left: Vector2D, right: Vector2D) -> Vector2D {
                  return Vector2D(x: left.x + right.x, y: left.y - right.y)
              }
              src/test/swift/com/sleekbyte/tailor/grammar/AdvancedOperators.swift on lines 45..47

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

              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

              func + (left: Vector2D, right: Vector2D) -> Vector2D {
                  return Vector2D(x: left.x + right.x, y: left.y + right.y)
              }
              src/test/swift/com/sleekbyte/tailor/grammar/AdvancedOperators.swift on lines 64..66

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

              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

              Severity
              Category
              Status
              Source
              Language