36 Commits

Author SHA1 Message Date
Douglas Eichelberger
eed660e784 Move remaining OS extensions to prepend 2024-10-05 12:18:29 -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
Issy Long
0e81efcccb
sorbet: Comment more files that can't be strict because of undef
- Found with
  `grep -rL "# typed: strict" Library/Homebrew | xargs grep -l "undef "`.
- This stops people from trying to bump them and
  getting an error that they can't fix because
  [it's a Sorbet limitation](https://sorbet.org/docs/error-reference#3008),
  wasting contributor time.
2024-08-09 18:23:00 +01:00
apainintheneck
536b37c766 cmd/config: Add core cask tap to output
This information is occasionally useful when debugging so we should
include it by default to make our lives easier.
2023-12-21 22:54:38 -08:00
Bo Anderson
688d87e839
Remove Ruby 2.6 & macOS system Ruby support code 2023-12-12 03:44:31 +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
Bo Anderson
4836ea0ba2
Remove XQuartz handling 2021-11-05 12:40:22 +00:00
Carlo Cabrera
25fe428ed2
system_config: fix clang version output on Linux
If you have Homebrew LLVM installed, `brew config` will show

    Clang: 12.0.1 build (parse error)

because Homebrew LLVM does not give a build number. Some installations
from the system package manager do have this information, so let's show
it if it's available but skip complaining if not.

I've kept the original code for macOS because we always expect Apple's
build number to show there.
2021-10-07 11:24:20 +08:00
Mike McQuaid
d6957a3acb
Homebrew 3.0.0 deprecations/disables 2021-01-29 19:50:24 +00:00
Mike McQuaid
5afff3f3aa
Handle macOS Homebrew on ARM
- Output `brew doctor` and `brew install` messages noting this configuration is (currently) unsupported and encourage use of Rosetta instead
- Output Rosetta 2 usage in `brew config` on ARM (whether in Rosetta 2 or not)
- Check the architecture of (newly installed) dependencies and ensure they are using the correct architecture.
- Don't allow installing macOS Intel Homebrew in macOS ARM Homebrew default prefix (and vice versa
- Actually write out the architecture of dependencies to the tab rather than generating and throwing them away
- Set and document the expected default prefix for macOS Intel Homebrew, macOS ARM Homebrew (`/opt/homebrew`) and Homebrew on Linux

While we're here:
- Don't say Big Sur is a prerelease version but still make it clear we
  don't support it (yet).
- Don't reference non-existent IRC channel
2020-11-12 17:06:47 +00:00
Jonathan Chang
ab7b757400 rubocop: fix Style/NegatedIfElseCondition 2020-11-10 23:28:31 +11:00
Markus Reiter
61b79318ed Move include Kernel into .rbi files again and split up existing .rbi files. 2020-10-10 19:10:58 +02:00
Markus Reiter
24ae318a3d Move type annotations into files. 2020-10-10 14:59:39 +02:00
Markus Reiter
e2c9e6d3c2 Refactor and document SystemConfig. 2020-08-23 04:15:35 +02:00
Bo Anderson
30a8df0f91 os/mac/system_config: simplify JVM version parsing 2020-08-11 18:51:36 +01:00
Mike McQuaid
8d3e7cf028
os/mac: remove CLT header package stuff.
We never care about it and it's not relevant anywhere except 10.14.
2019-12-11 13:49:13 +00:00
Issy Long
1f6168fe8a
Change regexp.match?(string) to string.match?(regexp) everywhere
- Only try to call `.match?` on strings that aren't nil.
2019-10-13 23:22:51 +01:00
Issy Long
b78028b9c2
Auto-fix Performance/RegexpMatch offenses 2019-10-13 16:04:26 +01:00
Mike McQuaid
36dbad3922
Add frozen_string_literal to all files. 2019-04-20 13:27:36 +09:00
Mike McQuaid
d64429a736
rubocop: enable Style/IfUnlessModifier. 2019-02-21 12:55:49 +00:00
Mike McQuaid
1aa8ad09e2
Deprecate macOS versions below Mavericks
And remove all dead/unneeded code.
2019-01-27 12:27:47 +00:00
Mike McQuaid
78ddc34847
config: hide optional system packages.
Java, XQuartz and the CLT separate header package aren't required for
everyone's Homebrew usage or a default macOS development install.

As a result, only show then in `brew config` when they are actually
installed.
2018-09-30 10:50:37 +01:00
Markus Reiter
e9b9ea49a1 Update to RuboCop 0.59.1. 2018-09-17 03:45:59 +02:00
Markus Reiter
32ad22395b Remove some #popen_reads. 2018-09-04 05:16:59 +02:00
Mike McQuaid
bcb1ec5499
Improve Homebrew/brew line length.
Use 124 max line length everywhere. Also, reduce tap max line length to
189 as Homebrew/homebrew-core has that as a maximum now. In future
Homebrew/homebrew-core will also be reduced to 124 maximum line length.
2018-09-02 16:15:09 +01:00
Andrew Janke
e0a8a79921 Style fixes for Rubocop 0.57.1 2018-06-30 19:40:14 -04:00
Misty De Meo
95e3754b95 SystemConfig: print header status if appropriate 2018-06-13 17:24:32 -07:00
Mike McQuaid
9fca172d03 Fix HOMEBREW_RUBY_WARNINGS="-w"
Fix various circular requirements, method redefinitions, etc.
2018-04-07 20:28:56 +01:00
Mike McQuaid
7095738d1d Remove config/doctor checks we no longer need
A bunch of these were needed before superenv, environment filtering or
on now long-unsupported versions of macOS.
2018-04-02 09:40:39 +01:00
Maxim Belkin
5536f49305 Cross-platform java detection 2018-02-22 18:32:21 +00:00
Mike McQuaid
b69d71edea system_config: handle new non-string Xcode version 2017-11-05 15:39:43 +00:00
Mike McQuaid
3f9cce0a03 Use new "macOS" naming where appropriate.
Not quite a mass replacement as I've used OS X and Mac OS X where
describing specific older versions and added compatibility methods
for things in the DSL.
2016-09-18 19:57:19 +01:00
Xu Cheng
b586a04204
describe_homebrew_ruby: fix regex
`.` need to be escaped, otherwise it will match any character.

Also improve code style for handling string s.
2016-07-13 15:34:49 +08:00
Xu Cheng
99e9a22b85
describe_homebrew_ruby: s may be a frozen string 2016-07-13 15:18:44 +08:00
Xu Cheng
fe3915237e config: show homebrew ruby for all system (#492) 2016-07-11 22:32:46 +08:00
Mike McQuaid
9e7b8c61a9 Make config command cross-platform.
Closes #168.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-05-08 16:51:22 +01:00