 da734a30c2
			
		
	
	
		da734a30c2
		
			
		
	
	
	
	
		
			
			- Fixing the test expected output was unbelievably tedious. - There's been debate about this setting being `false` but in https://github.com/Homebrew/brew/pull/15136#issuecomment-1500063225 we decided that it was worth using the default since RuboCop behaviour changed so we'd have had to do some horrible things to keep it as `false` - https://github.com/Homebrew/brew/pull/15136#issuecomment-1500037278 - and multiple maintainers specify the `--display-cop-names` option to `brew style` themselves since it's clearer what's gone wrong.
		
			
				
	
	
		
			41 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Ruby
		
	
	
	
	
	
| # typed: false
 | |
| # frozen_string_literal: true
 | |
| 
 | |
| require "rubocops/version"
 | |
| 
 | |
| describe RuboCop::Cop::FormulaAudit::Version do
 | |
|   subject(:cop) { described_class.new }
 | |
| 
 | |
|   context "when auditing version" do
 | |
|     it "reports an offense if `version` is an empty string" do
 | |
|       expect_offense(<<~RUBY)
 | |
|         class Foo < Formula
 | |
|           url 'https://brew.sh/foo-1.0.tgz'
 | |
|           version ""
 | |
|           ^^^^^^^^^^ FormulaAudit/Version: version is set to an empty string
 | |
|         end
 | |
|       RUBY
 | |
|     end
 | |
| 
 | |
|     it "reports an offense if `version` has a leading 'v'" do
 | |
|       expect_offense(<<~RUBY)
 | |
|         class Foo < Formula
 | |
|           url 'https://brew.sh/foo-1.0.tgz'
 | |
|           version "v1.0"
 | |
|           ^^^^^^^^^^^^^^ FormulaAudit/Version: version v1.0 should not have a leading 'v'
 | |
|         end
 | |
|       RUBY
 | |
|     end
 | |
| 
 | |
|     it "reports an offense if `version` ends with an underline and a number" do
 | |
|       expect_offense(<<~RUBY)
 | |
|         class Foo < Formula
 | |
|           url 'https://brew.sh/foo-1.0.tgz'
 | |
|           version "1_0"
 | |
|           ^^^^^^^^^^^^^ FormulaAudit/Version: version 1_0 should not end with an underline and a number
 | |
|         end
 | |
|       RUBY
 | |
|     end
 | |
|   end
 | |
| end
 |