Commit b0df1f55 authored by Fabio Pelosin's avatar Fabio Pelosin

[Validator] Minor clean up.

parent 32735dc3
...@@ -80,16 +80,10 @@ module Pod ...@@ -80,16 +80,10 @@ module Pod
end end
case result.type case result.type
when :error, :deprecation when :error then type = "ERROR"
type = "ERROR" when :warning then type = "WARN"
when :warning when :note then type = "NOTE"
type = "WARN" else raise "#{result.type}" end
when :note
type = "NOTE"
else
raise "#{result.type}"
end
UI.puts " - #{type.ljust(5)} | #{platform_message}#{result.message}" UI.puts " - #{type.ljust(5)} | #{platform_message}#{result.message}"
end end
UI.puts UI.puts
...@@ -99,6 +93,8 @@ module Pod ...@@ -99,6 +93,8 @@ module Pod
# @!group Configuration # @!group Configuration
# @return [Boolean] TODO
#
attr_accessor :disable_ui_output attr_accessor :disable_ui_output
# @return [Pathname] whether the validation should be performed against a repo. # @return [Pathname] whether the validation should be performed against a repo.
...@@ -106,7 +102,7 @@ module Pod ...@@ -106,7 +102,7 @@ module Pod
attr_accessor :repo_path attr_accessor :repo_path
# @return [Bool] whether the validation should skip the checks that # @return [Bool] whether the validation should skip the checks that
# requires the download or the build of the library. # requires the download of the library.
# #
attr_accessor :quick attr_accessor :quick
...@@ -116,13 +112,14 @@ module Pod ...@@ -116,13 +112,14 @@ module Pod
attr_accessor :no_clean attr_accessor :no_clean
# @return [Bool] whether the validation should be performed against the root of # @return [Bool] whether the validation should be performed against the root of
# the podspec instead to its original source. Uses the `:local` option # the podspec instead to its original source.
# of the Podfile. #
# @note Uses the `:local` option of the Podfile.
# #
attr_writer :local attr_writer :local
def local?; @local; end def local?; @local; end
# # @return [Boolean] TODO
# #
attr_accessor :only_errors attr_accessor :only_errors
...@@ -137,9 +134,7 @@ module Pod ...@@ -137,9 +134,7 @@ module Pod
# @return [Boolean] # @return [Boolean]
# #
def validated? def validated?
return false if result_type == :error result_type != :error && (result_type != :warning || only_errors)
return false if result_type == :warning && !only_errors
return true
end end
# @return [Symbol] # @return [Symbol]
...@@ -148,21 +143,16 @@ module Pod ...@@ -148,21 +143,16 @@ module Pod
types = results.map(&:type).uniq types = results.map(&:type).uniq
if types.include?(:error) then :error if types.include?(:error) then :error
elsif types.include?(:warning) then :warning elsif types.include?(:warning) then :warning
else :note else :note end
end
end end
# @return [Symbol] # @return [Symbol]
# #
def result_color def result_color
case result_type case result_type
when :error when :error then :red
color = :red when :warning then :yellow
when :warning else :green end
color = :yellow
else
color = :green
end
end end
# @return [Pathname] the temporary directory used by the linter. # @return [Pathname] the temporary directory used by the linter.
...@@ -229,8 +219,8 @@ module Pod ...@@ -229,8 +219,8 @@ module Pod
Config.instance = @original_config Config.instance = @original_config
end end
# It creates a podfile in memory and builds a library containing # It creates a podfile in memory and builds a library containing the pod
# the pod for all available platforms with xcodebuild. # for all available platforms with xcodebuild.
# #
def install_pod def install_pod
podfile = podfile_from_spec(current_platform) podfile = podfile_from_spec(current_platform)
...@@ -241,12 +231,14 @@ module Pod ...@@ -241,12 +231,14 @@ module Pod
config.silent config.silent
end end
# Performs platform specific analysis. # Performs platform specific analysis. It requires to download the source
# It requires to download the source at each iteration # at each iteration
# #
# @note Treat xcodebuild warnings as notes because the spec maintainer # @note Xcode warnings are treaded as notes because the spec maintainer
# might not be the author of the library # might not be the author of the library
# #
# @return [void]
#
def build_pod def build_pod
if `which xcodebuild`.strip.empty? if `which xcodebuild`.strip.empty?
UI.warn "Skipping compilation with `xcodebuild' because it can't be found.\n".yellow UI.warn "Skipping compilation with `xcodebuild' because it can't be found.\n".yellow
......
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