Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
brew
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KMSCAKKSCFKA AKFACAMADCAS
brew
Commits
ab19242d
Commit
ab19242d
authored
13 years ago
by
Jack Nagel
Browse files
Options
Downloads
Patches
Plain Diff
audit: reorganize some checks
Signed-off-by:
Jack Nagel
<
jacknagel@gmail.com
>
parent
c36561f4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Library/Homebrew/cmd/audit.rb
+29
-13
29 additions, 13 deletions
Library/Homebrew/cmd/audit.rb
with
29 additions
and
13 deletions
Library/Homebrew/cmd/audit.rb
+
29
−
13
View file @
ab19242d
...
...
@@ -199,6 +199,11 @@ def audit_formula_urls f
problems
<<
" * The homepage should start with http or https."
end
# Google Code homepages should end in a slash
if
f
.
homepage
=~
%r[^https?://code
\.
google
\.
com/p/[^/]+[^/]$]
problems
<<
" * Google Code homepage should end with a slash."
end
urls
=
[(
f
.
url
rescue
nil
),
(
f
.
head
rescue
nil
)].
reject
{
|
p
|
p
.
nil?
}
urls
.
uniq!
# head-only formulae result in duplicate entries
...
...
@@ -251,6 +256,24 @@ def audit_formula_urls f
return
problems
end
def
audit_formula_specs
text
problems
=
[]
if
text
=~
/devel .+(url '.+').+(url '.+')/m
problems
<<
" * 'devel' block found before stable 'url'"
end
if
text
=~
/devel .+(head '.+')/m
problems
<<
" * 'devel' block found before 'head'"
end
if
text
=~
/devel do\s+end/
problems
<<
" * Empty 'devel' block found"
end
return
problems
end
def
audit_formula_instance
f
problems
=
[]
...
...
@@ -275,10 +298,7 @@ def audit_formula_instance f
end
end
# Google Code homepages should end in a slash
if
f
.
homepage
=~
%r[^https?://code
\.
google
\.
com/p/[^/]+[^/]$]
problems
<<
" * Google Code homepage should end with a slash."
end
problems
+=
[
' * invalid or missing version'
]
if
f
.
version
.
to_s
.
empty?
return
problems
end
...
...
@@ -310,15 +330,10 @@ module Homebrew extend self
problems
<<
" * 'DATA' was found, but no '__END__'"
end
problems
<<
" * File should end with a newline"
if
text
=~
/.+\z/
problems
+=
[
' * invalid or missing version'
]
if
f
.
version
.
to_s
.
empty?
problems
<<
" * 'devel' block found before stable 'url'"
if
text
=~
/devel .+(url '.+').+(url '.+')/m
problems
<<
" * 'devel' block found before 'head'"
if
text
=~
/devel .+(head '.+')/m
problems
<<
" * Empty 'devel' block found"
if
text
=~
/devel do\s+end/
# files should end with a newline
if
text
=~
/.+\z/
problems
<<
" * File should end with a newline"
end
# Don't try remaining audits on text in __END__
text_without_patch
=
(
text
.
split
(
"__END__"
)[
0
]).
strip
()
...
...
@@ -326,6 +341,7 @@ module Homebrew extend self
problems
+=
audit_formula_text
(
f
.
name
,
text_without_patch
)
problems
+=
audit_formula_options
(
f
,
text_without_patch
)
problems
+=
audit_formula_version
(
f
,
text_without_patch
)
problems
+=
audit_formula_specs
(
text_without_patch
)
unless
problems
.
empty?
errors
=
true
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment