neovim/neovim

View on GitHub

Showing 66 of 66 total issues

Function UpdatePreprocessor has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def UpdatePreprocessor(self, line):
        """Update preprocessor stack.

        We need to handle preprocessors due to classes like this:
          #ifdef SWIG
Severity: Minor
Found in src/clint.py - 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

Function ProcessFileData has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

def ProcessFileData(filename, file_extension, lines, error,
                    extra_check_functions=[]):
    """Performs lint checks and reports any errors to the given error function.

    Args:
Severity: Minor
Found in src/clint.py - 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

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

  const issue = await github.rest.issues.get({
    owner: context.repo.owner,
    repo: context.repo.repo,
    issue_number: context.issue.number,
  });
Severity: Major
Found in .github/scripts/remove_response_label.js and 2 other locations - About 1 hr to fix
.github/scripts/reviewers_add.js on lines 2..6
.github/scripts/reviewers_remove.js on lines 2..6

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

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

  const requestedReviewers = await github.rest.pulls.listRequestedReviewers({
    owner: context.repo.owner,
    repo: context.repo.repo,
    pull_number: context.issue.number,
  });
Severity: Major
Found in .github/scripts/reviewers_remove.js and 2 other locations - About 1 hr to fix
.github/scripts/remove_response_label.js on lines 3..7
.github/scripts/reviewers_add.js on lines 2..6

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

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

  const pr_data = await github.rest.pulls.get({
    owner: context.repo.owner,
    repo: context.repo.repo,
    pull_number: context.issue.number,
  });
Severity: Major
Found in .github/scripts/reviewers_add.js and 2 other locations - About 1 hr to fix
.github/scripts/remove_response_label.js on lines 3..7
.github/scripts/reviewers_remove.js on lines 2..6

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

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

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

def ParseNolintSuppressions(raw_line, linenum):
    """Updates the global list of error-suppressions.

    Parses any NOLINT comments on the current line, updating the global
    error_suppressions store.  Reports an error if the NOLINT comment
Severity: Minor
Found in src/clint.py - 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

Function ProcessFile has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def ProcessFile(filename, vlevel, extra_check_functions=[]):
    """Does neovim-lint on a single file.

    Args:
      filename: The name of the file to parse.
Severity: Minor
Found in src/clint.py - 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

Function CheckComment has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def CheckComment(comment, filename, linenum, error):
    """Checks for common mistakes in TODO comments.

    Args:
      comment: The text of the comment from the line in question.
Severity: Minor
Found in src/clint.py - 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

Consider simplifying this complex logical expression.
Open

            if commentend < len(line) and not line[commentend] == ' ':
                # but some lines are exceptions -- e.g. if they're big
                # comment delimiters like:
                # //----------------------------------------------------------
                # or are an empty C++ style Doxygen comment, like:
Severity: Major
Found in src/clint.py - About 1 hr to fix

    Avoid deeply nested control flow statements.
    Open

                        if not nesting_stack:
                            # Found matching angle bracket
                            return True
                    elif operator == ',':
    Severity: Major
    Found in src/clint.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if not nesting_stack:
                              # Found matching angle bracket
                              return True
                      elif operator == ',':
      Severity: Major
      Found in src/clint.py - About 45 mins to fix

        Function ProcessLine has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def ProcessLine(filename, clean_lines, line,
        Severity: Minor
        Found in src/clint.py - About 45 mins to fix

          Function _GetTextInside has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          def _GetTextInside(text, start_pattern):
              r"""Retrieves all the text between matching open and close parentheses.
          
              Given a string of lines and a regular expression string, retrieve all the
              text following the expression and between opening punctuation symbols like
          Severity: Minor
          Found in src/clint.py - 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

          Function get_color_code has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          def get_color_code(bg, color_num):
              if color_num < 16:
                  prefix = 3
                  if color_num > 7:
                      prefix = 9
          Severity: Minor
          Found in contrib/gdb/nvim-gdb-pretty-printers.py - 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

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

            if (labels.includes("ci")) {
              reviewers.add("dundargoc");
              reviewers.add("jamessan");
              reviewers.add("justinmk");
            }
          Severity: Major
          Found in .github/scripts/reviewers_add.js and 4 other locations - About 40 mins to fix
          .github/scripts/reviewers_add.js on lines 10..14
          .github/scripts/reviewers_add.js on lines 54..58
          .github/scripts/reviewers_add.js on lines 60..64
          .github/scripts/reviewers_add.js on lines 87..91

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

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

            if (labels.includes("filetype")) {
              reviewers.add("clason");
              reviewers.add("gpanders");
              reviewers.add("smjonas");
            }
          Severity: Major
          Found in .github/scripts/reviewers_add.js and 4 other locations - About 40 mins to fix
          .github/scripts/reviewers_add.js on lines 10..14
          .github/scripts/reviewers_add.js on lines 16..20
          .github/scripts/reviewers_add.js on lines 60..64
          .github/scripts/reviewers_add.js on lines 87..91

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

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

            if (labels.includes("lsp")) {
              reviewers.add("folke");
              reviewers.add("MariaSolOs");
              reviewers.add("mfussenegger");
            }
          Severity: Major
          Found in .github/scripts/reviewers_add.js and 4 other locations - About 40 mins to fix
          .github/scripts/reviewers_add.js on lines 10..14
          .github/scripts/reviewers_add.js on lines 16..20
          .github/scripts/reviewers_add.js on lines 54..58
          .github/scripts/reviewers_add.js on lines 87..91

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

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

            if (labels.includes("build")) {
              reviewers.add("dundargoc");
              reviewers.add("jamessan");
              reviewers.add("justinmk");
            }
          Severity: Major
          Found in .github/scripts/reviewers_add.js and 4 other locations - About 40 mins to fix
          .github/scripts/reviewers_add.js on lines 16..20
          .github/scripts/reviewers_add.js on lines 54..58
          .github/scripts/reviewers_add.js on lines 60..64
          .github/scripts/reviewers_add.js on lines 87..91

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

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

            if (labels.includes("treesitter")) {
              reviewers.add("bfredl");
              reviewers.add("clason");
              reviewers.add("lewis6991");
            }
          Severity: Major
          Found in .github/scripts/reviewers_add.js and 4 other locations - About 40 mins to fix
          .github/scripts/reviewers_add.js on lines 10..14
          .github/scripts/reviewers_add.js on lines 16..20
          .github/scripts/reviewers_add.js on lines 54..58
          .github/scripts/reviewers_add.js on lines 60..64

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

          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

          Function Error has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def Error(filename, linenum, category, confidence, message):
          Severity: Minor
          Found in src/clint.py - About 35 mins to fix
            Severity
            Category
            Status
            Source
            Language