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:
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
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:
- Read upRead up
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)
- Read upRead up
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())
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
- Read upRead up
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"