chdemko/pandoc-numbering

View on GitHub

Showing 6 of 6 total issues

File _main.py has 1348 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python

# pylint: disable=too-many-lines

"""Pandoc filter to number all kinds of things."""
Severity: Major
Found in pandoc_numbering/_main.py - About 3 days to fix

    Numbered has 33 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Numbered:
        """
        Numbered elements.
        """
    
    
    Severity: Minor
    Found in pandoc_numbering/_main.py - About 4 hrs to fix

      Function _compute_data has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def _compute_data(self):
              # pylint: disable=too-many-statements,no-member
              classes = self._doc.defined[self._basic_category]["classes"]
              if self._alias == self._tag:
                  self._set_content(
      Severity: Minor
      Found in pandoc_numbering/_main.py - About 1 hr to fix

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

            def _compute_data(self):
                # pylint: disable=too-many-statements,no-member
                classes = self._doc.defined[self._basic_category]["classes"]
                if self._alias == self._tag:
                    self._set_content(
        Severity: Minor
        Found in pandoc_numbering/_main.py - 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 _compute_alias has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def _compute_alias(self):
                # Determine the final alias
                if not self._title:
                    if self._section_alias:
                        self._alias = (
        Severity: Minor
        Found in pandoc_numbering/_main.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 _compute_title has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def _compute_title(self):
                self._title = []
                if (
                    isinstance(self._get_content()[-3], Str)
                    and self._get_content()[-3].text[-1:] == ")"
        Severity: Minor
        Found in pandoc_numbering/_main.py - 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

        Severity
        Category
        Status
        Source
        Language