124 Commits

Author SHA1 Message Date
Mike McQuaid
a1f112f3fe
Move o* output methods to Utils::Output
This reduces the surface area of our `Kernel` monkeypatch and removes
the need to `include Kernel` in a bunch of modules.

While we're here, also move `Kernel#require?` to `Homebrew` and fully
scope the calls to it.
2025-08-20 19:20:19 +01:00
Patrick Linnane
4513a43d53
Fix RuboCop failures.
Co-authored-by: Patrick Linnane <patrick@linnane.io>
Co-authored-by: Carlo Cabrera <github@carlo.cab>
Co-authored-by: Thierry Moisan <thierry.moisan@gmail.com>
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2025-07-14 19:12:38 +01:00
botantony
a85a9b84bb
rubocop.yml: add autobump_constants.rb
Signed-off-by: botantony <antonsm21@gmail.com>
2025-06-25 15:36:51 +02:00
Mike McQuaid
c9a7b62b1d
Homebrew 4.5 deprecations/disables/removals
The usual cycle of deprecating, disabling, and removing things in
Homebrew major/minor releases.
2025-04-22 17:15:23 +01:00
botantony
fc39f14eff
.rubocop.yml: add language/php.rb file
Signed-off-by: botantony <antonsm21@gmail.com>
2025-03-30 03:24:25 +02:00
Mike McQuaid
f7b9ed11b9
Make some global variables part of the public API
These are all useful to be able to tell users to rely on them and
we've used them long enough for it to make sense as a public API.

Relatedly, these are all used in at least some Homebrew/homebrew-core
or Homebrew/homebrew-cask formulae.

While we're here, update the descriptions to be a bit more user
friendly.
2025-03-21 10:11:58 +00:00
Douglas Eichelberger
5ca1f2579f Annotate AbstractCommand public API 2024-08-13 13:49:42 -07:00
Mike McQuaid
a92e6fc1c8
extend/pathname: import rmtree again.
The separate file is no longer required now that
https://github.com/sorbet/sorbet/pull/7895 was merged.
2024-05-18 18:02:31 +02:00
Bo Anderson
727cf5e917
extend/pathname: restore old rmtree behaviour 2024-05-17 12:32:29 +09:00
Markus Reiter
caf87c0336
Warn about undocumented non-private APIs. 2024-05-01 11:35:20 +02:00
Markus Reiter
0f0055ede4
Make documentation @api private by default. 2024-04-26 19:04:20 +02:00
Markus Reiter
8f97edf0ff
Fix RuboCop config. 2024-04-26 14:17:22 +02:00
Markus Reiter
26d1ff5ccb
Fix CI. 2024-04-23 02:07:42 +02:00
Sam Ford
98f3258ff4
Livecheck: Add Crate strategy
We discussed the idea of adding a livecheck strategy to check crate
versions years ago but decided to put it off because it would have
only applied to one formula at the time (and it wasn't clear that a
crate was necessary in that case). We now have a few formulae that
use a crate in the `stable` URL (`cargo-llvm-cov`, `pngquant`,
`oakc`) and another formula with a crate resource (`deno`), so
there's some value to the idea now.

I established a standard approach for checking crate versions in a
somewhat recent `pngquant` `livecheck` block update and this commit
reworks it into a strategy, so we won't have to duplicate that
`livecheck` block in these cases. With this strategy, we usually
won't even need a `livecheck` block at all.

Under normal circumstances, a regex and/or strategy block shouldn't
be necessary but the strategy supports them when needed. The response
from the crates.io API is a JSON object, so this uses
`Json#versions_from_content` internally and a `strategy` block will
receive the parsed `json` object and a regex (the strategy default or
the regex from the `livecheck` block).
2024-02-11 21:53:21 -05:00
Sam Ford
104d30d231
Finish renaming GithubRelease to GithubReleases 2023-05-16 16:08:18 -04:00
Sean Molenaar
5139b9b468
feat: add github_release strategy 2023-05-16 14:18:22 -04: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
984e8d1503
Merge pull request #14877 from issyl0/rubocop-layout/multiline-method-indentation
rubocop: Enable `Layout/MultilineMethodCallIndentation` & fix offenses
2023-03-06 12:18:29 +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
Mike McQuaid
066a8afe61
Merge pull request #14868 from samford/livecheck/add-yaml-strategy
livecheck: Add Yaml strategy
2023-03-04 00:06:11 +00:00
Issy Long
734a651f93
rubocop: Enable Layout/MultilineMethodCallIndentation & fix offenses
- Part of trying to reduce the number of `Excludes:` we have in our
  RuboCop configs.
- The fixes here all seemed reasonable, with some minimal tweaks for
  line length and less floatiness. Apart from `test/dev-cmd/bottle_spec.rb`
  where RuboCop wanted to do some ridiculously floaty indentation and there
  wasn't an obvious alternative place to break the lines, so I opted for
  in-line disables instead.
2023-03-03 22:18:51 +00:00
Issy Long
81b0e41183
rubocop: Alphabetize list of cops, put Bundler/GemFilename first 2023-03-02 22:13:55 +00:00
Issy Long
e05cd2c542
rubocop: In-line Style/HashAsLastArrayItem disablement
- We want to move away from `Excludes:` in the main `.rubocop.yml` config file
  containing full file paths, because it's hard to track whether they're still
  necessary or not (and other occurrences in the files that you might
  legitimately want to improve are unaccounted for).
2023-03-02 22:11:05 +00:00
Sam Ford
33268e4fb0
livecheck: Add Yaml strategy
This adds a generic `Yaml` strategy to livecheck that requires a
`strategy` block to operate. The YAML-parsing code is taken from the
existing approach in the `ElectronBuilder` strategy.

We don't currently have any `strategy` blocks in first-party taps
that manually parse YAML. However, creating a generic `Yaml` strategy
allows us to simplify `ElectronBuilder` (and any future strategy
that works with YAML) while making it easy to create custom `Yaml`
`strategy` blocks in formulae/casks as needed.
2023-03-02 16:20:39 -05:00
Mike McQuaid
97fbd89a57
Merge pull request #14845 from samford/livecheck/add-xml-strategy
livecheck: Add Xml strategy
2023-03-01 22:21:13 +00: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
Sam Ford
7d9e1a50e8
livecheck: Add Xml strategy
This adds a generic `Xml` strategy to livecheck that requires a
`strategy` block to operate. The XML-parsing code is taken from the
existing approach in the `Sparkle` strategy. As such, `Sparkle` has
been updated to use the `Xml#parse_xml` method instead.

Unlike the `Json` strategy, we don't currently have any `strategy`
blocks in first-party taps that manually parse XML. However, we had a
user request support for something like this and I was already working
on an `Xml` strategy (as a way of extracting the XML-parsing code
from `Sparkle` into something general-purpose), so here we are.

Future strategies that parse simple XML data can potentially use the
`Xml#find_versions` method (similar to how we have strategies that
leverage `PageMatch#find_versions`) instead of having to implement
something bespoke like `Sparkle`.
2023-02-28 14:58:11 -05:00
Issy Long
267d72a9d0
More comments and TODOs
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2023-02-28 12:50:05 +00:00
Issy Long
033dacac10
rubocop: Tweak Style/Documentation include paths after PR 14805
- The `Kernel` module, which needed a comment because it has an "@api public"
  method in it, moved.
2023-02-28 00:19:57 +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
ed8363fd72 Consolidate some rubocop configurations 2023-02-21 16:50:29 -08:00
Mike McQuaid
552902413a
rubocop.yml: disable more metrics.
Disable these in taps, too.
2023-02-21 16:31:43 +00: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
Mike McQuaid
4eaaa867de
Merge pull request #14709 from issyl0/rubocop-tidying
rubocop: Some more config cleanup
2023-02-20 19:35:36 +00:00
Issy Long
f8654bd363
rubocop: In-line disables of Metrics/{Module,Block,Class}Length
- We're not going to make the really long things be any shorter any time soon.
- The instructions in issue 14685 say, pragmatically, "disable all the rubocop
  rules we're never going to realistically fix e.g. Metrics/ClassLength". But
  that felt like a slippery slope to more _really_ long modules/classes/blocks,
  and the limits are here for a reason.
2023-02-19 16:33:23 +00:00
Issy Long
60d9443d35
rubocop: Lint/NestedMethodDefinition excludes are not needed 2023-02-19 16:33:22 +00:00
Issy Long
d84d157aaa
rubocop: Disable Bundler/GemFilename
- We have `gems.rb` and `Gemfile` and disabling the rule in `gems.rb` directly
  still errors?
2023-02-19 16:33:20 +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
Mike McQuaid
f39ab585b9
Further adjust HOMEBREW_AUTO_UPDATE_SECS
Add another case to update once an hour when developer commands have
been run.
2023-02-15 17:37:12 +00:00
Mike McQuaid
c5252817c2
analytics: refactor InfluxDB/Google handling. 2023-02-15 16:34:50 +00:00
Mike McQuaid
4c8ed77302
Improve homebrew/{core,cask} autotapping.
Don't automatically tap these when running a developer command that's
not using the API.

Fixes #14606
2023-02-14 09:54:24 +00:00
Xuehai Pan
ba3bccf9ed api: download from HOMEBREW_API_DOMAIN 2023-02-04 13:05:20 +00:00
Mike McQuaid
46fc4f9f1b
Don't allow HOMEBREW_INSTALL_FROM_API when building from source
When either being in a non-default prefix or being on an unsupported
macOS version we expect most things to be built from source. In that
environment, do not allow HOMEBREW_INSTALL_FROM_API to be set.

Fixes #14475
2023-02-02 14:49:34 +00:00
Douglas Eichelberger
97a7d26255 Clamp metrics 2023-01-26 22:08:40 -08:00
Douglas Eichelberger
a836793e62 Move Style/Documentation config 2023-01-26 22:04:39 -08:00
apainintheneck
07ff122c8d Ignore os cop in tap Formula/Cask folders 2022-12-09 18:07:13 -08:00
Lukas Oberhuber
d35f2e76a7 Move Metrics/Blocklength disable to rubocop.yml 2022-08-02 09:06:28 -07:00
Lukas Oberhuber
5b1724ef33 Fix rubocop warning by ignoring for install_args 2022-08-01 15:27:17 -07:00