Commit 855aeac0 authored by Samuel E. Giddins's avatar Samuel E. Giddins

Merge pull request #2866 from CocoaPods/linter-attr-name

[Linter] Split linter messages from attribute names
parents b9b86662 9a04a62e
...@@ -7,7 +7,7 @@ GIT ...@@ -7,7 +7,7 @@ GIT
GIT GIT
remote: https://github.com/CocoaPods/Core.git remote: https://github.com/CocoaPods/Core.git
revision: 8bfbc96858947f4db6dd1f4a3ea085b446ad35d3 revision: 49a91acc2b1b9812352fa3605141215fbcc1e466
branch: master branch: master
specs: specs:
cocoapods-core (0.35.0) cocoapods-core (0.35.0)
......
...@@ -233,9 +233,9 @@ module Pod ...@@ -233,9 +233,9 @@ module Pod
resp = Pod::HTTP.validate_url(url) resp = Pod::HTTP.validate_url(url)
if !resp if !resp
warning "There was a problem validating the URL #{url}." warning('url', "There was a problem validating the URL #{url}.")
elsif !resp.success? elsif !resp.success?
warning "The URL (#{url}) is not reachable." warning('url', "The URL (#{url}) is not reachable.")
end end
resp resp
...@@ -255,7 +255,7 @@ module Pod ...@@ -255,7 +255,7 @@ module Pod
spec.screenshots.compact.each do |screenshot| spec.screenshots.compact.each do |screenshot|
request = validate_url(screenshot) request = validate_url(screenshot)
if request && !(request.headers['content-type'] && request.headers['content-type'].first =~ /image\/.*/i) if request && !(request.headers['content-type'] && request.headers['content-type'].first =~ /image\/.*/i)
warning "The screenshot #{screenshot} is not a valid image." warning('screenshot', "The screenshot #{screenshot} is not a valid image.")
end end
end end
end end
...@@ -340,9 +340,9 @@ module Pod ...@@ -340,9 +340,9 @@ module Pod
end end
if message.include?('error: ') if message.include?('error: ')
error "[xcodebuild] #{message}" error('xcodebuild', message)
else else
note "[xcodebuild] #{message}" note('xcodebuild', message)
end end
end end
end end
...@@ -359,13 +359,13 @@ module Pod ...@@ -359,13 +359,13 @@ module Pod
[:source_files, :resources, :preserve_paths, :vendored_libraries, :vendored_frameworks].each do |attr_name| [:source_files, :resources, :preserve_paths, :vendored_libraries, :vendored_frameworks].each do |attr_name|
# file_attr = Specification::DSL.attributes.values.find{|attr| attr.name == attr_name } # file_attr = Specification::DSL.attributes.values.find{|attr| attr.name == attr_name }
if !file_accessor.spec_consumer.send(attr_name).empty? && file_accessor.send(attr_name).empty? if !file_accessor.spec_consumer.send(attr_name).empty? && file_accessor.send(attr_name).empty?
error "The `#{attr_name}` pattern did not match any file." error('file patterns', "The `#{attr_name}` pattern did not match any file.")
end end
end end
if consumer.spec.root? if consumer.spec.root?
unless file_accessor.license || spec.license && (spec.license[:type] == 'Public Domain' || spec.license[:text]) unless file_accessor.license || spec.license && (spec.license[:type] == 'Public Domain' || spec.license[:text])
warning 'Unable to find a license file' warning('license', 'Unable to find a license file')
end end
end end
end end
...@@ -376,22 +376,24 @@ module Pod ...@@ -376,22 +376,24 @@ module Pod
# !@group Result Helpers # !@group Result Helpers
def error(message) def error(attribute_name, message)
add_result(:error, message) add_result(:error, attribute_name, message)
end end
def warning(message) def warning(attribute_name, message)
add_result(:warning, message) add_result(:warning, attribute_name, message)
end end
def note(message) def note(attribute_name, message)
add_result(:note, message) add_result(:note, attribute_name, message)
end end
def add_result(type, message) def add_result(type, attribute_name, message)
result = results.find { |r| r.type == type && r.message == message } result = results.find do |r|
r.type == type && r.attribute_name && r.message == message
end
unless result unless result
result = Result.new(type, message) result = Result.new(type, attribute_name, message)
results << result results << result
end end
result.platforms << consumer.platform_name if consumer result.platforms << consumer.platform_name if consumer
...@@ -401,8 +403,8 @@ module Pod ...@@ -401,8 +403,8 @@ module Pod
# Specialized Result to support subspecs aggregation # Specialized Result to support subspecs aggregation
# #
class Result < Specification::Linter::Results::Result class Result < Specification::Linter::Results::Result
def initialize(type, message) def initialize(type, attribute_name, message)
super(type, message) super(type, attribute_name, message)
@subspecs = [] @subspecs = []
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