2019-04-19 15:38:03 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								# frozen_string_literal: true
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2023-02-20 10:22:39 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								require "rubocops/desc"
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-08 13:51:35 +05:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-04-13 14:35:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								describe RuboCop::Cop::FormulaAudit::Desc do
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-08 13:51:35 +05:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  subject(:cop) { described_class.new }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-02-19 23:15:33 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  context "when auditing formula `desc` methods" do
							 | 
						
					
						
							
								
									
										
										
										
											2021-01-12 18:12:56 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    it "reports an offense when there is no `desc`" do
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-21 03:12:50 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      expect_offense(<<~RUBY)
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-08 13:51:35 +05:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        class Foo < Formula
							 | 
						
					
						
							
								
									
										
										
										
											2023-04-07 17:16:48 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        ^^^^^^^^^^^^^^^^^^^ FormulaAudit/Desc: Formula should have a desc (Description).
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-28 20:51:55 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          url 'https://brew.sh/foo-1.0.tgz'
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-08 13:51:35 +05:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        end
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-21 03:12:50 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      RUBY
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-08 13:51:35 +05:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-01-12 18:12:56 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    it "reports an offense when `desc` is an empty string" do
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-21 03:12:50 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      expect_offense(<<~RUBY, "/homebrew-core/Formula/foo.rb")
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-10 15:43:07 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        class Foo < Formula
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-28 20:51:55 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          url 'https://brew.sh/foo-1.0.tgz'
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-10 15:43:07 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          desc ''
							 | 
						
					
						
							
								
									
										
										
										
											2023-04-07 17:16:48 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          ^^^^^^^ FormulaAudit/Desc: The desc (description) should not be an empty string.
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-10 15:43:07 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        end
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-21 03:12:50 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      RUBY
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-10 15:43:07 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-01-12 18:12:56 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    it "reports an offense when `desc` is too long" do
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-21 03:12:50 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      expect_offense(<<~RUBY, "/homebrew-core/Formula/foo.rb")
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-08 13:51:35 +05:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        class Foo < Formula
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-28 20:51:55 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          url 'https://brew.sh/foo-1.0.tgz'
							 | 
						
					
						
							
								
									
										
										
										
											2017-06-08 15:13:06 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          desc 'Bar#{"bar" * 29}'
							 | 
						
					
						
							
								
									
										
										
										
											2023-04-07 17:16:48 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Desc: Description is too long. It should be less than 80 characters. The current length is 90.
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-08 13:51:35 +05:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        end
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-21 03:12:50 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      RUBY
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-08 13:51:35 +05:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-01-12 18:12:56 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    it "reports an offense when `desc` is a multiline string" do
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-21 03:12:50 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      expect_offense(<<~RUBY, "/homebrew-core/Formula/foo.rb")
							 | 
						
					
						
							
								
									
										
										
										
											2017-05-13 18:44:37 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        class Foo < Formula
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-28 20:51:55 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          url 'https://brew.sh/foo-1.0.tgz'
							 | 
						
					
						
							
								
									
										
										
										
											2017-06-08 15:13:06 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          desc 'Bar#{"bar" * 9}'\
							 | 
						
					
						
							
								
									
										
										
										
											2017-06-01 16:06:51 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            '#{"foo" * 21}'
							 | 
						
					
						
							
								
									
										
										
										
											2023-04-07 17:16:48 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Desc: Description is too long. It should be less than 80 characters. The current length is 93.
							 | 
						
					
						
							
								
									
										
										
										
											2017-05-13 18:44:37 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        end
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-21 03:12:50 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      RUBY
							 | 
						
					
						
							
								
									
										
										
										
											2017-05-13 18:44:37 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    end
							 | 
						
					
						
							
								
									
										
										
										
											2017-06-08 15:13:06 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-02-19 23:15:33 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  context "when auditing formula description texts" do
							 | 
						
					
						
							
								
									
										
										
										
											2021-01-12 18:12:56 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    it "reports an offense when the description starts with a leading space" do
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-21 03:12:50 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      expect_offense(<<~RUBY, "/homebrew-core/Formula/foo.rb")
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-08 13:51:35 +05:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        class Foo < Formula
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-28 20:51:55 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          url 'https://brew.sh/foo-1.0.tgz'
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-30 16:29:12 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          desc ' Description with a leading space'
							 | 
						
					
						
							
								
									
										
										
										
											2023-04-07 17:16:48 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                ^ FormulaAudit/Desc: Description shouldn't have leading spaces.
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-08 13:51:35 +05:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        end
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-21 03:12:50 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      RUBY
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-08 13:51:35 +05:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-01-12 18:12:56 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    it "reports an offense when the description ends with a trailing space" do
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-21 03:12:50 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      expect_offense(<<~RUBY, "/homebrew-core/Formula/foo.rb")
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-08 13:51:35 +05:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        class Foo < Formula
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-28 20:51:55 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          url 'https://brew.sh/foo-1.0.tgz'
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-30 16:29:12 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          desc 'Description with a trailing space '
							 | 
						
					
						
							
								
									
										
										
										
											2023-04-07 17:16:48 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                                                 ^ FormulaAudit/Desc: Description shouldn't have trailing spaces.
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-08 13:51:35 +05:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        end
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-21 03:12:50 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      RUBY
							 | 
						
					
						
							
								
									
										
										
										
											2017-06-08 15:13:06 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-01-12 18:12:56 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    it "reports an offense when \"command-line\" is incorrectly spelled in the description" do
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-21 03:12:50 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      expect_offense(<<~RUBY, "/homebrew-core/Formula/foo.rb")
							 | 
						
					
						
							
								
									
										
										
										
											2017-06-08 15:13:06 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        class Foo < Formula
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-28 20:51:55 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          url 'https://brew.sh/foo-1.0.tgz'
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-30 16:29:12 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          desc 'command line'
							 | 
						
					
						
							
								
									
										
										
										
											2023-04-07 17:16:48 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                ^ FormulaAudit/Desc: Description should start with a capital letter.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                ^^^^^^^^^^^^ FormulaAudit/Desc: Description should use "command-line" instead of "command line".
							 | 
						
					
						
							
								
									
										
										
										
											2017-06-08 15:13:06 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        end
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-21 03:12:50 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      RUBY
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-08 13:51:35 +05:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-01-12 18:12:56 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    it "reports an offense when an article is used in the description" do
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-21 03:12:50 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      expect_offense(<<~RUBY, "/homebrew-core/Formula/foo.rb")
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-08 13:51:35 +05:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        class Foo < Formula
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-28 20:51:55 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          url 'https://brew.sh/foo-1.0.tgz'
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-30 16:29:12 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          desc 'An aardvark'
							 | 
						
					
						
							
								
									
										
										
										
											2023-04-07 17:16:48 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                ^^ FormulaAudit/Desc: Description shouldn't start with an article.
							 | 
						
					
						
							
								
									
										
										
										
											2020-09-17 20:44:09 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      RUBY
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      expect_offense(<<~RUBY, "/homebrew-core/Formula/foo.rb")
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        class Foo < Formula
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          url 'https://brew.sh/foo-1.0.tgz'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          desc 'The aardvark'
							 | 
						
					
						
							
								
									
										
										
										
											2023-04-07 17:16:48 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                ^^^ FormulaAudit/Desc: Description shouldn't start with an article.
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-08 13:51:35 +05:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        end
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-21 03:12:50 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      RUBY
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-08 13:51:35 +05:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-01-12 18:12:56 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    it "reports an offense when the description starts with a lowercase letter" do
							 | 
						
					
						
							
								
									
										
										
										
											2017-06-17 07:12:46 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      expect_offense(<<~RUBY, "/homebrew-core/Formula/foo.rb")
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        class Foo < Formula
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-28 20:51:55 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          url 'https://brew.sh/foo-1.0.tgz'
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-30 16:29:12 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          desc 'bar'
							 | 
						
					
						
							
								
									
										
										
										
											2023-04-07 17:16:48 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                ^ FormulaAudit/Desc: Description should start with a capital letter.
							 | 
						
					
						
							
								
									
										
										
										
											2017-06-17 07:12:46 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      RUBY
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-01-12 18:12:56 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    it "reports an offense when the description starts with the formula name" do
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-06 19:19:48 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      expect_offense(<<~RUBY, "/homebrew-core/Formula/foo.rb")
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        class Foo < Formula
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-28 20:51:55 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          url 'https://brew.sh/foo-1.0.tgz'
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-30 16:29:12 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          desc 'Foo is a foobar'
							 | 
						
					
						
							
								
									
										
										
										
											2023-04-07 17:16:48 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                ^^^ FormulaAudit/Desc: Description shouldn't start with the formula name.
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-06 19:19:48 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      RUBY
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2022-11-03 23:11:41 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    it "report and corrects an offense when the description ends with a full stop" do
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-06 19:19:48 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      expect_offense(<<~RUBY, "/homebrew-core/Formula/foo.rb")
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        class Foo < Formula
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-28 20:51:55 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          url 'https://brew.sh/foo-1.0.tgz'
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-30 16:29:12 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          desc 'Description with a full stop at the end.'
							 | 
						
					
						
							
								
									
										
										
										
											2023-04-07 17:16:48 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                                                       ^ FormulaAudit/Desc: Description shouldn't end with a full stop.
							 | 
						
					
						
							
								
									
										
										
										
											2022-11-03 23:11:41 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      RUBY
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      expect_correction(<<~RUBY)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        class Foo < Formula
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          url 'https://brew.sh/foo-1.0.tgz'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          desc 'Description with a full stop at the end'
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-06 19:19:48 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      RUBY
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2023-06-20 08:10:30 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    it "reports and corrects an offense when the description contains Unicode So characters" do
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      expect_offense(<<~RUBY, "/homebrew-core/Formula/foo.rb")
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        class Foo < Formula
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          url 'https://brew.sh/foo-1.0.tgz'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          desc 'Description with a 🍺 symbol'
							 | 
						
					
						
							
								
									
										
										
										
											2023-06-20 11:33:49 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                                   ^ FormulaAudit/Desc: Description shouldn't contain Unicode emojis or symbols.
							 | 
						
					
						
							
								
									
										
										
										
											2023-06-20 08:10:30 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      RUBY
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      expect_correction(<<~RUBY)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        class Foo < Formula
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          url 'https://brew.sh/foo-1.0.tgz'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          desc 'Description with a symbol'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      RUBY
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2022-11-03 22:25:07 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    it "does not report an offense when the description ends with 'etc.'" do
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      expect_no_offenses(<<~RUBY, "/homebrew-core/Formula/foo.rb")
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        class Foo < Formula
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          url 'https://brew.sh/foo-1.0.tgz'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          desc 'Description of a thing and some more things and some more etc.'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      RUBY
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-01-12 18:12:56 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    it "reports and corrects all rules for description text" do
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      expect_offense(<<~RUBY, "/homebrew-core/Formula/foo.rb")
							 | 
						
					
						
							
								
									
										
										
										
											2017-06-08 15:13:06 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        class Foo < Formula
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-28 20:51:55 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          url 'https://brew.sh/foo-1.0.tgz'
							 | 
						
					
						
							
								
									
										
										
										
											2017-06-08 15:13:06 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          desc ' an bar: commandline foo '
							 | 
						
					
						
							
								
									
										
										
										
											2023-04-07 17:16:48 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                                        ^ FormulaAudit/Desc: Description shouldn't have trailing spaces.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                         ^^^^^^^^^^^ FormulaAudit/Desc: Description should use "command-line" instead of "commandline".
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                ^ FormulaAudit/Desc: Description shouldn't have leading spaces.
							 | 
						
					
						
							
								
									
										
										
										
											2017-06-08 15:13:06 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        end
							 | 
						
					
						
							
								
									
										
										
										
											2018-07-11 15:17:40 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      RUBY
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-21 03:12:50 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-01-12 18:12:56 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      expect_correction(<<~RUBY)
							 | 
						
					
						
							
								
									
										
										
										
											2017-06-08 15:13:06 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        class Foo < Formula
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-28 20:51:55 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          url 'https://brew.sh/foo-1.0.tgz'
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-30 16:29:12 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          desc 'Bar: command-line'
							 | 
						
					
						
							
								
									
										
										
										
											2017-06-08 15:13:06 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        end
							 | 
						
					
						
							
								
									
										
										
										
											2018-07-11 15:17:40 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      RUBY
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-08 13:51:35 +05:30
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								end
							 |