568 Commits

Author SHA1 Message Date
Rylan Polster
0faf17b1e6 use safe_popen_read instead of popen_read
RuboCop requires using Utils.safe_popen_read and Utils.safe_popen_write
instead of Utils.popen_read and Utils.popen_write respectively.

Using the "safe" version means that an error will be shown if the
command fails. Previously, when using `popen_read`, a failed command can
go unnoticed and have negative consequences that go undetected (as
happened for pipend in
https://github.com/Homebrew/homebrew-core/pull/55682)

RuboCop does not require Utils.safe_popen_read in a test do block
because there can be some legitimate uses for Utils.popen_read in these
cases.
2020-06-23 13:57:33 -04:00
Dario Vladovic
8a62f891e1
formula: add std_cargo_args 2020-06-22 14:39:49 +02:00
Michka Popoff
7b25b99995 uses_from_macos: allow ed 2020-06-15 23:50:54 +02:00
Issy Long
0041ea21f5
Change occurrences of "whitelist" to "allowlist" 2020-06-06 22:38:32 +01:00
Michka Popoff
c494528f15 on_os_blocks: add audit 2020-06-04 17:36:28 +02:00
Mike McQuaid
aa81982aba
brew style --fix 2020-06-02 09:49:23 +01:00
nandahkrishna
6f37dc4c41
livecheck: modified urls cop 2020-05-24 20:16:44 +05:30
Mike McQuaid
ca47992a6c
Fix rubocop-performance brew style. 2020-05-22 08:52:26 +01:00
Mathäus Zingerle
bb9665ced8 Migrate scheme checks for cvs, bzr, hg, fossil, and svn+http to Rubocop 2020-05-20 20:52:00 -05:00
Mathäus Zingerle
82ba0475ad audit: Port version checks that do not rely on Formula state to RuboCop and add tests 2020-05-18 10:12:13 -05:00
nandahkrishna
a4f9a66406
livecheck: add component order rubocop 2020-05-15 19:00:14 +05:30
Mike McQuaid
12bdb38663
rubocop: brew style --fix autocorrections. 2020-05-12 08:32:27 +01:00
vidusheeamoli
f851688541 audit: Port audit_keg_only to rubocop and add tests
audit: add test

audit: fixed test

audit: added another test case

audit: fix test

audit: fix test

audit: fix keg only
2020-05-05 10:47:49 +05:30
Mike McQuaid
e6dffdd006
Merge pull request #7458 from Bo98/uses_since
software_spec: add uses_from_macos since bound
2020-05-01 12:53:59 +01:00
Luke Lau
0500dd572c rubocops/urls: whitelist ghc@8.8 2020-04-30 15:05:14 +01:00
Bo Anderson
eb303dd654 software_spec: add uses_from_macos since bound 2020-04-28 16:45:32 +01:00
Shaun Jackman
ffb405019d uses_from_macos: Add gzip rsync to the white list
/usr/bin/gzip and /usr/bin/rsync are provided by macOS.
2020-04-20 11:52:58 -07:00
Mike McQuaid
cddc67b451
rubocops/uses_from_macos: update list.
Also, provide details on how to update this in future and split it into
two.

Fixes #7396
2020-04-20 10:36:42 +01:00
Mike McQuaid
8eed72cd8b
Move file mode audit to RuboCop. 2020-04-18 15:44:24 +01:00
Jonathan Chang
d6cf14fd1e audit: add libiconv to uses_from_macos whitelist
This lives at /usr/lib/libiconv.dylib
2020-04-18 21:39:39 +10:00
Mike McQuaid
604434566f
rubocops/text: whitelist goose. 2020-04-14 11:59:56 +01:00
Mike McQuaid
3b9a8cb8c1
rubocops/lines: fix rule.
This stops stuff like `clang=1` from being matched incorrectly.
2020-04-14 11:59:41 +01:00
Mike McQuaid
d52e870b07
rubocop: remove NewFormulaAudit.
This is no longer used anywhere.
2020-04-13 16:01:26 +01:00
Mike McQuaid
44c22dd7e3
rubocops/text: re-add strict cop. 2020-04-13 16:01:26 +01:00
Mike McQuaid
632813d969
rubocops/patches: reduce required revision length. 2020-04-13 16:01:26 +01:00
Mike McQuaid
ea77fce409
rubocops/lines: move strict cop. 2020-04-13 16:01:25 +01:00
Mike McQuaid
9b5a0767cb
rubocops/formula_desc: merge cops, slim whitelist. 2020-04-13 16:01:25 +01:00
Mike McQuaid
476a61f51c
rubocops/class: rename, move cops, readd strict. 2020-04-13 16:01:25 +01:00
Mike McQuaid
b75733f1bd
rubocops: downgrade strict cops (passing in core). 2020-04-12 14:17:06 +01:00
Mike McQuaid
45908d8ff2
uses_from_macos: update openssl in whitelist. 2020-04-12 14:17:05 +01:00
Mike McQuaid
fbeeae96ef
rubocops/text: check openssl and openssl@1.1. 2020-04-12 14:17:05 +01:00
Mike McQuaid
3ded55aec2
rubocops/options: refactor unless ==. 2020-04-12 14:17:05 +01:00
Mike McQuaid
20998ed6e3
rubocop/lines: extract whitelist to constant. 2020-04-12 14:17:05 +01:00
Mike McQuaid
2e74e50f82
rubocop/conflicts: use full name in whitelist. 2020-04-12 14:17:05 +01:00
Mike McQuaid
c5b8983da4
rubocops/class: refactor unless && 2020-04-12 14:17:04 +01:00
Sean Molenaar
84181f2068
Audit: allow make check for nettle 2020-04-08 19:08:15 +02:00
Alexander Bayandin
1b18a01779
Library/Homebrew/rubocops/uses_from_macos: add ssh-copy-id 2020-04-07 15:04:23 +01:00
Mike McQuaid
bd082011c2
Merge pull request #7280 from issyl0/audit-uses-from-macos
audit: Check if `uses_from_macos` usage is correct
2020-04-07 12:47:30 +01:00
Mike McQuaid
4dd70048d6
rubocops/uses_from_macos: tweak whitelist. 2020-04-07 12:16:17 +01:00
Dario Vladovic
3a21ca8956
Implement mdimporter cask stanza 2020-04-06 15:24:14 +02:00
Issy Long
857393ccfb
Audit correct uses_from_macos usage with RuboCop
- This builds on @jonchang's work that started in #6265.
- We now use `uses_from_macos` to declare dependencies that are implicit
  on macOS because they ship with macOS, but they're needed on Linux. We
  have to be sure that the dependencies people specify as
  `uses_from_macos` are actually shipped with macOS. So, we maintain a
  safelist of those dependencies and check against it.
- Also add more legitimate `uses_from_macos` dependencies to the list.
- This is runnable with `brew audit --only-cops=FormulaAudit/UsesFromMacos`.
- It produces different number of failures on macOS vs. Linux, because
  apparently we've not synced Homebrew/linuxbrew-core upstream thoroughly
  enough yet.
- Originally this was designed as a `--strict` audit, but we flipped it
  to be a normal audit because - to quote Mike - this is "sufficiently
  robust" now.
2020-04-06 13:42:27 +01:00
Mike McQuaid
37a79498a0
rubocops/urls: whitelist cspice.
As explained in https://github.com/Homebrew/brew/pull/7256#issuecomment-607787949
2020-04-03 13:53:03 +01:00
Mike McQuaid
ddaf467741
rubocops/urls: reorder for quicker scanning. 2020-04-03 13:52:44 +01:00
Mike McQuaid
9da6c9b521
rubocops/urls: stricter binary URL requirements.
Don't rely on x86_64 detection but instead whitelist the few projects
that fun afoul of these regex.
2020-04-02 09:54:14 +01:00
Alexander Bayandin
b37c3e9cb2 rubocops/patches: suggest url with full_index=1 2020-03-15 11:24:38 +00:00
Mike McQuaid
1e265247ca
rubocop: apply autofixes. 2020-03-13 21:16:18 +00:00
Issy Long
9f80a7bce2
rubocops/patches: Make more GitHub patch locations enforce revisions
- We recently deleted a load of old Homebrew/formula-patches patches for
  non-existent core formulae
  (https://github.com/Homebrew/formula-patches/pull/283). This is a good
  action to take. Users should always be able to retrieve the patch once
  it's been deleted from the repo, if the formula they continue to use
  specifies a git revision to pull from, not just `master`.
- The code to detect `master` formulae was already here, so this adds
  another GitHub host to the detection: `raw.githubusercontent.com` as
  that's what the current patches that use `master`
  (https://github.com/Homebrew/homebrew-core/pull/51329) link to.
- Fixes https://github.com/Homebrew/homebrew-core/issues/51313.
2020-03-08 20:21:43 +00:00
Bo Anderson
79811537fb rubocop/urls: add go@1.13 to binary URLs whitelist 2020-02-26 09:26:49 +00:00
EricFromCanada
29006396dd audit: check apache.org URLs 2020-02-24 13:07:46 -05:00
Mike McQuaid
ba52e7f932
rubocop/urls: remove deleted ghc@8.2. 2020-02-24 11:40:46 +00:00