144 Commits

Author SHA1 Message Date
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
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
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
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
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
Issy Long
fb124f92ed
Ignore non-zap trash methods 2023-12-22 00:41:56 +00:00
Issy Long
b9f13fc35d
Better detection and replacement of non-alphabetized arrays
- Use `sort_by` to sort the array, rather than comparing each element
  to the next.
- This doesn't error with complaints about clobbering at all when run on
  `homebrew/cask`, hurray. And it also handles interpolations correctly,
  rather than ignoring them.

Co-authored-by: Bevan Kay <email@bevankay.me>
2023-12-22 00:26:38 +00:00
Issy Long
f4754baa00
Ignore zap trash stanzas with interpolation
- Interpolating the version into a path is a common pattern, but the interpolations
  trip up the alphabetization autocorrect quite spectacularly, so let's
  ignore them (for now?).
2023-12-22 00:19:03 +00:00
Mike McQuaid
a21b2dc833
rubocops/cask/on_system_conditionals: allow blocks.
Without this, there's an infinite loop on `brew style --fix` if you have
a `if Hardware::CPU.arm?` in a `postflight` block where it will change
back and forward between `if` and `on_os` syntax forever.
2023-12-21 10:00:46 +00:00
Issy Long
73b3ace77c
Apparently N is alphabetically before c; downcase the comparison 2023-12-21 01:25:18 +00:00
Rylan Polster
841a0623c6
Don't have a comment saying to remove this cop 2023-12-19 20:47:20 -05:00
Issy Long
8cf58e36e6
Add a new RuboCop for alphabetizing zap trash array elements
- Part of issue 16323.
- Previously this was being done manually by Cask maintainers.
- While we're here, enforce that the `zap trash` path is not in `[]` if
  it only contains a single element.
- This is buggy on actual Casks, hence the draft PR.
2023-12-19 23:42:08 +00:00
Rylan Polster
8d8cd23414
Add rubocop to enforce deprecate! over discontinued 2023-12-17 16:49:53 -05:00
Rylan Polster
53c1e6ecdb
Add deprecate! and disable! to cask stanza order 2023-12-16 20:01:47 -05:00
Mike McQuaid
04866b6e39
Merge pull request #15392 from reitermarkus/remove-rubocop
Remove `NoDslVersion` cop.
2023-05-10 13:13:35 +01:00
Markus Reiter
46b9dba03c
Remove NoDslVersion cop. 2023-05-10 01:02:42 +02:00
Markus Reiter
f7168bf234
Merge pull request #15336 from reitermarkus/version-head-null
Merge `HeadVersion` and `NullVersion` into `Version`.
2023-05-10 01:01:21 +02:00
Markus Reiter
8274920217
Rename OS::Mac::Version to MacOSVersion. 2023-05-09 05:08:38 +02:00
Markus Reiter
02dbeb62fc
Refactor RuboCop tests. 2023-05-09 04:28:25 +02:00
Markus Reiter
1df501b0ac
Tweak tests. 2023-05-07 10:04:28 +02:00
Markus Reiter
ce8788e5bc
Fix code style. 2023-05-07 08:34:13 +02:00
Markus Reiter
81fdb3716e
Implement StanzaOrder cop using on_cask_stanza_block. 2023-05-07 08:30:29 +02:00
Markus Reiter
2dea4f2370
Add on_cask_stanza_block. 2023-05-07 08:30:08 +02:00
Issy Long
8035d46dfe
very wip but reimagined
- Thanks to Markus on Slack for saying "the cop should only apply to the
  content of the blocks, or more specifically only to stanzas that are
  direct children of cask or on_* blocks", which made me realize that
  I was overcomplicating things.
2023-05-07 08:30:08 +02:00
Issy Long
a493787125
Regressed a bit, but at least it's not clobbering anymore? 2023-05-07 08:29:31 +02:00
Issy Long
704482d815
wip a test for ordering of both on_* blocks and their contents
- This is very broken, "detected clobbering" errors.
2023-05-07 08:29:31 +02:00
Issy Long
40bc235cb6
Simplify offending_stanzas method - pass sorted_stanzas in directly
- Otherwise we're doing the same "if inner" check twice, for no gain.
2023-05-07 08:29:30 +02:00
Issy Long
9457a23430
Extract methods for checking for on_* blocks and their contents
- The same code to do the same thing was getting a bit repetitive in
  `Cask/StanzaOrder`, `Cask/StanzaGrouping` and `Cask/NoOverrides`
  cops.
2023-05-07 08:29:30 +02:00
Issy Long
bd6e9e72a1
rubocops/cask: Check for correct stanza ordering within on_* blocks
- Now that we detect correct stanza _grouping_ within `on_*` blocks in
  Casks (PR 15211), correct stanza _ordering_ in `on_*` blocks was the
  next logical step. For example, `url` has to come after `version` and
  `sha256` in an `on_macos` or `on_intel` block for consistency with the
  top-level stanza order we enforce elsewhere.
- Still not doing the nested `on_os` inside `on_arch`, that felt
  excessive for an edge case that isn't present in any actual real
  Casks we have. I removed the test with that specific TODO.
2023-05-07 08:27:43 +02:00
Douglas Eichelberger
08af78a2a5 brew style --fix 2023-04-25 09:26:24 -07:00
Douglas Eichelberger
24cf6076e8 brew style --fix 2023-04-24 20:42:39 -07:00
Issy Long
6de61e4994
Ensure that stanza grouping works for nested stanzas with comments
- Since moving `comments_hash` to `Stanza`, we've been using the wrong
  kind of "comments": the comments for the _stanza_, not the comments
  for the entire Cask.
- Add a test to ensure this actually works. There was previously an
  infinite loop here due to the bad `comments`, visible in a `StanzaOrder`
  cop test, which I speculatively added a failing test for. Turns out
  that supporting nested stanza _ordering_ (vs. just grouping) is a
  whole separate piece of work (there are multiple TODOs there already),
  so I've backed that out and will do that separately.
2023-04-13 15:59:18 +01:00
Markus Reiter
8b9ee05118
Cache Stanza#comments. 2023-04-12 23:08:49 +02:00