GreyRook/gown.js

View on GitHub
themes/from_feathers/get_themes.py

Summary

Maintainability
B
4 hrs
Test Coverage

Function main has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

def main():
    parser = argparse.ArgumentParser(
        description='Convert theme from feathers for gown.js.')
    parser.add_argument('feathers_path', type=str,
                        help='path to feathers directory')
Severity: Minor
Found in themes/from_feathers/get_themes.py - About 2 hrs 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

Avoid deeply nested control flow statements.
Open

                    if (isinstance(value, dict)):
                        data.setdefault(key, value)
                        data[key].update(user_data[key])
                    else:
                        data[key] = value
Severity: Major
Found in themes/from_feathers/get_themes.py - About 45 mins to fix

    Function get_feathers_themes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_feathers_themes(feathers_themes_path):
        theme_data = {}
        themes = os.listdir(feathers_themes_path)
    
        # find Base<name>.as-Files to extract scale_9_grid values
    Severity: Minor
    Found in themes/from_feathers/get_themes.py - About 35 mins 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