Skip to content

Commit

Permalink
[Spec::Linter] Remove comments check
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiopelosin committed Apr 13, 2014
1 parent ada2059 commit 8763a66
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 43 deletions.
11 changes: 0 additions & 11 deletions lib/cocoapods-core/specification/linter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
32 changes: 0 additions & 32 deletions spec/specification/linter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8763a66

Please sign in to comment.