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
e1ef3795
Commit
e1ef3795
authored
7 years ago
by
Mike McQuaid
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #2577 from DomT4/keg_only_style_tweaks
caveats: tweak keg_only style
parents
935a3fd4
bf491e51
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Library/Homebrew/caveats.rb
+1
-1
1 addition, 1 deletion
Library/Homebrew/caveats.rb
Library/Homebrew/dev-cmd/audit.rb
+2
-1
2 additions, 1 deletion
Library/Homebrew/dev-cmd/audit.rb
Library/Homebrew/test/dev-cmd/audit_spec.rb
+63
-0
63 additions, 0 deletions
Library/Homebrew/test/dev-cmd/audit_spec.rb
with
66 additions
and
2 deletions
Library/Homebrew/caveats.rb
+
1
−
1
View file @
e1ef3795
...
...
@@ -46,7 +46,7 @@ class Caveats
s
=
<<-
EOS
.
undent
This formula is keg-only, which means it was not symlinked into
#{
HOMEBREW_PREFIX
}
,
because
#{
f
.
keg_only_reason
}
.
because
#{
f
.
keg_only_reason
.
to_s
.
chomp
}
.
EOS
if
f
.
bin
.
directory?
||
f
.
sbin
.
directory?
s
<<
"
\n
If you need to have this software first in your PATH run:
\n
"
...
...
This diff is collapsed.
Click to expand it.
Library/Homebrew/dev-cmd/audit.rb
+
2
−
1
View file @
e1ef3795
...
...
@@ -502,6 +502,7 @@ class FormulaAuditor
GPG
GNOME
BSD
Firefox
]
.
freeze
reason
=
formula
.
keg_only_reason
.
to_s
...
...
@@ -510,7 +511,7 @@ class FormulaAuditor
reason
.
sub!
(
name
,
""
)
first_word
=
reason
.
split
[
0
]
if
reason
=~
/
^
[A-Z]/
&&
!
reason
.
start_with?
(
*
whitelist
)
if
reason
=~
/
\A
[A-Z]/
&&
!
reason
.
start_with?
(
*
whitelist
)
problem
<<-
EOS
.
undent
'
#{
first_word
}
' from the keg_only reason should be '
#{
first_word
.
downcase
}
'.
EOS
...
...
This diff is collapsed.
Click to expand it.
Library/Homebrew/test/dev-cmd/audit_spec.rb
+
63
−
0
View file @
e1ef3795
...
...
@@ -322,6 +322,69 @@ describe FormulaAuditor do
.
to
eq
([
"Don't recommend setuid in the caveats, suggest sudo instead."
])
end
describe
"#audit_keg_only_style"
do
specify
"keg_only_needs_downcasing"
do
fa
=
formula_auditor
"foo"
,
<<-
EOS
.
undent
,
strict:
true
class Foo < Formula
url "http://example.com/foo-1.0.tgz"
keg_only "Because why not"
end
EOS
fa
.
audit_keg_only_style
expect
(
fa
.
problems
)
.
to
eq
([
"'Because' from the keg_only reason should be 'because'.
\n
"
])
end
specify
"keg_only_redundant_period"
do
fa
=
formula_auditor
"foo"
,
<<-
EOS
.
undent
,
strict:
true
class Foo < Formula
url "http://example.com/foo-1.0.tgz"
keg_only "because this line ends in a period."
end
EOS
fa
.
audit_keg_only_style
expect
(
fa
.
problems
)
.
to
eq
([
"keg_only reason should not end with a period."
])
end
specify
"keg_only_handles_block_correctly"
do
fa
=
formula_auditor
"foo"
,
<<-
EOS
.
undent
,
strict:
true
class Foo < Formula
url "http://example.com/foo-1.0.tgz"
keg_only <<-EOF.undent
this line starts with a lowercase word.
This line does not but that shouldn't be a
problem
EOF
end
EOS
fa
.
audit_keg_only_style
expect
(
fa
.
problems
)
.
to
eq
([])
end
specify
"keg_only_handles_whitelist_correctly"
do
fa
=
formula_auditor
"foo"
,
<<-
EOS
.
undent
,
strict:
true
class Foo < Formula
url "http://example.com/foo-1.0.tgz"
keg_only "Apple ships foo in the CLT package"
end
EOS
fa
.
audit_keg_only_style
expect
(
fa
.
problems
)
.
to
eq
([])
end
end
describe
"#audit_homepage"
do
specify
"homepage URLs"
do
fa
=
formula_auditor
"foo"
,
<<-
EOS
.
undent
,
online:
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