sleekbyte/tailor

View on GitHub

Showing 84 of 185 total issues

Method getFilesToAnalyze has 27 lines of code (exceeds 25 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 1 hr to fix

    Method addAllExpectedMsgs has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        @Override
        protected void addAllExpectedMsgs() {
            int start = 1;
            addExpectedMsg(start, 18, Severity.WARNING, Messages.STATEMENTS);
            addExpectedMsg(start + 5, 15, Severity.WARNING, Messages.STATEMENTS);
    Severity: Minor
    Found in src/test/java/com/sleekbyte/tailor/functional/SemicolonTest.java - About 1 hr to fix

      Method addAllExpectedMsgs has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          @Override
          protected void addAllExpectedMsgs() {
              int start = 3;
              addExpectedMsg(start, 8, Severity.WARNING, Messages.CONDITION + Messages.ENCLOSED_PARENTHESES);
              addExpectedMsg(start + 3, 13, Severity.WARNING, Messages.CONDITION + Messages.ENCLOSED_PARENTHESES);

        Method enterFunctionCallExpression has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            @Override
            public void enterFunctionCallExpression(FunctionCallExpressionContext ctx) {
                FunctionCallArgumentListContext argumentList =
                    ctx.functionCallArgumentClause().functionCallArgumentList();
        
        

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

            public static void main(String[] args) {
                Tailor tailor = new Tailor();
        
                try {
                    tailor.configuration = new Configuration(args);
        Severity: Minor
        Found in src/main/java/com/sleekbyte/tailor/Tailor.java - 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

        Function play has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            func play() {
                square = 0
                delegate?.gameDidStart(self)
                gameLoop: while square != finalSquare {
                    let diceRoll = dice.roll()
        Severity: Minor
        Found in src/test/swift/com/sleekbyte/tailor/grammar/Protocols.swift - 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 numberOfFilesBeforePurge has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public int numberOfFilesBeforePurge() throws CLIArgumentParserException {
                if (CLIArgumentParser.shouldClearDFAs()) {
                    int purge = CLIArgumentParser.numberOfFilesBeforePurge();
                    if (purge >= 1) {
                        return purge;
        Severity: Minor
        Found in src/main/java/com/sleekbyte/tailor/utils/Configuration.java - 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 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

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

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

                    Consider simplifying this complex logical expression.
                    Open

                            if (ctx == null
                                || ctx.getChildCount() != 1
                                || ctx.prefixExpression() == null
                                || ctx.prefixExpression().prefixOperator() != null // flag cases with trailing ;
                                || ctx.prefixExpression().postfixExpression() == null

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

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

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

                            private void addExpectedMsg(Rules rule, int line, int column, Severity classification, String msg) {
                        Severity: Minor
                        Found in src/test/java/com/sleekbyte/tailor/functional/FileRulesTest.java - About 35 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language