File replace.py
has 904 lines of code (exceeds 900 allowed). Consider refactoring. Open
#!/usr/bin/env python3
r"""
This bot will make direct text replacements.
It will retrieve information on which pages might need changes either from
Function apply_replacements
has a Cognitive Complexity of 17 (exceeds 10 allowed). Consider refactoring. Open
def apply_replacements(self, original_text, applied, page=None):
"""
Apply all replacements to the given text.
:rtype: str, set
- 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 __iter__
has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring. Open
def __iter__(self):
"""Iterator method."""
try:
for entry in self.parser:
if self.skipping:
- 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 isTitleExcepted
has a Cognitive Complexity of 13 (exceeds 10 allowed). Consider refactoring. Open
def isTitleExcepted(self, title, exceptions=None) -> bool:
"""Return True if one of the exceptions applies for the given title."""
if exceptions is None:
exceptions = self.exceptions
if 'title' in exceptions:
- 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 isTitleExcepted
has a Cognitive Complexity of 12 (exceeds 10 allowed). Consider refactoring. Open
def isTitleExcepted(self, title) -> bool:
"""Return True if one of the exceptions applies for the given title."""
if 'title' in self.exceptions:
for exc in self.exceptions['title']:
if exc.search(title):
- 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"