wearefine/maximus

View on GitHub

Showing 28 of 28 total issues

Identical blocks of code found in 2 locations. Consider refactoring.
Open

function debounced_render() {
  clearTimeout(last_request_timeout);
  clearTimeout(final_timeout);

  // If there's no more ongoing resource requests, wait for 1 second before
Severity: Major
Found in lib/maximus/config/wraith/snap.js and 1 other location - About 6 hrs to fix
lib/maximus/config/wraith/nojs.js on lines 65..87

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 174.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

function debounced_render() {
  clearTimeout(last_request_timeout);
  clearTimeout(final_timeout);

  // If there's no more ongoing resource requests, wait for 1 second before
Severity: Major
Found in lib/maximus/config/wraith/nojs.js and 1 other location - About 6 hrs to fix
lib/maximus/config/wraith/snap.js on lines 65..87

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 174.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

      page.open(url, function(status) {
        if (status !== 'success') {
          console.log('Error with page ' + url);
          phantom.exit();
        }
      Severity: Minor
      Found in lib/maximus/config/wraith/nojs.js and 1 other location - About 55 mins to fix
      lib/maximus/config/wraith/snap.js on lines 57..62

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 54.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

      page.open(url, function(status) {
        if (status !== 'success') {
          console.log('Error with page ' + url);
          phantom.exit();
        }
      Severity: Minor
      Found in lib/maximus/config/wraith/snap.js and 1 other location - About 55 mins to fix
      lib/maximus/config/wraith/nojs.js on lines 57..62

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 54.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      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

      Severity
      Category
      Status
      Source
      Language