andrew/brewdler

View on GitHub

Showing 8 of 8 total issues

Method run has 75 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def run
        # Keep this inside `run` to keep --help fast.
        require_relative "../lib/bundle"

        case subcommand = args.named.first.presence
Severity: Major
Found in cmd/bundle.rb - About 3 hrs to fix

    Method skip? has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

          def skip?(entry, silent: false)
            if (Hardware::CPU.arm? || OS.linux?) &&
               Homebrew.default_prefix? &&
               entry.type == :brew && entry.name.exclude?("/") &&
               (formula = BrewDumper.formulae_by_full_name(entry.name)) &&
    Severity: Minor
    Found in lib/bundle/skipper.rb - About 2 hrs 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

    Consider simplifying this complex logical expression.
    Open

            if (Hardware::CPU.arm? || OS.linux?) &&
               Homebrew.default_prefix? &&
               entry.type == :brew && entry.name.exclude?("/") &&
               (formula = BrewDumper.formulae_by_full_name(entry.name)) &&
               formula[:official_tap] &&
    Severity: Critical
    Found in lib/bundle/skipper.rb - About 1 hr to fix

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

          def formula_dependencies(cask_list)
            return [] unless Bundle.cask_installed?
            return [] if cask_list.blank?
      
            casks.flat_map do |cask|
      Severity: Minor
      Found in lib/bundle/cask_dumper.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 skip? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def skip?(entry, silent: false)
              if macos_only_entry?(entry) || macos_only_tap?(entry)
                puts Formatter.warning "Skipping #{entry.type} #{entry.name} (on Linux)" unless silent
                true
              else
      Severity: Minor
      Found in lib/bundle/extend/os/linux/skipper.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 dump has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def dump(describe: false)
            casks.map do |cask|
              description = "# #{cask.desc}\n" if describe && cask.desc.present?
              config = ", args: { #{cask.config.explicit_s} }" if cask.config.present? && cask.config.explicit.present?
              "#{description}cask \"#{cask}\"#{config}"
      Severity: Minor
      Found in lib/bundle/cask_dumper.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 dump has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def dump
            taps.map do |tap|
              remote = if tap.custom_remote? && (tap_remote = tap.remote)
                if (api_token = ENV.fetch("HOMEBREW_GITHUB_API_TOKEN", false).presence)
                  # Replace the API token in the remote URL with interpolation.
      Severity: Minor
      Found in lib/bundle/tap_dumper.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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def run
              # Keep this inside `run` to keep --help fast.
              require_relative "../lib/bundle"
      
              case subcommand = args.named.first.presence
      Severity: Minor
      Found in cmd/bundle.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