Merge pull request #11958 from Homebrew/remove_if_os_rubocop
rubocops/lines: remove OS.mac?/OS.linux? check.
This commit is contained in:
		
						commit
						034d4ac82b
					
				@ -372,14 +372,6 @@ module RuboCop
 | 
				
			|||||||
            end
 | 
					            end
 | 
				
			||||||
          end
 | 
					          end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          [:mac?, :linux?].each do |method_name|
 | 
					 | 
				
			||||||
            next if formula_tap != "homebrew-core" || file_path&.include?("linuxbrew")
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            find_instance_method_call(body_node, "OS", method_name) do |check|
 | 
					 | 
				
			||||||
              problem "Don't use #{check.source}; homebrew/core only supports macOS"
 | 
					 | 
				
			||||||
            end
 | 
					 | 
				
			||||||
          end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          find_instance_call(body_node, "ARGV") do |_method_node|
 | 
					          find_instance_call(body_node, "ARGV") do |_method_node|
 | 
				
			||||||
            problem "Use build instead of ARGV to check options"
 | 
					            problem "Use build instead of ARGV to check options"
 | 
				
			||||||
          end
 | 
					          end
 | 
				
			||||||
 | 
				
			|||||||
@ -45,22 +45,6 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
 | 
				
			|||||||
      RUBY
 | 
					      RUBY
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it "reports an offense when `OS.linux?` is used in homebrew/core" do
 | 
					 | 
				
			||||||
      expect_offense(<<~RUBY, "/homebrew-core/")
 | 
					 | 
				
			||||||
        class Foo < Formula
 | 
					 | 
				
			||||||
          desc "foo"
 | 
					 | 
				
			||||||
          url 'https://brew.sh/foo-1.0.tgz'
 | 
					 | 
				
			||||||
          bottle do
 | 
					 | 
				
			||||||
            if OS.linux?
 | 
					 | 
				
			||||||
               ^^^^^^^^^ Don\'t use OS.linux?; homebrew/core only supports macOS
 | 
					 | 
				
			||||||
              nil
 | 
					 | 
				
			||||||
            end
 | 
					 | 
				
			||||||
            sha256 "fe0679b932dd43a87fd415b609a7fbac7a069d117642ae8ebaac46ae1fb9f0b3" => :sierra
 | 
					 | 
				
			||||||
          end
 | 
					 | 
				
			||||||
        end
 | 
					 | 
				
			||||||
      RUBY
 | 
					 | 
				
			||||||
    end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    it "reports an offense when a useless `fails_with :llvm` is used" do
 | 
					    it "reports an offense when a useless `fails_with :llvm` is used" do
 | 
				
			||||||
      expect_offense(<<~RUBY)
 | 
					      expect_offense(<<~RUBY)
 | 
				
			||||||
        class Foo < Formula
 | 
					        class Foo < Formula
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user