18F/federalist-garden-build

View on GitHub
src/steps/build.py

Summary

Maintainability
A
1 hr
Test Coverage
A
94%

File build.py has 352 lines of code (exceeds 250 allowed). Consider refactoring.
Wontfix

import json
import os
import shutil
from os import path
from pathlib import Path
Severity: Minor
Found in src/steps/build.py - About 4 hrs to fix

    Function setup_node has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def setup_node(should_cache: bool, bucket, s3_client):
        '''
        Sets up node and installs dependencies.
    
        Uses the node version specified in the cloned repo's .nvmrc
    Severity: Minor
    Found in src/steps/build.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 download_hugo has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Wontfix

    def download_hugo():
        logger = get_logger('download-hugo')
    
        HUGO_VERSION_PATH = CLONE_DIR_PATH / HUGO_VERSION
        if HUGO_VERSION_PATH.is_file():
    Severity: Minor
    Found in src/steps/build.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 setup_bundler has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Wontfix

    def setup_bundler(should_cache: bool, bucket, s3_client):
        logger = get_logger('setup-bundler')
    
        def runp(cmd):
            return run(logger, cmd, cwd=CLONE_DIR_PATH, env={}, ruby=True)
    Severity: Minor
    Found in src/steps/build.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 build_jekyll has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Wontfix

    def build_jekyll(branch, owner, repository, site_prefix,
    Severity: Major
    Found in src/steps/build.py - About 50 mins to fix

      Function build_env has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Wontfix

      def build_env(branch, owner, repository, site_prefix, base_url,
      Severity: Minor
      Found in src/steps/build.py - About 45 mins to fix

        Function run_build_script has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Wontfix

        def run_build_script(branch, owner, repository, site_prefix,
        Severity: Minor
        Found in src/steps/build.py - About 45 mins to fix

          Function build_hugo has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Wontfix

          def build_hugo(branch, owner, repository, site_prefix,
          Severity: Minor
          Found in src/steps/build.py - About 45 mins to fix

            There are no issues that match your filters.

            Category
            Status