File parser.py
has 351 lines of code (exceeds 250 allowed). Consider refactoring. Wontfix
import functools
import re
import typing as T
from collections import abc
- Create a ticketCreate a ticket
Function word_count_bouncer
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Wontfix
def word_count_bouncer(minimum: int) -> T.Callable[[T.Any], T.Any]:
"""
Decorate only class/instance methods, enforce word count on first real arg.
If there are too few (less than minimum) words, return the arguments.
- Read upRead up
- Create a ticketCreate a ticket
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 too many return
statements within this function. Wontfix
return self._remove_from_clusters(clusters, "junior")
- Create a ticketCreate a ticket
Function _combine_rightmost_prefixes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Wontfix
def _combine_rightmost_prefixes(cls, cluster: Cluster) -> Cluster:
"""Work right-to-left through cluster, joining up prefixes of rightmost"""
result: Clusters = []
for word in reversed(cluster):
- Read upRead up
- Create a ticketCreate a ticket
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 _grab_junior
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Wontfix
def _grab_junior(self, clusters: Clusters) -> Clusters:
"""
Extract "junior" as suffix unless
- there is already a generational suffix
- junior is the first word of the only cluster (e.g. 'junior x. smith')
- Read upRead up
- Create a ticketCreate a ticket
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"