sleekbyte/tailor

View on GitHub

Showing 84 of 185 total issues

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

    @Override
    protected void addAllExpectedMsgs() {
        // Whitespace before open braces

        // functions

    Method analyzeFiles has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private void analyzeFiles(Set<String> fileNames) throws CLIArgumentParserException, IOException {
            ColorSettings colorSettings =
                new ColorSettings(configuration.shouldColorOutput(), configuration.shouldInvertColorOutput());
            Formatter formatter = configuration.getFormatter(colorSettings);
            Severity maxSeverity = configuration.getMaxSeverity();
    Severity: Minor
    Found in src/main/java/com/sleekbyte/tailor/Tailor.java - About 1 hr to fix

      Method expectedOutput has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private String expectedOutput(List<ViolationMessage> list) throws IOException {
              String violations = "";
      
              for (ViolationMessage msg : list) {
                  Map<String, Object> violation = new HashMap<>();
      Severity: Minor
      Found in src/test/java/com/sleekbyte/tailor/format/CCFormatterTest.java - About 1 hr to fix

        Method getCCMessages has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private List<Map<String, Object>> getCCMessages() {
                List<Map<String, Object>> violations = new ArrayList<>();
        
                for (ViolationMessage msg : getExpectedMsgs()) {
                    Map<String, Object> violation = new HashMap<>();
        Severity: Minor
        Found in src/test/java/com/sleekbyte/tailor/functional/FormatTest.java - About 1 hr to fix

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

            Method addOptions has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private void addOptions() {
                    options = new Options();
            
                    options.addOption(createNoArgOpt(Messages.HELP_SHORT_OPT, Messages.HELP_LONG_OPT, Messages.HELP_DESC));
                    options.addOption(createNoArgOpt(Messages.VERSION_SHORT_OPT, Messages.VERSION_LONG_OPT, Messages.VERSION_DESC));
            Severity: Minor
            Found in src/main/java/com/sleekbyte/tailor/utils/CLIArgumentParser.java - About 1 hr to fix

              Function demo has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

              func demo() {
                  var x: Int
                  if (x == 2) {
                      return (x < 2)
                  }

              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 getHTMLMessages has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private Map<String, Object> getHTMLMessages() throws IOException {
                      List<Map<String, Object>> violations = new ArrayList<>();
                      for (ViolationMessage msg : getExpectedMsgs()) {
                          Map<String, Object> violation = new HashMap<>();
                          Map<String, Object> location = new HashMap<>();
              Severity: Minor
              Found in src/test/java/com/sleekbyte/tailor/functional/FormatTest.java - About 1 hr to fix

                Method displayViolationMessages has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    @Override
                    public void displayViolationMessages(List<ViolationMessage> violationMessages, File inputFile) throws IOException {
                        for (ViolationMessage msg : violationMessages) {
                            Map<String, Object> violation = new HashMap<>();
                            Map<String, Object> location = new HashMap<>();
                Severity: Minor
                Found in src/main/java/com/sleekbyte/tailor/format/CCFormatter.java - About 1 hr to fix

                  Method testExceptOption has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      @Test
                      public void testExceptOption() throws IOException {
                          // Add expected output
                          addExpectedMsg(8, 33,
                              Rules.TERMINATING_SEMICOLON,

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

                        @Override
                        public void analyze() {
                            Stack<Integer> ignoreBlockBeginStack = new Stack<>();
                            Token lastSuppressViolationComment = null;
                    
                    
                    Severity: Minor
                    Found in src/main/java/com/sleekbyte/tailor/output/ViolationSuppressor.java - 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 createListeners has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private List<SwiftBaseListener> createListeners(Set<Rules> enabledRules,
                                                                        Printer printer,
                                                                        CommonTokenStream tokenStream,
                                                                        ConstructLengths constructLengths,
                                                                        CommentExtractor commentExtractor)
                    Severity: Minor
                    Found in src/main/java/com/sleekbyte/tailor/Tailor.java - 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 enterFunctionCallExpression has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

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

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

                          private List<Object> expectedOutput(List<ViolationMessage> list) throws IOException {
                              Map<String, Object> output = new HashMap<>();
                              output.put(Messages.PATH_KEY, inputFile.getCanonicalPath());
                              output.put(Messages.PARSED_KEY, true);
                      
                      
                      Severity: Minor
                      Found in src/test/java/com/sleekbyte/tailor/format/HTMLFormatterTest.java - About 1 hr to fix

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

                            private List<SwiftBaseListener> createListeners(Set<Rules> enabledRules,
                                                                            Printer printer,
                                                                            CommonTokenStream tokenStream,
                                                                            ConstructLengths constructLengths,
                                                                            CommentExtractor commentExtractor)
                        Severity: Minor
                        Found in src/main/java/com/sleekbyte/tailor/Tailor.java - About 1 hr to fix

                          Method testHTMLFormat has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              @Test
                              public void testHTMLFormat() throws IOException {
                                  Format format = Format.HTML;
                          
                                  final String[] command = new String[] {
                          Severity: Minor
                          Found in src/test/java/com/sleekbyte/tailor/functional/FormatTest.java - About 1 hr to fix

                            Method analyzeFile has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

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

                              Method verify has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public void verify() throws IOException {
                                      int lineLength;
                                      int lineNumber;
                                      for (String line = this.reader.readLine(); line != null; line = this.reader.readLine()) {
                                          lineLength = line.length();
                              Severity: Minor
                              Found in src/main/java/com/sleekbyte/tailor/listeners/FileListener.java - 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 formattedColumnNumber has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  private String formattedColumnNumber() {
                                      String res;
                                      if (columnNumber == 0) {
                                          if (columnNumberWidth > 0 && colorSettings.colorOutput) {
                                              res = String.format("%" + (columnNumberWidth + 1) + "s", "");
                              Severity: Minor
                              Found in src/main/java/com/sleekbyte/tailor/output/ViolationMessage.java - 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 addAllExpectedMsgs has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  @Override
                                  protected void addAllExpectedMsgs() {
                                      addExpectedNameMsg(1, 7, Messages.CLASS + Messages.NAME, 23, 5);
                                      addExpectedNameMsg(4, 5, Messages.CONSTANT + Messages.NAME, 22, 5);
                                      addExpectedLineMsg(4, 41, Messages.LINE, 75, 40);
                                Severity
                                Category
                                Status
                                Source
                                Language