758 Commits

Author SHA1 Message Date
Issy Long
9cc046bc60
rubocops/cask: Enforce the use of on_{system} blocks
- As discussed in
  https://github.com/Homebrew/brew/pull/14976#issuecomment-1474544569
  and further comments, this is needed because in order to enforce the
  order of `on_{arch,system}` blocks we need to have everything
  consistently within one of those blocks.
- We previously allowed overrides where the top-level `version` stanza
  would be the default, unless on an OS that had an `on_system` block
  with a `version` specified. But this breaks down when we try to order
  the `on_system` blocks because if a `url` at the top-level has a
  `version` interpolated in it, then the `version` stanza needs to be
  above the `url` stanza. But it could be that `version` is OS-specific.
- Let's stop allowing overrides and require that everything be in an
  `on_system` block. This will make it easier to enforce the order of
  `on_system` blocks in a future PR (14976).
2023-03-21 22:51:12 +00:00
Markus Reiter
3c89f99df1
Fix toplevel_stanzas. 2023-03-21 14:43:59 +01:00
Douglas Eichelberger
cc5b013cb9 Remove compatibility layer 2023-03-14 14:49:34 -07:00
Issy Long
f1ab720000
rubocop: Drop "c1" and "c2" from Naming/MethodParameterName allowlist 2023-03-09 21:54:37 +00:00
Mike McQuaid
9e370b0a3d
Merge pull request #14847 from dduugg/no-to_sentence
Move Array#to_sentence monkey-patch from ActiveSupport to extend/
2023-03-06 12:37:02 +00:00
Issy Long
2aeeaf706e
Merge pull request #14891 from issyl0/cask-rubocops-unnecessary-requires 2023-03-06 12:23:49 +00:00
Issy Long
1d65c942c3
rubocops/cask: Clean up unnecessary requires
- I suspect these were copy-pasted from other cops, like I did in
  https://github.com/Homebrew/brew/pull/14886#discussion_r1125569999.
- The "forwardable" require is unnecesary if the cop doesn't
  `extend Forwardable` and use `def_delegator`.
- The "uri" require is unnecessary if the cop doesn't call `URI` methods.
2023-03-05 17:13:46 +00:00
Issy Long
4e067565dd
rubocops/cask/url: Fix test expectations; regexp for starts_with? 2023-03-05 16:55:47 +00:00
Issy Long
4791224acf
rubocops/cask/url: Remove unnecessary require "forwardable" 2023-03-05 16:38:10 +00:00
Issy Long
f4a0bc7af3
rubocops/cask: Appease Sorbet with the correct inheritance
- The `on_url_stanza` method is now used in two cops, `Url` and
  `UrlLegacyCommaSeparators`. Make the latter inherit from the former
  to make Sorbet happy.
- The style and typecheck checks now pass fine.
2023-03-05 16:33:11 +00:00
Issy Long
79db987215
rubocops/cask: Disallow protocol in cask URL verified stanza
- Apparently the "verified" parameter in the URL (present when a Cask's
  download URL is not the same as its homepage) shouldn't have the
  protocol (`https`, `http`) at the front.
- Removing this has happened manually in the past, so here's an
  autocorrecting RuboCop for it.
2023-03-04 23:00:04 +00:00
Douglas Eichelberger
e94d3767e6 Add rails license 2023-03-03 12:44:23 -08:00
Douglas Eichelberger
317874c394 Fix type error 2023-03-03 12:44:23 -08:00
Douglas Eichelberger
e68b02c4a6 Move tests and requires 2023-03-03 12:44:23 -08:00
Douglas Eichelberger
ecfceb3fee Revert Utils implementation 2023-03-03 12:44:23 -08:00
Douglas Eichelberger
b8ddecf322 Fix type error 2023-03-03 12:44:22 -08:00
Douglas Eichelberger
d8d4d2031e Isolate to allow rubocop access 2023-03-03 12:44:22 -08:00
Douglas Eichelberger
91ad24b876 Remove Array#to_sentence monkey-patch 2023-03-03 12:44:22 -08:00
Douglas Eichelberger
ef2baee799 disable false positive 2023-03-02 11:49:09 -08:00
Douglas Eichelberger
71402a9a41 Disable false positive violation 2023-03-02 11:49:09 -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
Douglas Eichelberger
bd5a7f6a14
Update formula_cop.rb 2023-02-21 09:52:20 -08:00
Douglas Eichelberger
387d2f859f Use exclude_from_registry instead 2023-02-20 18:14:47 -08:00
Douglas Eichelberger
d9db5e8825 Refactor FormulaCop as a mixin 2023-02-20 18:14:47 -08:00
Issy Long
298bb65dfb
rubocop: Entirely disable Metrics cops
- These are arbitrary length limits that had a load of disables in code.
- The limits were only increasing over time rather than decreasing.
- Fixing the problematic code to be shorter would take a long time for
  questionable gain since the problem has been around so long.
2023-02-21 00:34:17 +00:00
Douglas Eichelberger
a57764e4d6 Disable FormulaCop 2023-02-16 15:51:20 -08:00
Douglas Eichelberger
6c93f6fe91 Enable typing in rubocops 2023-02-16 15:51:20 -08:00
Mike McQuaid
6b4363092d
Revert "Merge pull request #14548 from Homebrew/revert-14382-deprecate-disable-remove"
This reverts commit 932d2cf3b77c9439a57b6a43577fc8d3b6399a62, reversing
changes made to f4e60482791d2ff628efadfdbf0d14d9237d2d29.
2023-02-07 19:25:51 +01:00
Mike McQuaid
6882ac17e7
Revert "Add deprecations and disables" 2023-02-07 15:13:19 +01:00
Mike McQuaid
3c7adc91ac
Merge branch 'deprecate-ignore_missing_libraries' into deprecate-disable-remove 2023-02-03 10:49:54 +00:00
Mike McQuaid
34b1cc2218
Merge pull request #14458 from dduugg/rm-string-extension
Remove redundant String extension
2023-01-31 11:55:43 +00:00
Douglas Eichelberger
e98e668a34 remove redundant string extension 2023-01-28 08:26:11 -08:00
Douglas Eichelberger
220becda96 remove undent 🐵-patch 2023-01-27 22:55:38 -08:00
Carlo Cabrera
f576140ade
Remove Rubocop for ignore_missing_libraries
This is no longer needed.
2023-01-26 13:48:06 +08:00
Mike McQuaid
d984ce06f2
Improve Codespaces behaviour
- ensure that homebrew/core is always tapped
- make RuboCop stop complaining about permissions
2023-01-25 16:05:02 +00:00
Carlo Cabrera
86161e8c32
Fix test failures 2023-01-24 14:19:28 +08:00
Carlo Cabrera
8c5e6e10a7
rubocops/lines: update hard-coded compiler check
1. `llvm-g{cc,++}` has been gone for a long time. We don't need to check
   for this anymore.
2. Also check for calling the compiler as `cc`, `c89`, `c99`, or `c++`.
2023-01-24 14:04:51 +08:00
Sam Ford
a1993b9086
rubocops/caveats: Disallow ANSI escape codes
Formula caveats text appears on formulae.brew.sh but escape
characters, as used in ANSI escape codes, should not appear in HTML.
This commit adds a RuboCop to disallow escape characters in the
caveats text.
2023-01-16 01:30:19 -05:00
Douglas Eichelberger
8cf35cff95
Delete lines.rbi 2023-01-12 16:30:47 -08:00
Rylan Polster
d316819f0c
Add tests 2022-12-28 16:10:26 -05:00
Rylan Polster
3556e756fc
Check casks for macOS version conditionals 2022-12-28 16:10:26 -05:00
Rylan Polster
e08d4f9f31
Check for loose MacOS.version method calls 2022-12-28 16:10:26 -05:00
Rylan Polster
a504d2c1aa
Check for loose Hardware::CPU method calls 2022-12-28 16:10:26 -05:00
Mike McQuaid
e71d1e2dd4
rubocop/lines: cleanup weird interpolation. 2022-12-13 11:37:05 +00:00
Bo Anderson
917a1e7bff
rubocops/shell_commands: fix missing require 2022-12-13 11:37:05 +00:00
apainintheneck
c477b9aab3 Cleanup after adding os specific rubocop
- Change name of rubocop warning
- Disable linting on remaining offending lines
- Add todos to move lines with disabled linting
  checks to extend/os in the future
2022-11-29 23:13:50 -08:00
apainintheneck
c7d53a2d9c Add cop to police os checks
The methods `OS.linux?` and `OS.mac?` should only be used
in `extend/os` and this cop makes sure of that.
2022-11-19 22:01:13 -08:00
razamatan
e7f723e543 uses_from_macos: add mandoc to allowed list
- see https://github.com/Homebrew/homebrew-core/pull/115411
2022-11-10 21:56:23 -08:00
Bo Anderson
6ede5d2dd5
rubocops: handle empty formula body in various cops 2022-11-05 04:40:16 +00:00