Skip to content

Commit

Permalink
[Linter] Promote long summary warning to an error.
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiopelosin committed Sep 19, 2012
1 parent 90174ca commit 0360ab8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
5 changes: 2 additions & 3 deletions lib/cocoapods/command/linter.rb
Expand Up @@ -166,10 +166,11 @@ def podspec_errors
messages << "Unrecognized platfrom" unless platform_valid?
messages << "Missing name" unless spec.name
messages << "Missing version" unless spec.version
messages << "Missing summary" unless spec.summary
messages << "Missing summary" unless spec.summary || spec.summary.empty?
messages << "Missing homepage" unless spec.homepage
messages << "Missing author(s)" unless spec.authors
messages << "Missing or invalid source: #{spec.source}" unless source_valid?
messages << "The summary should be short use `description` (max 140 characters)." if spec.summary && spec.summary.length > 140

# attributes with multiplatform values
return messages unless platform_valid?
Expand Down Expand Up @@ -223,13 +224,11 @@ def podspec_warnings
messages << "Missing license type" unless license[:type]
messages << "Sample license type" if license[:type] && license[:type] =~ /\(example\)/
messages << "Invalid license type" if license[:type] && license[:type] =~ /\n/
messages << "The summary is required" if spec.summary.empty?
messages << "The summary is not meaningful" if spec.summary =~ /A short description of/
messages << "The description is not meaningful" if spec.description && spec.description =~ /An optional longer description of/
messages << "The summary should end with a dot" if spec.summary !~ /.*\./
messages << "The description should end with a dot" if spec.description !~ /.*\./ && spec.description != spec.summary
messages << "The summary should end with a dot" if spec.summary !~ /.*\./
messages << "The summary should be short use `description` (max 140 characters)." if spec.summary.length > 140
messages << "Comments must be deleted" if text.scan(/^\s*#/).length > 24
messages << "Warnings must not be disabled (`-Wno' compiler flags)" if spec.compiler_flags.split(' ').any? {|flag| flag.start_with?('-Wno') }

Expand Down
4 changes: 2 additions & 2 deletions lib/cocoapods/dependency.rb
Expand Up @@ -177,10 +177,10 @@ def store_podspec(sandbox, podspec)
output_path = sandbox.root + "Local Podspecs/#{name}.podspec"
output_path.dirname.mkpath
if podspec.is_a?(String)
raise Informative, "No podspec found for `#{name}' in `#{description}'" unless podspec.include?('Spec.new')
raise Informative, "No podspec found for `#{name}' in #{description}" unless podspec.include?('Spec.new')
output_path.open('w') { |f| f.puts(podspec) }
else
raise Informative, "No podspec found for `#{name}' in `#{description}'" unless podspec.exist?
raise Informative, "No podspec found for `#{name}' in #{description}" unless podspec.exist?
FileUtils.copy(podspec, output_path)
end
end
Expand Down
3 changes: 1 addition & 2 deletions spec/functional/command/repo_spec.rb
Expand Up @@ -7,7 +7,6 @@
extend SpecHelper::TemporaryRepos

it "runs with correct parameters" do
lambda { run_command('repo', 'add', 'NAME', 'URL') }.should.not.raise
lambda { run_command('repo', 'update') }.should.not.raise
lambda { run_command('repo', 'lint', temporary_directory.to_s) }.should.not.raise
end
Expand All @@ -18,7 +17,7 @@
end

it "adds a spec-repo" do
add_repo('private', fixture('spec-repos/master'))
run_command('repo', 'add', 'private', fixture('spec-repos/master'))
git_config('private', 'remote.origin.url').should == fixture('spec-repos/master').to_s
end

Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper/temporary_repos.rb
Expand Up @@ -32,7 +32,7 @@ def add_repo(name, from)
command.run
Dir.chdir(command.dir) do
`git checkout -b test >/dev/null 2>&1`
`git branch --set-upstream test origin/test >/dev/null 2>&1`
`git branch --set-upstream test origin/master >/dev/null 2>&1`
end
command
end
Expand Down

0 comments on commit 0360ab8

Please sign in to comment.