Commit 69d65885 authored by Fabio Pelosin's avatar Fabio Pelosin

[Pod::Command::Spec] Only WARN or ERROR types of lint messages

- the arrow is yellow/red according to the type
- Nno needs of other types as the messages should be  clear enought
parent 2b20357e
...@@ -76,39 +76,46 @@ module Pod ...@@ -76,39 +76,46 @@ module Pod
files.each do |file| files.each do |file|
file = file.realpath file = file.realpath
spec = Specification.from_file(file) spec = Specification.from_file(file)
# Show immediatly which pod is being processed.
# This line will be overwritten once the result is known
print " -> #{spec}\r" unless config.silent? || is_repo print " -> #{spec}\r" unless config.silent? || is_repo
$stdout.flush
spec.validate! spec.validate!
warnings = warnings_for_spec(spec, file, is_repo) warnings = warnings_for_spec(spec, file, is_repo)
deprecations = deprecation_notices_for_spec(spec, file, is_repo) deprecations = deprecation_notices_for_spec(spec, file, is_repo)
# TODO: check that the dependencies of the spec exist # TODO: check that the dependencies of the spec exist
if is_repo if is_repo
build_errors, file_errors = [], [] build_messages, file_errors = [], []
else else
tmp_dir.mkpath tmp_dir.mkpath
build_errors = Dir.chdir(tmp_dir) { build_errors_for_spec(spec, file, is_repo) } build_messages = Dir.chdir(tmp_dir) { build_errors_for_spec(spec, file, is_repo) }
file_errors = Dir.chdir(tmp_dir) { file_errors_for_spec(spec, file, is_repo) } file_errors = Dir.chdir(tmp_dir) { file_errors_for_spec(spec, file, is_repo) }
tmp_dir.rmtree tmp_dir.rmtree
end end
# This overwrites the previous printed text # Errors compromise the functionality of a spec, warnings can be ignored
is_valid = deprecations.empty? && warnings.empty? && file_errors.empty? build_errors = build_messages.select {|msg| msg.include?('error')}
build_warnings = build_messages - build_errors
all = warnings + deprecations + build_messages + file_errors
errors = file_errors + build_errors
warnings = all - errors
all_valid = false unless all.empty?
# This overwrites the previously printed text
unless config.silent? unless config.silent?
if is_valid if errors.empty? && warnings.empty?
puts " -> ".green + "#{spec} passed validation" unless is_repo puts " -> ".green + "#{spec} passed validation" unless is_repo
elsif errors.empty?
puts " -> ".yellow + spec.to_s
else else
puts " -> ".red + spec.to_s puts " -> ".red + spec.to_s
all_valid = false
end
end end
types = ["WARN", "DPRC", "XCDB", "ERFL"]
messages = [warnings, deprecations, build_errors, file_errors]
types.each_with_index do |type, i|
unless messages[i].empty?
messages[i].each {|msg| puts " - #{type} | #{msg}"} unless config.silent?
end end
end
puts unless config.silent? || ( is_repo && messages.flatten.empty? ) warnings.each {|msg| puts " - WARN | #{msg}"} unless config.silent?
errors.each {|msg| puts " - ERROR | #{msg}"} unless config.silent?
puts unless config.silent? || ( is_repo && all.flatten.empty? )
end end
all_valid all_valid
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