bf4/metric_fu

View on GitHub

Showing 28 of 48 total issues

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

  def self.configure
    MetricFu.lib_require { 'core_ext' }
    MetricFu.lib_require { 'configuration' }
    init_files = Dir.glob(File.join(MetricFu.metrics_dir, '**/init.rb')).reject do |file|
      if file =~ /rcov/o
Severity: Minor
Found in lib/metric_fu.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 emit has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def emit
      options_string = MetricFu.saikuro.inject("") do |options, option|
        option[0] == :input_directory ? options : options + "--#{option.join(' ')} "
      end

Severity: Minor
Found in lib/metric_fu/metrics/saikuro/saikuro.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 per_file_info has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def per_file_info(out)
      @rails_best_practices_results[:problems].each do |problem|
        next if problem[:file] == '' || problem[:problem].nil?

        out[problem[:file]] ||= {}
Severity: Minor
Found in lib/metric_fu/metrics/rails_best_practices/rails_best_practices.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 singularize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def singularize(word)
      result = word.to_s.dup

      if inflections.uncountables.any? { |inflection| result =~ /\b(#{inflection})\Z/i }
        result
Severity: Minor
Found in lib/metric_fu/core_ext/inflector/inflections.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 per_file_info has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def per_file_info(out)
      @method_containers.each_pair do |klass, container|
        container.methods.each_pair do |method_name, data|
          next if data[:path].nil?

Severity: Minor
Found in lib/metric_fu/metrics/flog/flog.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 lib_require has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.lib_require(base='',&block)
    paths = []
    base_path = File.join(LIB_ROOT, base)
    Array((yield paths, base_path)).each do |path|
      file = File.join(base_path, *Array(path))
Severity: Minor
Found in lib/metric_fu.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 fix_row_file_path! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def fix_row_file_path!(row)
      # We know that Saikuro rows are broken
      # next unless row['metric'] == :saikuro
      key = [row['class_name'], row['method_name']]
      current_file_path = row['file_path'].to_s
Severity: Minor
Found in lib/metric_fu/metrics/hotspots/analysis/analyzer_tables.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 massage_for_reek_12 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def massage_for_reek_12
      section_break = ''
      @output.split("\n").map do |line|
        case line
        when /^  /
Severity: Minor
Found in lib/metric_fu/metrics/reek/reek.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