bwillis/versioncake

View on GitHub

Showing 7 of 7 total issues

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

    def self.lookup(strategy)
      case strategy
        when String, Symbol
          strategy_name = "#{strategy}_strategy".camelize
          begin
Severity: Minor
Found in lib/versioncake/strategies/extraction_strategy.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 get_format_from_pieces has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def get_format_from_pieces(pieces, format_list)
    format = nil
    pieces.reverse.each do |piece|
      if ActionView::PathResolver::EXTENSIONS.is_a?(Hash) &&
          ActionView::PathResolver::EXTENSIONS.include?(:variants)
Severity: Minor
Found in lib/versioncake/view_additions_rails6.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 migrate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def migrate(path)
      path = RAILS_VIEW_PATH unless path
      raise ArgumentError.new("No directory exists for '#{path}'") unless File.exist? path

      files_to_rename = []
Severity: Minor
Found in lib/versioncake/cli.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 execute has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def execute
      @result = if @version.nil?
        :no_version
      elsif !@version.is_a? Integer
        :invalid_format
Severity: Minor
Found in lib/versioncake/version_checker.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 initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def initialize(locale, handler, format, variant, version)
Severity: Minor
Found in lib/versioncake/view_additions_rails7.rb - About 35 mins to fix

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

        def v1_to_v2_filename(path)
          filename = File.basename(path)
          if m = filename.match(/(\.v[0-9]+)/)
            version_str = m[0]
            new_path = path.sub version_str, ''
    Severity: Minor
    Found in lib/versioncake/cli.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def initialize(source, identifier, handler, locals:, format: nil, variant: nil, virtual_path: nil, version: nil)
        @source            = source
        @identifier        = identifier
        @handler           = handler
        @compiled          = false
    Severity: Minor
    Found in lib/versioncake/view_additions_rails7.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