Homebrew/homebrew

View on GitHub

Showing 286 issues of 294 total

Class Formula has 182 methods (exceeds 20 allowed). Consider refactoring.
Open

class Formula
  include FileUtils
  include Utils::Inreplace
  extend Enumerable

Severity: Major
Found in Library/Homebrew/formula.rb - About 3 days to fix

    File diagnostic.rb has 1109 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require "keg"
    require "language/python"
    require "formula"
    require "version"
    
    
    Severity: Major
    Found in Library/Homebrew/diagnostic.rb - About 2 days to fix

      File formula.rb has 994 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require "formula_support"
      require "formula_lock"
      require "formula_pin"
      require "hardware"
      require "bottles"
      Severity: Major
      Found in Library/Homebrew/formula.rb - About 2 days to fix

        File download_strategy.rb has 689 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require "utils/json"
        
        class AbstractDownloadStrategy
          include FileUtils
        
        
        Severity: Major
        Found in Library/Homebrew/download_strategy.rb - About 1 day to fix

          Class Checks has 83 methods (exceeds 20 allowed). Consider refactoring.
          Open

              class Checks
                ############# HELPERS
                # Finds files in HOMEBREW_PREFIX *and* /usr/local.
                # Specify paths relative to a prefix eg. "include/foo.h".
                # Sets @found for your convenience.
          Severity: Major
          Found in Library/Homebrew/diagnostic.rb - About 1 day to fix

            File formula_installer.rb has 651 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            require "cxxstdlib"
            require "exceptions"
            require "formula"
            require "keg"
            require "tab"
            Severity: Major
            Found in Library/Homebrew/formula_installer.rb - About 1 day to fix

              File utils.rb has 601 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require "pathname"
              require "exceptions"
              require "utils/json"
              require "utils/inreplace"
              require "utils/popen"
              Severity: Major
              Found in Library/Homebrew/utils.rb - About 1 day to fix

                Method cleanup_cache has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
                Open

                    def self.cleanup_cache
                      return unless HOMEBREW_CACHE.directory?
                      HOMEBREW_CACHE.children.each do |path|
                        if path.to_s.end_with? ".incomplete"
                          cleanup_path(path) { path.unlink }
                Severity: Minor
                Found in Library/Homebrew/cleanup.rb - About 7 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

                Method link_dir has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
                Open

                  def link_dir(relative_dir, mode)
                    root = path+relative_dir
                    return unless root.exist?
                    root.find do |src|
                      next if src == root
                Severity: Minor
                Found in Library/Homebrew/keg.rb - About 7 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

                Method _parse has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
                Open

                  def self._parse(spec)
                    spec = Pathname.new(spec) unless spec.is_a? Pathname
                
                    spec_s = spec.to_s
                
                
                Severity: Minor
                Found in Library/Homebrew/version.rb - About 6 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

                Method report has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
                Open

                  def report
                    return @report if @report
                
                    @report = Hash.new { |h, k| h[k] = [] }
                    return @report unless updated?
                Severity: Minor
                Found in Library/Homebrew/cmd/update-report.rb - About 6 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

                Class FormulaInstaller has 45 methods (exceeds 20 allowed). Consider refactoring.
                Open

                class FormulaInstaller
                  include FormulaCellarChecks
                
                  def self.mode_attr_accessor(*names)
                    attr_accessor(*names)
                Severity: Minor
                Found in Library/Homebrew/formula_installer.rb - About 6 hrs to fix

                  File pathname.rb has 421 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  require "pathname"
                  require "resource"
                  require "metafiles"
                  require "utils"
                  
                  
                  Severity: Minor
                  Found in Library/Homebrew/extend/pathname.rb - About 6 hrs to fix

                    File keg.rb has 414 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    require "extend/pathname"
                    require "keg_relocate"
                    require "formula_lock"
                    require "ostruct"
                    
                    
                    Severity: Minor
                    Found in Library/Homebrew/keg.rb - About 5 hrs to fix

                      Method plist_caveats has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def plist_caveats
                          s = []
                          if f.plist || (keg && keg.plist_installed?)
                            destination = if f.plist_startup
                              "/Library/LaunchDaemons"
                      Severity: Minor
                      Found in Library/Homebrew/caveats.rb - About 5 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

                      Class Tap has 43 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                      class Tap
                        TAP_DIRECTORY = HOMEBREW_LIBRARY/"Taps"
                      
                        CACHE = {}
                      
                      
                      Severity: Minor
                      Found in Library/Homebrew/tap.rb - About 5 hrs to fix

                        Method install has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def install
                            # not in initialize so upgrade can unlink the active keg before calling this
                            # function but after instantiating this class so that it can avoid having to
                            # relink the active keg if possible (because it is slow).
                            if formula.linked_keg.directory?
                        Severity: Minor
                        Found in Library/Homebrew/formula_installer.rb - About 5 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

                        Method safe_fork has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def self.safe_fork(&_block)
                            Dir.mktmpdir("homebrew", HOMEBREW_TEMP) do |tmpdir|
                              UNIXServer.open("#{tmpdir}/socket") do |server|
                                read, write = IO.pipe
                        
                        
                        Severity: Minor
                        Found in Library/Homebrew/utils/fork.rb - About 5 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

                        Class Keg has 40 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                        class Keg
                          class AlreadyLinkedError < RuntimeError
                            def initialize(keg)
                              super <<-EOS.undent
                                Cannot link #{keg.name}
                        Severity: Minor
                        Found in Library/Homebrew/keg.rb - About 5 hrs to fix

                          File tap.rb has 383 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          require "extend/string"
                          
                          # a {Tap} is used to extend the formulae provided by Homebrew core.
                          # Usually, it's synced with a remote git repository. And it's likely
                          # a Github repository with the name of `user/homebrew-repo`. In such
                          Severity: Minor
                          Found in Library/Homebrew/tap.rb - About 5 hrs to fix
                            Severity
                            Category
                            Status