Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
cocoapods
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
cocoapods
Commits
eba4bf58
Commit
eba4bf58
authored
Nov 14, 2014
by
Daniel Tomlinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use --allow-warnings rather than --error-only for pod spec validation
parent
a3738991
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
41 additions
and
42 deletions
+41
-42
lib.rb
lib/cocoapods/command/lib.rb
+16
-16
push.rb
lib/cocoapods/command/repo/push.rb
+1
-1
spec.rb
lib/cocoapods/command/spec.rb
+15
-15
validator.rb
lib/cocoapods/validator.rb
+3
-4
spec_spec.rb
spec/functional/command/spec_spec.rb
+4
-4
validator_spec.rb
spec/unit/validator_spec.rb
+2
-2
No files found.
lib/cocoapods/command/lib.rb
View file @
eba4bf58
...
...
@@ -109,23 +109,23 @@ module Pod
def
self
.
options
[[
'--quick'
,
'Lint skips checks that would require to download and build the spec'
],
[
'--
only-error
s'
,
'Lint validates even if warnings are present'
],
[
'--
allow-warning
s'
,
'Lint validates even if warnings are present'
],
[
'--subspec=NAME'
,
'Lint validates only the given subspec'
],
[
'--no-subspecs'
,
'Lint skips validation of subspecs'
],
[
'--no-clean'
,
'Lint leaves the build directory intact for inspection'
],
[
'--no-clean'
,
'Lint leaves the build directory intact for inspection'
],
[
'--sources=https://github.com/artsy/Specs'
,
'The sources from which to pull dependant pods '
\
'(defaults to https://github.com/CocoaPods/Specs.git). '
\
'Multiple sources must be comma-delimited.'
]].
concat
(
super
)
end
def
initialize
(
argv
)
@quick
=
argv
.
flag?
(
'quick'
)
@
only_errors
=
argv
.
flag?
(
'only-error
s'
)
@clean
=
argv
.
flag?
(
'clean'
,
true
)
@subspecs
=
argv
.
flag?
(
'subspecs'
,
true
)
@only_subspec
=
argv
.
option
(
'subspec'
)
@source_urls
=
argv
.
option
(
'sources'
,
'https://github.com/CocoaPods/Specs.git'
).
split
(
','
)
@podspecs_paths
=
argv
.
arguments!
@quick
=
argv
.
flag?
(
'quick'
)
@
allow_warnings
=
argv
.
flag?
(
'allow-warning
s'
)
@clean
=
argv
.
flag?
(
'clean'
,
true
)
@subspecs
=
argv
.
flag?
(
'subspecs'
,
true
)
@only_subspec
=
argv
.
option
(
'subspec'
)
@source_urls
=
argv
.
option
(
'sources'
,
'https://github.com/CocoaPods/Specs.git'
).
split
(
','
)
@podspecs_paths
=
argv
.
arguments!
super
end
...
...
@@ -137,13 +137,13 @@ module Pod
UI
.
puts
podspecs_to_lint
.
each
do
|
podspec
|
validator
=
Validator
.
new
(
podspec
,
@source_urls
)
validator
.
local
=
true
validator
.
quick
=
@quick
validator
.
no_clean
=
!
@clean
validator
.
only_errors
=
@only_error
s
validator
.
no_subspecs
=
!
@subspecs
||
@only_subspec
validator
.
only_subspec
=
@only_subspec
validator
=
Validator
.
new
(
podspec
,
@source_urls
)
validator
.
local
=
true
validator
.
quick
=
@quick
validator
.
no_clean
=
!
@clean
validator
.
allow_warnings
=
@allow_warning
s
validator
.
no_subspecs
=
!
@subspecs
||
@only_subspec
validator
.
only_subspec
=
@only_subspec
validator
.
validate
unless
@clean
...
...
lib/cocoapods/command/repo/push.rb
View file @
eba4bf58
...
...
@@ -83,7 +83,7 @@ module Pod
UI
.
puts
"
\n
Validating
#{
'spec'
.
pluralize
(
count
)
}
"
.
yellow
podspec_files
.
each
do
|
podspec
|
validator
=
Validator
.
new
(
podspec
,
SourcesManager
.
all
.
map
(
&
:url
))
validator
.
only_error
s
=
@allow_warnings
validator
.
allow_warning
s
=
@allow_warnings
begin
validator
.
validate
rescue
...
...
lib/cocoapods/command/spec.rb
View file @
eba4bf58
...
...
@@ -63,23 +63,23 @@ module Pod
]
def
self
.
options
[[
'--quick'
,
'Lint skips checks that would require to download and build the spec'
],
[
'--
only-error
s'
,
'Lint validates even if warnings are present'
],
[[
'--quick'
,
'Lint skips checks that would require to download and build the spec'
],
[
'--
allow-warning
s'
,
'Lint validates even if warnings are present'
],
[
'--subspec=NAME'
,
'Lint validates only the given subspec'
],
[
'--no-subspecs'
,
'Lint skips validation of subspecs'
],
[
'--no-clean'
,
'Lint leaves the build directory intact for inspection'
],
[
'--no-clean'
,
'Lint leaves the build directory intact for inspection'
],
[
'--sources=https://github.com/artsy/Specs'
,
'The sources from which to pull dependant pods '
\
'(defaults to https://github.com/CocoaPods/Specs.git). '
\
'Multiple sources must be comma-delimited.'
]].
concat
(
super
)
end
def
initialize
(
argv
)
@quick
=
argv
.
flag?
(
'quick'
)
@
only_errors
=
argv
.
flag?
(
'only-error
s'
)
@clean
=
argv
.
flag?
(
'clean'
,
true
)
@subspecs
=
argv
.
flag?
(
'subspecs'
,
true
)
@only_subspec
=
argv
.
option
(
'subspec'
)
@source_urls
=
argv
.
option
(
'sources'
,
'https://github.com/CocoaPods/Specs.git'
).
split
(
','
)
@quick
=
argv
.
flag?
(
'quick'
)
@
allow_warnings
=
argv
.
flag?
(
'allow-warning
s'
)
@clean
=
argv
.
flag?
(
'clean'
,
true
)
@subspecs
=
argv
.
flag?
(
'subspecs'
,
true
)
@only_subspec
=
argv
.
option
(
'subspec'
)
@source_urls
=
argv
.
option
(
'sources'
,
'https://github.com/CocoaPods/Specs.git'
).
split
(
','
)
@podspecs_paths
=
argv
.
arguments!
super
end
...
...
@@ -88,12 +88,12 @@ module Pod
UI
.
puts
invalid_count
=
0
podspecs_to_lint
.
each
do
|
podspec
|
validator
=
Validator
.
new
(
podspec
,
@source_urls
)
validator
.
quick
=
@quick
validator
.
no_clean
=
!
@clean
validator
.
only_errors
=
@only_error
s
validator
.
no_subspecs
=
!
@subspecs
||
@only_subspec
validator
.
only_subspec
=
@only_subspec
validator
=
Validator
.
new
(
podspec
,
@source_urls
)
validator
.
quick
=
@quick
validator
.
no_clean
=
!
@clean
validator
.
allow_warnings
=
@allow_warning
s
validator
.
no_subspecs
=
!
@subspecs
||
@only_subspec
validator
.
only_subspec
=
@only_subspec
validator
.
validate
invalid_count
+=
1
unless
validator
.
validated?
...
...
lib/cocoapods/validator.rb
View file @
eba4bf58
...
...
@@ -131,10 +131,9 @@ module Pod
attr_accessor
:local
alias_method
:local?
,
:local
# @return [Bool] Whether the validator should fail only on errors or also
# on warnings.
# @return [Bool] Whether the validator should fail on warnings, or only on errors.
#
attr_accessor
:
only_error
s
attr_accessor
:
allow_warning
s
# @return [String] name of the subspec to check, if nil all subspecs are checked.
#
...
...
@@ -155,7 +154,7 @@ module Pod
# @return [Boolean]
#
def
validated?
result_type
!=
:error
&&
(
result_type
!=
:warning
||
only_error
s
)
result_type
!=
:error
&&
(
result_type
!=
:warning
||
allow_warning
s
)
end
# @return [Symbol]
...
...
spec/functional/command/spec_spec.rb
View file @
eba4bf58
...
...
@@ -174,7 +174,7 @@ module Pod
it
'lints the current working directory'
do
Dir
.
chdir
(
fixture
(
'spec-repos'
)
+
'master/Specs/JSONKit/1.4/'
)
do
cmd
=
command
(
'spec'
,
'lint'
,
'--quick'
,
'--
only-error
s'
)
cmd
=
command
(
'spec'
,
'lint'
,
'--quick'
,
'--
allow-warning
s'
)
cmd
.
run
UI
.
output
.
should
.
include
'passed validation'
end
...
...
@@ -183,7 +183,7 @@ module Pod
# @todo VCR is required in CocoaPods only for this test.
xit
'lints a remote podspec'
do
Dir
.
chdir
(
fixture
(
'spec-repos'
)
+
'master/Specs/JSONKit/1.4/'
)
do
cmd
=
command
(
'spec'
,
'lint'
,
'--quick'
,
'--
only-error
s'
,
'--silent'
,
'https://github.com/CocoaPods/Specs/raw/master/A2DynamicDelegate/2.0.1/A2DynamicDelegate.podspec'
)
cmd
=
command
(
'spec'
,
'lint'
,
'--quick'
,
'--
allow-warning
s'
,
'--silent'
,
'https://github.com/CocoaPods/Specs/raw/master/A2DynamicDelegate/2.0.1/A2DynamicDelegate.podspec'
)
# VCR.use_cassette('linter', :record => :new_episodes) { }
lambda
{
cmd
.
run
}.
should
.
not
.
raise
end
...
...
@@ -203,8 +203,8 @@ module Pod
UI
.
output
.
should
.
include
'Missing license type'
end
it
'respects the -
only--error
s option'
do
cmd
=
command
(
'spec'
,
'lint'
,
'--quick'
,
'--
only-error
s'
,
@spec_path
)
it
'respects the -
-allow-warning
s option'
do
cmd
=
command
(
'spec'
,
'lint'
,
'--quick'
,
'--
allow-warning
s'
,
@spec_path
)
lambda
{
cmd
.
run
}.
should
.
not
.
raise
UI
.
output
.
should
.
include
'Missing license type'
end
...
...
spec/unit/validator_spec.rb
View file @
eba4bf58
...
...
@@ -72,12 +72,12 @@ module Pod
sut
.
validate
end
it
'respects the
only error
s option'
do
it
'respects the
allow warning
s option'
do
podspec
=
stub_podspec
(
/.*summary.*/
,
'"summary": "A short description of",'
)
file
=
write_podspec
(
podspec
)
sut
=
Validator
.
new
(
file
,
SourcesManager
.
master
.
map
(
&
:url
))
sut
.
quick
=
true
sut
.
only_error
s
=
true
sut
.
allow_warning
s
=
true
sut
.
validate
sut
.
results
.
map
(
&
:to_s
).
first
.
should
.
match
/summary.*meaningful/
sut
.
validated?
.
should
.
be
.
true
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment