330 Commits

Author SHA1 Message Date
Issy Long
60d93310af
rubocop: Drop "a" and "b" from Naming/MethodParameterName allowlist 2023-03-11 00:17:28 +00:00
Issy Long
e9d994622e
rubocop: Drop "f" from Naming/MethodParameterName allowlist
- This either stands for "file" but more often than not "formula".
2023-03-11 00:17:27 +00:00
Issy Long
188466d28e
rubocop: Drop "e" from Naming/MethodParameterName allowlist 2023-03-09 21:58:57 +00:00
Issy Long
f1ab720000
rubocop: Drop "c1" and "c2" from Naming/MethodParameterName allowlist 2023-03-09 21:54:37 +00:00
Issy Long
3a83b5492c
rubocop: Clean up Style/BlockDelimiters excludes and autofix offenses
- The defaults of using "do ... end" for multi-line blocks everywhere is
  good, better than switching everything to braces everywhere.
2023-03-08 23:54:22 +00:00
Issy Long
e1c455585b
rubocop: Reinstate TODO for Naming/MethodParameterName
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2023-03-08 14:42:59 +00:00
Issy Long
f52fbaf917
rubocop: Drop "ff" from Naming/MethodParameterName allowlist
- It seems that "ff" was short for plural formula, so formulae.
2023-03-08 14:42:58 +00:00
Issy Long
a3211f4d7f
rubocop: Drop "d" from Naming/MethodParameterName allowlist 2023-03-08 14:42:57 +00:00
Issy Long
e273c25be0
rubocop: Drop "p" from Naming/MethodParameterName allowlist
- It's used to refer to a patch, so use the long name.
2023-03-08 14:42:56 +00:00
Issy Long
0cd616bc66
rubocop: Drop "r" from Naming/MethodParameterName allowlist
- This stands for "resource" in our case, so use the long name.
2023-03-08 14:42:55 +00:00
Issy Long
89fb8c78e8
rubocop: Drop "s" from Naming/MethodParameterName allowlist
- Most usages of this were in the `pretty_duration` method, where "s"
  is better described as "seconds" since we're calculating a duration.
- I also took the executive decision to do the same to "m" which refers
  to "minutes".
2023-03-08 14:42:53 +00:00
Issy Long
87042c0237
rubocop: Drop "rb" from Naming/MethodParameterName allowlist
- It's entirely unused as a parameter name.
2023-03-08 14:40:57 +00:00
Issy Long
6d822d9a62
rubocop: Drop "fn" from Naming/MethodParameterName allowlist
- I originally thought this was short for "function", but upon closer
  inspection all its usages are to do with filenames. So, use "filename",
  it's clearer.
2023-03-08 14:40:56 +00:00
Issy Long
3e7a46f474
rubocop: Drop "v" from Naming/MethodParameterName allowlist
- This was an easy fix, "v" => "version".
2023-03-08 14:40:55 +00:00
Issy Long
23abe37234
rubocop: Trim Naming/MethodParameterName allowlist based on defaults
- These are already included in
  6136ffd91e/config/default.yml (L2834-L2862)
  upstream default allowed method names, so we don't need them here too.
- Practically this makes no difference since the `inherit_mode` is
  `merge` it'll just merge the two, but for tidiness I thought I'd do
  this anyway since the duplication annoyed me.
2023-03-08 14:40:54 +00:00
Mike McQuaid
b05bd61ddd
Merge pull request #14878 from issyl0/a-little-more-rubocop-tidying
rubocop: Trim exclude paths without offenses; move some more config
2023-03-06 12:36:10 +00:00
Issy Long
d2edc4d192
rubocop: Intentionally disable RSpec/{DescribeClass,StubbedMock}
- These had a lot of offenses that were marked as "try to enable".
- A lot of the "describe class" ones were for tests for cmds or dev-cmds,
  `brew typecheck` or `brew --env`, and the cop would only pass if I
  changed these "describe"s to `BrewTypecheck` or `Brew__Env` which
  seemed unhelpful.
- The usefulness of the stubbed mocks cop is
  [disputed](https://github.com/rubocop/rubocop-rspec/issues/ 1271), and
  fixing the offenses (not autocorrectable) would involve us doing a
  fair number of changes since changing `expect` to `allow` would then
  force us to make each of the affected tests have `expect` assertions
  at the end, where they sometimes don't currently.
2023-03-04 17:10:04 +00:00
Issy Long
6c10962d85
rubocop: Enable RSpec/MessageSpies with the "receive" style
- This matches the code we already have, rather than autocorrecting
  everything to `have_received`.
2023-03-04 17:10:03 +00:00
Issy Long
72a694d9cb
rubocop: Further alphabetization, M comes before N 2023-03-04 00:50:13 +00:00
Issy Long
f2e21d5c1e
rubocop: In-line disables for Style/{Class,Global}Vars
- Other occurrences of `@@` and `$` variables are individually disabled
  in-line in other files.
- So let's follow the same pattern for Homebrew/homebrew-cask developer
  scripts, since there are only a few.
2023-03-04 00:49:54 +00:00
Issy Long
87b94d9358
rubocop: Trim Style/BlockDelimiters exclude paths without offenses 2023-03-04 00:48:28 +00:00
Issy Long
0a18898425
rubocop: Move AllowedMethods inheritance to the cop it's used in
- `Include` and `Exclude` are ubiquitous but `AllowedMethods` less so.
- Move the inheritance to the single cop configuration that it's used
  in. Like we do with some other cop configs where they have default
  paths/settings that we want to add to, not replace.
2023-03-04 00:48:27 +00:00
Issy Long
61cb843cbb
Merge pull request #14871 from issyl0/rubocop-inline-disables
rubocop: Alphabetise, remove config that's default, in-line some disables
2023-03-03 12:10:14 +00:00
Issy Long
2091ef61fd
rubocop: The default Style/FormatStringToken style is "annotated" 2023-03-02 22:33:28 +00:00
Issy Long
46b946fd35
rubocop: Disable RSpec metrics cops
- We've disabled metrics cops for method length and complexity since we were
  fighting them a lot and the numbers were arbitrary and growing. It feels like
  these RSpec metrics numbers are arbitrary too.
2023-03-02 21:58:31 +00:00
Douglas Eichelberger
0384b82adc
Merge pull request #14826 from dduugg/no-open-struct
Enable Style/OpenStructUse cop
2023-03-02 12:30:28 -08:00
Douglas Eichelberger
965b19b30f Suggest fix 2023-03-01 07:16:24 -08:00
Issy Long
d16b241f4c
rubocop: Consolidate Style/BlockDelimiters config into one file 2023-03-01 11:46:54 +00:00
Issy Long
b1eaf8bbd2
rubocop: Move Style/DocumentationMethod into the other file 2023-03-01 00:02:22 +00:00
Douglas Eichelberger
719f1d6c6e Refactor some use of OpenStruct 2023-02-28 13:05:43 -08:00
Douglas Eichelberger
e6ddf8c958 Enable Style/OpenStructUse cop 2023-02-28 11:12:54 -08:00
Issy Long
a2b488cd10
Merge pull request #14818 from issyl0/rubocop-documentation
rubocop: Only enable `Style/Documentation` for `@api public` code
2023-02-28 13:47:13 +00:00
Mike McQuaid
0406279ad3
More Formula/Casks sharding fixes
- Stop `brew style` from complaining
- Fix message reference in `brew edit`
2023-02-28 11:52:38 +00:00
Issy Long
9ec74fea2a
rubocop: Reinstate taps ignore for Style/Documentation 2023-02-28 00:18:54 +00:00
Issy Long
27610e0a66
rubocop: Move Style/Documentation stanza
- This is better in the `Library/Homebrew/.rubocop.yml` since it's
  operating on files that are within that directory.
2023-02-28 00:18:53 +00:00
Issy Long
32e7268596
rubocop: Only enable Style/Documentation for @api public code
- Suggested in https://github.com/Homebrew/brew/pull/14709#issuecomment-1437461642.
- Found the public API paths with `git grep -l "@api public"`.
2023-02-28 00:10:06 +00:00
Douglas Eichelberger
769117f552 Collapse AllowedNames 2023-02-21 18:04:32 -08:00
Douglas Eichelberger
ed8363fd72 Consolidate some rubocop configurations 2023-02-21 16:50:29 -08:00
Mike McQuaid
7ac31f7d65
Merge pull request #14732 from dduugg/formula-cop-mixin
Refactor FormulaCop as an abstract class
2023-02-21 23:05:58 +00:00
Mike McQuaid
552902413a
rubocop.yml: disable more metrics.
Disable these in taps, too.
2023-02-21 16:31:43 +00:00
Douglas Eichelberger
d9db5e8825 Refactor FormulaCop as a mixin 2023-02-20 18:14:47 -08:00
Mike McQuaid
4eaaa867de
Merge pull request #14709 from issyl0/rubocop-tidying
rubocop: Some more config cleanup
2023-02-20 19:35:36 +00:00
Mike McQuaid
aaec4014fd
Merge pull request #14710 from issyl0/rubocop-excludes
rubocop: Clean up some `Exclude`s
2023-02-20 09:51:11 +00:00
Issy Long
18becae15a
rubocop: Clean up Lint/RequireRelativeSelfPath config
- The Actions logs link for the Homebrew/formula-analytics CI failure is long expired.
- I removed the excludes, ran `brew tap homebrew/formula-analytics` and then
  `brew style $(brew --repo homebrew/formula-analytics)` and there were no
  errors.
- Hence, I think we can clean this stanza up entirely.
2023-02-19 16:33:31 +00:00
Issy Long
4a8384e8a8
rubocop: In-line disables of Lint/ConstantDefinitionInBlock 2023-02-19 16:33:22 +00:00
Issy Long
6797f30bbf
rubocop: In-line disables of Naming/MemoizedInstanceVariableName 2023-02-19 16:33:21 +00:00
Issy Long
364c3462b7
rubocop: Naming/PredicateName allows is_a? by default
https://github.com/rubocop/rubocop/blob/master/lib/rubocop/cop/naming/predicate_name.rb#L16
2023-02-19 16:14:14 +00:00
Issy Long
8399c58d23
rubocop: Clean up non-existent files/dirs from excludes 2023-02-19 15:53:21 +00:00
Douglas Eichelberger
7fbbf27f8d Remove redundant rubocop configs 2023-02-18 15:14:04 -08:00
Douglas Eichelberger
a57764e4d6 Disable FormulaCop 2023-02-16 15:51:20 -08:00