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
# 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 :errors, :warnings, :notes
......@@ -34,9 +34,10 @@ module Pod
@spec = Specification.from_file(file)
platforms = spec.available_platforms
if @check_paths
expected_path = "#{@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)
if @repo_path
expected_path = "#{@spec.name}/#{@spec.version}/#{@spec.name}.podspec"
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
platforms.each do |platform|
......
......@@ -88,14 +88,14 @@ module Pod
linter = Linter.new(podspec)
linter.lenient = true
linter.quick = true
linter.check_paths = true
linter.repo_path = dir
linter.lint
unless linter.result_type == :success
invalid_count += 1
case linter.result_type
when :error
invalid_count += 1
color = :red
when :warning
color = :yellow
......@@ -108,7 +108,12 @@ module Pod
end
end
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
......
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