kytrinyx/approvals

View on GitHub

Showing 5 of 5 total issues

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

      def verify(options = {}, &block)
        # Workaround to support both Rspec 2 and 3
        # RSpec.current_example is the Rspec 3 way
        fetch_current_example = ::RSpec.respond_to?(:current_example) ? proc { ::RSpec.current_example } : proc { |context| context.example }
        # /Workaround
Severity: Minor
Found in lib/approvals/extensions/rspec/dsl.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 censored has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def censored value, key=nil
      if value.nil?
        nil
      elsif key && placeholder_for(key)
        "<#{placeholder_for(key)}>"
Severity: Minor
Found in lib/approvals/filter.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 verify has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def verify
      approvals = File.read('.approvals').split("\n")

      rejected = []
      approvals.each do |approval|
Severity: Minor
Found in lib/approvals/cli.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 directorize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def directorize(example)
        approvals_path = lambda do |metadata|
          description = normalize metadata[:description]
          example_group = if metadata.key?(:example_group)
                            metadata[:example_group]
Severity: Minor
Found in lib/approvals/namers/directory_namer.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 verify has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def verify
      unless File.exist?(namer.output_dir)
        FileUtils.mkdir_p(namer.output_dir)
      end

Severity: Minor
Found in lib/approvals/approval.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