Function key_use
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def key_use(self, folder: Path, name: str) -> List[str]:
"""Parse all the files in the folder and check if keys are all used at least once.
Return the unused key names.
- 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 sanitize
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def sanitize(cls, d: Union[dict, list]) -> dict:
"""Identify numbered dictionaries embedded in the dict and transform them into lists.
This function is an helper to prevent deprecation after the introduction of pontoon for translation.
The user is now force to use keys even for numbered lists. SimpleNamespace doesn't support integer indexing
- 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 find_target
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def find_target(folder: Path, target: str = "") -> Tuple[str, str]:
"""find the target language in the available language folder.
given a folder and a target lang, this function returns the closest language available in the folder
If nothing is found falling back to any working subvariety and return None if it doesn't exist
- 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"