fossasia/meilix-generator

View on GitHub

Showing 6 of 11 total issues

Function index has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

def index():
    if request.method == 'POST':
        email = request.form['email']
        TRAVIS_TAG = request.form['TRAVIS_TAG']
        event_url = request.form['event_url']
Severity: Minor
Found in app.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

Function upload_wallpaper has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def upload_wallpaper(wallpaper):
    url=""
    if wallpaper:
        if allowed_file(wallpaper.filename, ALLOWED_EXTENSIONS_WALLPAPERS):
            filename = secure_filename(wallpaper.filename)
Severity: Minor
Found in app.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 upload_logo has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def upload_logo(logo):
    url=""
    if logo:
        if allowed_file(logo.filename, ALLOWED_EXTENSIONS_LOGO):
            filename = secure_filename(logo.filename)
Severity: Minor
Found in app.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 send_trigger_request has 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

def send_trigger_request(email, TRAVIS_TAG, event_url, TRAVIS_SCRIPT, recipe, processor, feature, wallpaper_url, logo_url, theme):
Severity: Major
Found in build.py - About 1 hr to fix

    Function send_trigger_request has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def send_trigger_request(email, TRAVIS_TAG, event_url, TRAVIS_SCRIPT, recipe, processor, feature, wallpaper_url, logo_url, theme):
        # Params for Travis API
        USER = os.environ.get('USER','fossasia')
        PROJECT = os.environ.get('PROJECT', 'meilix')
        BRANCH = os.environ.get('BRANCH', 'master')
    Severity: Minor
    Found in build.py - About 1 hr to fix

      Function output has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def output():
          if flag:
              if os.environ['TRAVIS_TAG']:  # if TRAVIS_TAG have value it will proceed
                  trigger_code = build.send_trigger_request(os.environ['email'], os.environ['TRAVIS_TAG'], os.environ['event_url'],os.environ['TRAVIS_SCRIPT'], os.environ['recipe'], os.environ['processor'], os.environ['feature'], os.environ['wallpaper_url'], os.environ["logo_url"], os.environ['theme'])
                  if trigger_code != 202:
      Severity: Minor
      Found in app.py - About 45 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

      Severity
      Category
      Status
      Source
      Language