jaredbeck/minitest_to_rspec

View on GitHub

Showing 6 of 6 total issues

Class Call has 39 methods (exceeds 20 allowed). Consider refactoring.
Open

      class Call < Base
        # Mocha methods will only be processed if `--mocha` flag was given,
        # i.e. `mocha` argument in constructor is true.
        MOCHA_METHODS = %i[
          expects
Severity: Minor
Found in lib/minitest_to_rspec/input/subprocessors/call.rb - About 5 hrs to fix

    Class Call has 30 methods (exceeds 20 allowed). Consider refactoring.
    Open

          class Call < Base
            attr_reader :original
    
            def initialize(exp)
              assert_sexp_type(:call, exp)
    Severity: Minor
    Found in lib/minitest_to_rspec/input/model/call.rb - About 3 hrs to fix

      Class Iter has 22 methods (exceeds 20 allowed). Consider refactoring.
      Open

            class Iter < Base
              def initialize(sexp, rails, mocha)
                super(rails, mocha)
                @exp = Model::Iter.new(sexp)
                sexp.clear
      Severity: Minor
      Found in lib/minitest_to_rspec/input/subprocessors/iter.rb - About 2 hrs to fix

        Method initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

              def initialize(receiver, any_instance, message, with, returns, count)
        Severity: Minor
        Found in lib/minitest_to_rspec/rspec/stub.rb - About 45 mins to fix

          Method expect has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  def expect(target, eager, phase, matcher, any_instance)
          Severity: Minor
          Found in lib/minitest_to_rspec/input/subprocessors/base.rb - About 35 mins to fix

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

                  def to_rspec_exp
                    stub_chain = s(:call, nil, :receive, @message)
                    unless @with.nil?
                      stub_chain = s(:call, stub_chain, :with, @with)
                    end
            Severity: Minor
            Found in lib/minitest_to_rspec/rspec/stub.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