From 8763a6603a73436bd93ac13f66dc6c76404b2643 Mon Sep 17 00:00:00 2001 From: Fabio Pelosin Date: Sun, 13 Apr 2014 21:49:44 +0200 Subject: [PATCH] [Spec::Linter] Remove comments check Closes https://github.com/CocoaPods/Core/issues/108 --- lib/cocoapods-core/specification/linter.rb | 11 -------- spec/specification/linter_spec.rb | 32 ---------------------- 2 files changed, 43 deletions(-) diff --git a/lib/cocoapods-core/specification/linter.rb b/lib/cocoapods-core/specification/linter.rb index 545f18fc2..b340bca6c 100644 --- a/lib/cocoapods-core/specification/linter.rb +++ b/lib/cocoapods-core/specification/linter.rb @@ -95,17 +95,6 @@ def perform_textual_analysis if text =~ /clean_paths/ error 'clean_paths are deprecated (use preserve_paths).' end - - all_lines_count = text.lines.count - comments_lines_count = text.scan(/^\s*#\s+/).length - comments_ratio = comments_lines_count.fdiv(all_lines_count) - if comments_lines_count > 20 && comments_ratio > 0.2 - warning 'Comments must be deleted.' - end - if text.lines.first =~ /^\s*#\s+/ - warning "Comments placed at the top of the specification must be " \ - "deleted." - end end # Checks that every root only attribute which is required has a value. diff --git a/spec/specification/linter_spec.rb b/spec/specification/linter_spec.rb index dc31ba3f3..ba664c943 100644 --- a/spec/specification/linter_spec.rb +++ b/spec/specification/linter_spec.rb @@ -172,38 +172,6 @@ def message_should_include(*values) message_should_include('summary', 'meaningful') end - it 'checks that there are not too many comments in the file' do - podspec = "# some comment\n" * 30 - path = SpecHelper.temporary_directory + 'BananaLib.podspec' - FileUtils.cp @podspec_path, path - File.open(path, 'a') { |f| f.puts(podspec) } - linter = Specification::Linter.new(path) - linter.lint - linter.results.count.should == 1 - linter.results.first.message.should.match /Comments must be deleted./ - end - - it 'checks that there are not too many comments in the file' do - valid_text = File.read(@podspec_path) - podspec = "# some comment\n" << valid_text - path = SpecHelper.temporary_directory + 'BananaLib.podspec' - File.open(path, 'w') { |f| f.puts(podspec) } - linter = Specification::Linter.new(path) - linter.lint - linter.results.count.should == 1 - linter.results.first.message.should.match /Comments placed at the top of the specification must be deleted./ - end - - it "should not count #define's as comments" do - podspec = "#define\n" * 30 - path = SpecHelper.temporary_directory + 'BananaLib.podspec' - FileUtils.cp @podspec_path, path - File.open(path, 'a') { |f| f.puts(podspec) } - linter = Specification::Linter.new(path) - linter.lint - linter.results.count.should == 0 - end - #------------------# it 'checks the description for the example value' do