851 Commits

Author SHA1 Message Date
Michael Cho
747e95b159
rubocops/resource_requires_dependencies: check sym_type?
Avoid running `#value` on unsupported types by selecting only symbol
nodes as we only care about `:build` value.

Signed-off-by: Michael Cho <michael@michaelcho.dev>
2024-04-05 10:23:02 -04:00
Michael Cho
a7e5e7b8e8
rubocops/resource_requires_dependencies: allow lxml build resource
Specifically, a `lxml` build resource can depend on build-only `libxml2`
and `libxslt`; however, these were not detected in previous audit since
the dependency would be a hash.

Also change message if Linux-only formula.

These changes are both needed for `systemd`.

Signed-off-by: Michael Cho <michael@michaelcho.dev>
2024-04-04 19:53:13 -04:00
Sam Ford
b3ab410215
rubocops/livecheck: Rework LivecheckUrlProvided
The existing `LivecheckUrlProvided` RuboCop requires a `url` for all
`livecheck` blocks except those using `skip`, `formula`, or `cask`,
as those only appear in a `livecheck` block with no other DSL methods.

We now have a `throttle` method that can be used alongside other DSL
methods (e.g., `url`, `regex`, `strategy`) or by itself. `brew style`
currently fails when `throttle` is used by itself, so this reworks
the conditions to allow this usage.
2024-03-21 15:53:25 -04:00
Mike McQuaid
795642ea97
rubocops/service: allow require_root to be used without run.
Fixes https://github.com/Homebrew/brew/issues/16908
2024-03-19 08:46:47 +00:00
Mike McQuaid
ea2892f8ee
brew.rb: handle missing args. 2024-03-07 16:20:20 +00:00
Issy Long
f4218a6316
Fix RuboCop Performance/MapCompact offenses
- Rename an iterator variable since it would make the line too long.
2024-02-25 22:59:59 +00:00
Mike McQuaid
b8243d0e9e
Merge pull request #16717 from jesboat/fix-chmod-message2
[brew audit] fix "Incorrect file permissions" message
2024-02-22 08:51:52 +00:00
Issy Long
ff21ef0955
It helps if you actually require the new cop to run it on real code 2024-02-20 23:49:25 +00:00
Issy Long
3bfe7e5aa1
Handle nil resource args for some reason
- Ran this against `signal-cli` and despite it having a valid-looking resource block, it failed on `undefined method 'str_content' for nil:NilClass`.
2024-02-20 23:48:58 +00:00
Issy Long
5c7be57531
Appease Sorbet 2024-02-20 23:36:52 +00:00
Issy Long
a895496982
rubocop: The pyyaml resource requires depends_on "libyaml" 2024-02-20 23:22:15 +00:00
Jade Elizabeth Sailor
94aeabfc8a [brew audit] fix "Incorrect file permissions" message
When the file isn't world-readable, `brew audit` prints a failure
message including a suggestion to `chmod +r` the file. Unfortunately,
this isn't quite right: with both macOS and coreutils, leaving out the
"who" in a chmod only affects bits which would be set in the umask. So,
if the umask doesn't allow world-readable (which might be why the file
wasn't world-readable in the first place), the suggested chmod command
does nothing.

Change to print `chmod a+r` instead; that does have the intended effect.

No other `chmod` suggestions in this file have the same problem.
2024-02-20 16:26:21 -05:00
Issy Long
ff23de4766
Formatting and cope with more modern RSpec config changes
Co-authored-by: Ruoyu Zhong <zhongruoyu@outlook.com>
2024-02-20 12:17:27 +00:00
Issy Long
33c33b5338
rubocop: Formulae with the "lxml" resource have required dependencies
- We're moving from `depends_on "python-lxml"` to `resource "lxml" ...` as part
  of the new Python vendoring plan.
- For `resource "lxml"` to work, `uses_from_macos "libxml2"` and
  `uses_from_macos "libxslt"` are needed in the formulae.
- This new RuboCop rule enforces that a formula including the "lxml" resource
  also include those dependencies.
2024-02-19 22:50:55 +00:00
Douglas Eichelberger
aab04229d1 Code review fixes 2024-02-11 20:27:39 -08:00
Douglas Eichelberger
c83e0170a9 Fix cask_help rbi 2024-02-11 20:27:38 -08:00
Douglas Eichelberger
b010e397d6 Add extend/node.rbi, remove unused methods 2024-02-11 20:27:38 -08:00
Douglas Eichelberger
b2dc842238 wip 2024-02-11 20:27:38 -08:00
Bevan Kay
bbebd3deec
Update shared_filelist_glob.rb
Co-authored-by: Kevin <apainintheneck@gmail.com>
2024-02-08 07:03:51 +00:00
Bevan Kay
60914a3f4f
rubocops/cask: fix style 2024-02-05 08:58:03 +01:00
Bevan Kay
2b60576165
rubocops/cask: add a cop for specific numbered shared file list files 2024-02-04 14:13:06 +01:00
Douglas Eichelberger
3a27cac7df
Merge pull request #16510 from dduugg/inverse-include-exclude-cop
Vendor remaining Rails cops, remove ActiveSupport
2024-01-30 11:59:10 -08:00
Razvan Azamfirei
9aabe1ba91
rubocop: preserve comments when ordering uninstall methods 2024-01-28 07:08:48 -05:00
Razvan Azamfirei
db72295c20
rubocop: order uninstall methods 2024-01-28 07:08:47 -05:00
Douglas Eichelberger
ae249ec282 Vendor InverseMethods cop 2024-01-26 15:03:59 -08:00
Douglas Eichelberger
0caaa1fa36 Vendor SafeNavigationWithBlank cop 2024-01-26 15:03:59 -08:00
Douglas Eichelberger
665bda0fbd Vendor Presence cop 2024-01-26 15:03:59 -08:00
Douglas Eichelberger
f99d39faf9 Vendor CompactBlank cop 2024-01-26 15:03:59 -08:00
Douglas Eichelberger
9d081a67cc Replace Rails/NegateInclude with Inverse/Invertible cops 2024-01-26 12:27:50 -08:00
Douglas Eichelberger
8c832e0905 Remove some fixed FIXMEs 2024-01-26 12:00:13 -08:00
Issy Long
a6b8a795b4
Merge pull request #16365 from issyl0/rubocop-cask-zap-arrays-alphabetical
Add a new RuboCop for alphabetizing `zap trash` array elements
2024-01-24 21:34:18 +00:00
Issy Long
693a27d48b
Treat zap and uninstall the same
- Since `zap` can have more than just `trash`.
2024-01-21 19:48:30 +00:00
Issy Long
d5f9eef1b5
Empty line after guard clause, gah 2024-01-21 12:47:33 +00:00
Issy Long
458844af44
Move multi-line comments with the code they're 'attached' to
Co-authored-by: Bevan J. Kay <email@bevankay.me>
2024-01-21 12:42:22 +00:00
Issy Long
eec7a96fbe
Use Ruby 3.1's intersect\? method 2024-01-20 00:38:34 +00:00
Issy Long
e9bcb64000
Double quotes not single 2024-01-20 00:35:40 +00:00
Bevan J. Kay
779f1bba7d
Move comments in tandem with the lines they belong to 2024-01-20 00:03:34 +00:00
Douglas Eichelberger
8e9d294df2 Add File.atomic_write to extend/ 2024-01-19 13:36:16 -08:00
Issy Long
c63723bd7d
Merge pull request #16501 from issyl0/rubocop-new-rules-style-redundant-freeze
Fix RuboCop `Style/RedundantFreeze` offenses
2024-01-19 15:05:08 +00:00
Issy Long
f682147598
Fix RuboCop Style/RedundantFreeze offenses 2024-01-18 22:20:01 +00:00
Issy Long
0e27dc2564
Fix RuboCop Style/ArrayIntersect offenses 2024-01-18 14:11:43 +00:00
Issy Long
dae9b0cd53
very wip and bad comment handling 2024-01-18 12:53:23 +00:00
Issy Long
338e30ff9b
There are more arrays that contain non-alphabetizeable commands 2024-01-14 20:55:51 +00:00
Issy Long
6a1cb62b42
Appease RuboCop 2024-01-14 20:55:22 +00:00
Michael Cho
b4657e1eef
rubocops/components_redundancy: stable/head block removal
When a `stable do` or `head do` block only contains `url`, `sha256`,
`mirror`, and/or `version`, then the block should be removed.
2024-01-12 19:07:10 -05:00
Patrick Linnane
3fdba532a2
various: fix miscellaneous typos
Signed-off-by: Patrick Linnane <patrick@linnane.io>
2024-01-12 10:56:49 -08:00
Issy Long
9070f6d829
Check uninstall too, avoiding arrays containing commands 2024-01-02 23:31:13 +00:00
Michael Cho
2f3f017a6e
rubocops/uses_from_macos: audit when depends_on :linux 2023-12-30 18:30:05 -05:00
Douglas Eichelberger
caf8259ae6 Code review changes 2023-12-27 15:29:33 -08:00
Douglas Eichelberger
3abbf4447e Some minor regexp match perf improvements 2023-12-27 13:16:36 -08:00