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
c4a8b0c3
Unverified
Commit
c4a8b0c3
authored
5 years ago
by
Mike McQuaid
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #6425 from SMillerDev/bitbucket_audit
Audit bitbucket.com repositories
parents
d25a954d
8cb833f7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Library/Homebrew/dev-cmd/audit.rb
+38
-0
38 additions, 0 deletions
Library/Homebrew/dev-cmd/audit.rb
Library/Homebrew/test/dev-cmd/audit_spec.rb
+14
-0
14 additions, 0 deletions
Library/Homebrew/test/dev-cmd/audit_spec.rb
with
52 additions
and
0 deletions
Library/Homebrew/dev-cmd/audit.rb
+
38
−
0
View file @
c4a8b0c3
...
...
@@ -607,6 +607,44 @@ module Homebrew
new_formula_problem
"GitLab repository too new (<30 days old)"
end
def
audit_bitbucket_repository
user
,
repo
=
get_repo_data
(
%r{https?://bitbucket
\.
org/([^/]+)/([^/]+)/?.*}
)
return
if
user
.
nil?
api_url
=
"https://api.bitbucket.org/2.0/repositories/
#{
user
}
/
#{
repo
}
"
out
,
_
,
status
=
curl_output
(
"--request"
,
"GET"
,
api_url
)
return
unless
status
.
success?
metadata
=
JSON
.
parse
(
out
)
return
if
metadata
.
nil?
new_formula_problem
"Uses deprecated mercurial support in Bitbucket"
if
metadata
[
"scm"
]
==
"hg"
if
metadata
[
"parent"
][
"full_name"
]
==
"
#{
user
}
/
#{
repo
}
"
new_formula_problem
"Bitbucket fork (not canonical repository)"
end
if
Date
.
parse
(
metadata
[
"created_on"
])
>=
(
Date
.
today
-
30
)
new_formula_problem
"Bitbucket repository too new (<30 days old)"
end
forks_out
,
_
,
forks_status
=
curl_output
(
"--request"
,
"GET"
,
"
#{
api_url
}
/forks"
)
return
unless
forks_status
.
success?
watcher_out
,
_
,
watcher_status
=
curl_output
(
"--request"
,
"GET"
,
"
#{
api_url
}
/watchers"
)
return
unless
watcher_status
.
success?
forks_metadata
=
JSON
.
parse
(
forks_out
)
return
if
forks_metadata
.
nil?
watcher_metadata
=
JSON
.
parse
(
watcher_out
)
return
if
watcher_metadata
.
nil?
return
if
(
forks_metadata
[
"size"
]
<
30
)
&&
(
watcher_metadata
[
"size"
]
<
75
)
new_formula_problem
"Bitbucket repository not notable enough (<30 forks and <75 watchers)"
end
def
get_repo_data
(
regex
)
return
unless
@core_tap
return
unless
@online
...
...
This diff is collapsed.
Click to expand it.
Library/Homebrew/test/dev-cmd/audit_spec.rb
+
14
−
0
View file @
c4a8b0c3
...
...
@@ -239,6 +239,20 @@ module Homebrew
end
end
describe
"#audit_bitbucket_repository"
do
specify
"#audit_bitbucket_repository for stars, forks and creation date"
do
fa
=
formula_auditor
"foo"
,
<<~
RUBY
,
strict:
true
,
online:
true
class Foo < Formula
homepage "https://bitbucket.com/libtiff/libtiff"
url "https://brew.sh/foo-1.0.tgz"
end
RUBY
fa
.
audit_bitbucket_repository
expect
(
fa
.
problems
).
to
eq
([])
end
end
describe
"#audit_deps"
do
describe
"a dependency on a macOS-provided keg-only formula"
do
describe
"which is whitelisted"
do
...
...
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