Commit 84f62600 authored by Fabio Pelosin's avatar Fabio Pelosin

[Repo#lint] Improved support for the linter.

parent 09e5a60c
...@@ -5,7 +5,7 @@ module Pod ...@@ -5,7 +5,7 @@ module Pod
# TODO: Add check to ensure that attributes inherited by subspecs are not duplicated ? # TODO: Add check to ensure that attributes inherited by subspecs are not duplicated ?
attr_accessor :quick, :lenient, :no_clean, :check_paths attr_accessor :quick, :lenient, :no_clean, :repo_path
attr_reader :spec, :file attr_reader :spec, :file
attr_reader :errors, :warnings, :notes attr_reader :errors, :warnings, :notes
...@@ -34,9 +34,10 @@ module Pod ...@@ -34,9 +34,10 @@ module Pod
@spec = Specification.from_file(file) @spec = Specification.from_file(file)
platforms = spec.available_platforms platforms = spec.available_platforms
if @check_paths if @repo_path
expected_path = "#{@spec.version}/#{@spec.name}.podspec" expected_path = "#{@spec.name}/#{@spec.version}/#{@spec.name}.podspec"
@errors << "Incorrect path, the path is `#{file}` and should be `#{expected_path}`" unless file.to_s.end_with?(expected_path) path = file.relative_path_from(@repo_path).to_s
@errors << "Incorrect path, the path is `#{file}` and should be `#{expected_path}`" unless path.end_with?(expected_path)
end end
platforms.each do |platform| platforms.each do |platform|
......
...@@ -88,14 +88,14 @@ module Pod ...@@ -88,14 +88,14 @@ module Pod
linter = Linter.new(podspec) linter = Linter.new(podspec)
linter.lenient = true linter.lenient = true
linter.quick = true linter.quick = true
linter.check_paths = true linter.repo_path = dir
linter.lint linter.lint
unless linter.result_type == :success unless linter.result_type == :success
invalid_count += 1
case linter.result_type case linter.result_type
when :error when :error
invalid_count += 1
color = :red color = :red
when :warning when :warning
color = :yellow color = :yellow
...@@ -108,7 +108,12 @@ module Pod ...@@ -108,7 +108,12 @@ module Pod
end end
end end
puts "Analyzed #{podspecs.count} podspecs files.\n\n" unless config.silent? puts "Analyzed #{podspecs.count} podspecs files.\n\n" unless config.silent?
invalid_count
if invalid_count == 0
puts "All the specs passed validation.".green << "\n\n" unless config.silent?
else
raise Informative, "#{invalid_count} podspecs failed validation."
end
end end
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment