134 Commits

Author SHA1 Message Date
Eric Knibbe
cd6777fc73
audits: quote and reword problem description text 2025-05-30 23:49:26 -04:00
Heath Stewart
42caf20fa4
Add PowerShell (pwsh) completion support
Resolves #19403
2025-03-02 18:17:38 -08:00
Nanda H Krishna
cf0b00a05c
rubocop/lines: prefer assert_path_exists and refute_path_exists 2025-02-18 10:52:32 -05:00
Patrick Linnane
797ccdd11c
brew style --fix
Signed-off-by: Patrick Linnane <patrick@linnane.io>
2025-02-12 21:49:12 -08:00
BrewTestBot
a82bd70ff6
sorbet: Autobump sigils via Spoom
Autogenerated by the [sorbet](https://github.com/Homebrew/brew/blob/master/.github/workflows/sorbet.yml) workflow.
2025-02-12 21:49:06 -08:00
Issy Long
bb56089fe7
Merge pull request #19277 from Homebrew/rm-old-todo
rubocops/lines: Clean up an old TODO
2025-02-11 11:00:03 +00:00
Issy Long
9359292db0
Retain the mis-ordered dependency case.
Co-authored-by: Carlo Cabrera <github@carlo.cab>
2025-02-11 10:28:52 +00:00
Issy Long
d9b376a9cd
rubocops/lines: Clean up an old TODO
- I considered writing a cop for this, but it's not worth it:
  there are no `[:test, :build]` occurrences in Core and this
  Rust rule only applies in Core formulae.
2025-02-09 18:33:27 +00:00
Issy Long
0fc1eb534b
More Sorbet typed: strict RuboCops
- Some of these I bumped to `typed: strict`, some of them I added
  intermediary type signatures to some of the methods to make my life
  easier in the (near, hopefully) future.
- Turns out that RuboCop node matchers that end in `?`
  can return `nil` if they don't match anything, not `false`.
2025-02-08 23:38:12 +00:00
apainintheneck
7aee21ca8b Fix RuboCop::Cop::FormulaAudit::ShellVariables autocorrect
It used to leave out the parenthesis which could result in invalid
Ruby syntax. Now it always parenthesis here.
2024-10-17 23:46:40 -07:00
Issy Long
45978435e7
rubocop: Use Sorbet/StrictSigil as it's better than comments
- Previously I thought that comments were fine to discourage people from
  wasting their time trying to bump things that used `undef` that Sorbet
  didn't support. But RuboCop is better at this since it'll complain if
  the comments are unnecessary.

- Suggested in https://github.com/Homebrew/brew/pull/18018#issuecomment-2283369501.

- I've gone for a mixture of `rubocop:disable` for the files that can't
  be `typed: strict` (use of undef, required before everything else, etc)
  and `rubocop:todo` for everything else that should be tried to make
  strictly typed. There's no functional difference between the two as
  `rubocop:todo` is `rubocop:disable` with a different name.

- And I entirely disabled the cop for the docs/ directory since
  `typed: strict` isn't going to gain us anything for some Markdown
  linting config files.

- This means that now it's easier to track what needs to be done rather
  than relying on checklists of files in our big Sorbet issue:

```shell
$ git grep 'typed: true # rubocop:todo Sorbet/StrictSigil' | wc -l
    268
```

- And this is confirmed working for new files:

```shell
$ git status
On branch use-rubocop-for-sorbet-strict-sigils
Untracked files:
  (use "git add <file>..." to include in what will be committed)
        Library/Homebrew/bad.rb
        Library/Homebrew/good.rb

nothing added to commit but untracked files present (use "git add" to track)

$ brew style
Offenses:

bad.rb:1:1: C: Sorbet/StrictSigil: Sorbet sigil should be at least strict got true.
^^^^^^^^^^^^^

1340 files inspected, 1 offense detected
```
2024-08-12 15:24:27 +01:00
Branch Vincent
1771bf1bbb
rubocops/lines: audit std_npm_args usage 2024-08-03 20:28:38 -07:00
Branch Vincent
5304b70c92
rubocops/lines: remove existing npm audit 2024-07-26 05:41:57 -07:00
Branch Vincent
88aed13958
rubocops/lines: rustup-init -> rustup 2024-07-25 19:26:59 -07:00
Sam Ford
17b0493e18
Use struct for #audit_formula args
Adding type signatures to `#audit_formula` methods in formula cops
would lead to verbose, repetitive signatures across the existing ~63
instances. This reworks `#audit_formula` to use a `T::Struct` for its
arguments, which allows us to use a one-line signature for these
methods.
2024-07-08 12:22:25 -04:00
Markus Reiter
0f0055ede4
Make documentation @api private by default. 2024-04-26 19:04:20 +02:00
Michael Cho
61b512c72c
rubocops/lines: consistency with single non-runtime Python 2023-12-19 15:20:45 -05:00
Rylan Polster
f98b8f948c
Add rubocop to remove MacOS references 2023-11-22 21:19:01 -05:00
Mike McQuaid
68aa5da833
Merge pull request #15614 from carlocab/quictls-cop
rubocops/lines: disallow `quictls` dependencies in homebrew/core
2023-07-18 10:44:09 +01:00
Carlo Cabrera
95c06f5ad5
rubocops/lines: simplify PyoxidizerCheck 2023-07-14 12:57:23 +08:00
Carlo Cabrera
470c1e6683
Implement rustup audit as a style check
This allows results to be cached and auto-corrected.
2023-07-12 10:49:47 +08:00
Carlo Cabrera
83f2a69acb
rubocops/lines: disallow quictls dependencies in homebrew/core
QuicTLS is a fork of OpenSSL that adds support for QUIC. We'll probably
end up adding it to homebrew/core at some point (see
Homebrew/homebrew-core#134975), but I don't think we want to actually
use it as a dependency of any formulae in place of OpenSSL.

We ought to only allow it for software that actually require QuicTLS in
place of OpenSSL, but I'm not aware of any existing formulae that have
this requirement.
2023-07-01 23:07:28 +08:00
Markus Reiter
8274920217
Rename OS::Mac::Version to MacOSVersion. 2023-05-09 05:08:38 +02:00
Douglas Eichelberger
08af78a2a5 brew style --fix 2023-04-25 09:26:24 -07:00
Issy Long
9302090404
Revert "Allow resource blocks to include on_* blocks or conditionals"
This reverts commit b4cd90a3cc47bc2f94e4449fa99b37445b878a5f.

This should never have been merged, given its extraction into PR 15062
had a reasonably long discussion and was decided against in
https://github.com/Homebrew/homebrew-core/pull/126705#discussion_r1149545828,
but I didn't realise I hadn't backed it out of PR 15060 before it was
approved and I merged it.
2023-03-29 00:40:46 +01:00
Issy Long
b4cd90a3cc
Allow resource blocks to include on_* blocks or conditionals
- d2a58a7853 was deemed "unwiedly", but it passes the RuboCop.
- https://github.com/Homebrew/homebrew-core/pull/126705#discussion_r1148558613 is more wieldy, but needed RuboCop tweaks.
2023-03-26 18:25:33 +01: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
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
6c93f6fe91 Enable typing in rubocops 2023-02-16 15:51:20 -08: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
Mike McQuaid
e71d1e2dd4
rubocop/lines: cleanup weird interpolation. 2022-12-13 11:37:05 +00:00
Bo Anderson
6ede5d2dd5
rubocops: handle empty formula body in various cops 2022-11-05 04:40:16 +00:00
Max Eisner
088dce08d6
fix: return if no install def
Co-authored-by: Rylan Polster <rslpolster@gmail.com>
2022-09-06 14:42:03 +02:00
Max Eisner
2c4ef98f0d
fix additional quotes already handled by #inspect 2022-09-06 14:42:03 +02:00
Max Eisner
ea4fb0fe09
update command comparison to *commands vararg 2022-09-06 14:42:03 +02:00
Max Eisner
3fec64f386
skip offenses for heredoc scripts and calls with custom env
needed for e.g. àwscli`, `hatch`, `pipenv`
2022-09-06 14:42:02 +02:00
Max Eisner
02c9cc0720
add check if executable and subcmd are the same before combining
e.g. ˚jrsonnet˚ needs this
2022-09-06 14:42:01 +02:00
Max Eisner
cf84800939
fix style 2022-09-06 14:42:01 +02:00
Max Eisner
5b3f5dcbf2
fix whitespace removal, fix string concatenation 2022-09-06 14:42:01 +02:00
Max Eisner
8282b15a2a
simplify and unify node handling 2022-09-06 14:42:01 +02:00
Max Eisner
e18432089b
fix typecheck 2022-09-06 14:42:00 +02:00
Max Eisner
ab6a4d757a
fix dangling enclosed comma 2022-09-06 14:42:00 +02:00
Max Eisner
a175d6b7a1
fix style 2022-09-06 14:42:00 +02:00
Max Eisner
a56feff5d0
adapt to executable and subcmd being mandatory 2022-09-06 14:42:00 +02:00
Max Eisner
60db35096f
simplify and comment dangling comma handling 2022-09-06 14:42:00 +02:00
Max Eisner
ab09d15703
remove newlines left behind after correction 2022-09-06 14:42:00 +02:00
Max Eisner
de7ef64f61
use #inspect instead of wrapping symbols 2022-09-06 14:41:59 +02:00