wearefine/maximus

View on GitHub

Showing 22 of 28 total issues

Method lints_and_stats has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def lints_and_stats(lint_by_path = false, git_shas = compare, nuclear = false)
      return false if git_shas.blank?

      base_branch = branch
      git_ouput = {}
Severity: Minor
Found in lib/maximus/git_control.rb - 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

Method path_exists? has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def path_exists?(path = @path)
      path = path.split(' ') if path.is_a?(String) && path.include?(' ')
      if path.is_a?(Array)
        path.each do |p|
          unless File.exist?(p)
Severity: Minor
Found in lib/maximus/helper.rb - 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

Method relevant_output has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def relevant_output(lint, files)
        all_files = {}
        files.each do |file|

          # sometimes data will be blank but this is good - it means no errors were raised in the lint
Severity: Minor
Found in lib/maximus/lint.rb - 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

Method result has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def result
      @task = 'brakeman'
      @path = discover_path

      return unless is_rails? && temp_config(@task) && path_exists?(@path)
Severity: Minor
Found in lib/maximus/lints/brakeman.rb - 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

Method evaluate_settings has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def evaluate_settings(settings_data = @settings)
      settings_data.each do |key, value|
        next if value.is_a?(FalseClass)
        value = {} if value.is_a?(TrueClass)

Severity: Minor
Found in lib/maximus/config.rb - About 1 hr to fix

    Method wraith_parse has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

          def wraith_parse(browser)
            Dir.glob("#{@config.working_dir}/maximus_wraith_#{browser}/**/*").select { |f| File.file? f }.each do |file|
              extension = File.extname(file)
              next unless extension == '.png' || extension == '.txt'
    
    
    Severity: Minor
    Found in lib/maximus/statistics/wraith.rb - 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

    Method match_associations has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

          def match_associations(commit_sha, files)
            new_lines = lines_added(commit_sha)
    
            files = files.split("\n").group_by { |f| f.split('.').pop }
    
    
    Severity: Minor
    Found in lib/maximus/git_control.rb - 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

    Method result has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def result
          @task = 'railsbp'
          @path = discover_path
    
          return unless is_rails? && temp_config(@task) && path_exists?(@path)
    Severity: Minor
    Found in lib/maximus/lints/railsbp.rb - 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

    Method result has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def result
    
          return if @settings[:stylestats].blank?
    
          node_module_exists('stylestats')
    Severity: Minor
    Found in lib/maximus/statistics/stylestats.rb - 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

    Method evaluate_for_wraith has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def evaluate_for_wraith(value)
            @settings[:wraith] = {}
    
            if value.include?('browser')
              value['browser'].each do |browser, browser_value|
    Severity: Minor
    Found in lib/maximus/config.rb - About 1 hr to fix

      Method evaluate_for_wraith has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def evaluate_for_wraith(value)
              @settings[:wraith] = {}
      
              if value.include?('browser')
                value['browser'].each do |browser, browser_value|
      Severity: Minor
      Found in lib/maximus/config.rb - About 55 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

      Method initialize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def initialize(opts = {})
      
            # Strips from command line
            opts = opts.delete_if { |k, v| v.nil? }
      
      
      Severity: Minor
      Found in lib/maximus/config.rb - About 55 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

      Method parse_data has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def parse_data(data)
              # Prevent abortive empty JSON.parse error
              data = '{}' if data.blank?
      
              return "Error from #{@task}: #{data}" if data.is_a?(String) && data.include?('No such')
      Severity: Minor
      Found in lib/maximus/lint.rb - 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

      Method evaluate_severities has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def evaluate_severities(data)
              @output[:lint_warnings] = []
              @output[:lint_errors] = []
              @output[:lint_conventions] = []
              @output[:lint_refactors] = []
      Severity: Minor
      Found in lib/maximus/lint.rb - 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

      Method result has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def result
      
            return if @settings[:phantomas].blank?
      
            node_module_exists('phantomjs', 'brew install')
      Severity: Minor
      Found in lib/maximus/statistics/phantomas.rb - 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

      Method evaluate_settings has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def evaluate_settings(settings_data = @settings)
            settings_data.each do |key, value|
              next if value.is_a?(FalseClass)
              value = {} if value.is_a?(TrueClass)
      
      
      Severity: Minor
      Found in lib/maximus/config.rb - 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

      Method lints_and_stats_switch has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

            def lints_and_stats_switch(ext, lint_opts)
              result = {
                lints: {},
                statistics: {}
              }
      Severity: Minor
      Found in lib/maximus/git_control.rb - 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

      Method load_config has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

            def load_config(value)
              return value unless value.is_a?(String)
      
              if value =~ /^http/
                begin open(value)
      Severity: Minor
      Found in lib/maximus/config.rb - 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

      Method compile_scss has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def compile_scss
              puts "\nCompiling assets for stylestats...".color(:blue)
              if is_rails?
      
                # Get rake tasks
      Severity: Minor
      Found in lib/maximus/statistics/stylestats.rb - About 25 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

      Method discover_path has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def discover_path(root = @config.working_dir, folder = '', extension = '')
            return @path unless @path.blank?
            if is_middleman?
              File.join(root, 'source', folder)
            elsif is_rails?
      Severity: Minor
      Found in lib/maximus/helper.rb - About 25 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