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
03138241
Commit
03138241
authored
Apr 30, 2012
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Command::Spec::Linter] Error for name mismatch.
Related to [#239]
parent
04bb26a7
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
19 deletions
+24
-19
spec.rb
lib/cocoapods/command/spec.rb
+19
-16
spec_spec.rb
spec/functional/command/spec_spec.rb
+5
-3
No files found.
lib/cocoapods/command/spec.rb
View file @
03138241
...
...
@@ -196,7 +196,7 @@ module Pod
end
def
errors
@errors
||=
file_patterns_errors
+
build_errors
@errors
||=
podspec_errors
+
file_patterns_errors
+
build_errors
end
def
warnings
...
...
@@ -247,25 +247,28 @@ module Pod
tmp_dir
+
'Pods'
+
spec
.
name
end
# It checks a spec for minor non fatal defects
#
# It returns a array of strings
#
# @return [Array<String>] List of the fatal defects detected in a podspec
def
podspec_errors
messages
=
[]
messages
<<
"The name of the spec should match the name of the file"
unless
names_match?
messages
end
# @return [Array<String>] List of the **non** fatal defects detected in a podspec
def
podspec_warnings
license
=
@spec
.
license
||
{}
source
=
@spec
.
source
||
{}
text
=
@file
.
read
warnings
=
[]
warnings
<<
"The name of the spec should match the name of the file"
unless
names_match?
warnings
<<
"Missing license[:type]"
unless
license
[
:type
]
warnings
<<
"Missing license[:file] or [:text]"
unless
license
[
:file
]
||
license
[
:text
]
warnings
<<
"The summary should end with a dot"
if
@spec
.
summary
!~
/.*\./
warnings
<<
"The description should end with a dot"
if
@spec
.
description
!~
/.*\./
&&
@spec
.
description
!=
@spec
.
summary
warnings
<<
"Git sources should specify either a tag or a commit"
if
source
[
:git
]
&&
(
!
source
[
:commit
]
||
!
source
[
:tag
]
)
warnings
<<
"Github repositories should end in `.git'"
if
github_source?
&&
source
[
:git
]
!~
/.*\.git/
warnings
<<
"Github repositories should start with `https'"
if
github_source?
&&
source
[
:git
]
!~
/https:\/\/github.com/
warnings
<<
"Comments must be deleted"
if
text
=~
/^\w*#\n\w*#/
# allow a single line comment as it is generally used in subspecs
warnings
messages
=
[]
messages
<<
"Missing license[:type]"
unless
license
[
:type
]
messages
<<
"Missing license[:file] or [:text]"
unless
license
[
:file
]
||
license
[
:text
]
messages
<<
"The summary should end with a dot"
if
@spec
.
summary
!~
/.*\./
messages
<<
"The description should end with a dot"
if
@spec
.
description
!~
/.*\./
&&
@spec
.
description
!=
@spec
.
summary
messages
<<
"Git sources should specify either a tag or a commit"
if
source
[
:git
]
&&
(
!
source
[
:commit
]
||
!
source
[
:tag
]
)
messages
<<
"Github repositories should end in `.git'"
if
github_source?
&&
source
[
:git
]
!~
/.*\.git/
messages
<<
"Github repositories should start with `https'"
if
github_source?
&&
source
[
:git
]
!~
/https:\/\/github.com/
messages
<<
"Comments must be deleted"
if
text
=~
/^\w*#\n\w*#/
# allow a single line comment as it is generally used in subspecs
messages
end
def
names_match?
...
...
spec/functional/command/spec_spec.rb
View file @
03138241
...
...
@@ -109,9 +109,11 @@ describe "Pod::Command::Spec lint" do
end
it
"lints a repo with --only-errors option and show the warnings"
do
output
=
run_command
(
'spec'
,
'lint'
,
'master'
,
'--only-errors'
)
output
.
should
.
include
"passed validation"
output
.
should
.
include
"WARN"
# The fixture has an error due to name mismatch
cmd
=
command
(
'spec'
,
'lint'
,
'master'
,
'--only-errors'
)
lambda
{
cmd
.
run
}.
should
.
raise
Pod
::
Informative
cmd
.
output
.
should
.
include
"InAppSettingKit (0.0.1)
\n
- ERROR | The name of the spec should match the name of the file"
cmd
.
output
.
should
.
include
"WARN"
end
it
"complains if no repo name or url are provided and there a no specs in the current working directory"
do
...
...
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