tsutsu3/linkify-it-py

View on GitHub

Showing 6 of 25 total issues

File tlds.py has 1515 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""TLDS

Version 2020110600, Last Updated Fri Nov  6 07:07:02 2020 UTC

References:
Severity: Major
Found in linkify_it/tlds.py - About 4 days to fix

    File main.py has 457 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import copy
    import re
    import types
    
    from .ucre import build_re
    Severity: Minor
    Found in linkify_it/main.py - About 7 hrs to fix

      Function test has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
      Open

          def test(self, text):
              """Searches linkifiable pattern and returns ``True`` on success or ``False``
              on fail.
      
              Args:
      Severity: Minor
      Found in linkify_it/main.py - About 6 hrs 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 _compile has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

          def _compile(self):
              """Schemas compiler. Build regexps."""
      
              # Load & clone RE patterns.
              self.re = build_re(self._opts)
      Severity: Minor
      Found in linkify_it/main.py - About 3 hrs 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

      Avoid deeply nested control flow statements.
      Open

                              if self._index < 0 or shift < self._index:
                                  self._schema = ""
                                  self._index = shift
                                  self._last_index = ml.start(0) + len(ml.group())
      
      
      Severity: Major
      Found in linkify_it/main.py - About 45 mins to fix

        Function _validate_double_slash has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def _validate_double_slash(self, text, pos):
                tail = text[pos:]
        
                if not self.re.get("not_http"):
                    # compile lazily, because "host"-containing variables can change on
        Severity: Minor
        Found in linkify_it/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