christabor/namebot

View on GitHub
namebot/nlp.py

Summary

Maintainability
B
5 hrs
Test Coverage

File nlp.py has 319 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Functions that use Natural Language Processing.

Word relationships found (via NLTK and other libraries)
to find and generate related words.
"""
Severity: Minor
Found in namebot/nlp.py - About 3 hrs to fix

    Function _get_lemma_names has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def _get_lemma_names(sub_synset, use_definitions=False):
        """Get lemma names."""
        results = []
        if sub_synset():
            for v in sub_synset():
    Severity: Minor
    Found in namebot/nlp.py - About 1 hr 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 get_synsets has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_synsets(words, use_definitions=False, clean=False):
        """Brute force loop on a synset ring to get all related words.
    
        You are expected to filter or remove any that are not relevant separately,
        if the resultant set is too long.
    Severity: Minor
    Found in namebot/nlp.py - About 1 hr 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

    There are no issues that match your filters.

    Category
    Status