40 Commits

Author SHA1 Message Date
Michael Cho
cce425dda1
cxxstdlib: typed: strong 2024-09-26 14:32:55 -04: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
Markus Reiter
caf87c0336
Warn about undocumented non-private APIs. 2024-05-01 11:35:20 +02:00
Markus Reiter
fe4ef62aa9
Hide #inspect in docs. 2024-04-26 13:20:05 +02:00
Douglas Eichelberger
24cf6076e8 brew style --fix 2023-04-24 20:42:39 -07:00
fn ⌃ ⌥
0d7cc258f9
cxxstdlib: delete unused CompatibilityError class 2021-09-29 14:49:22 -07:00
Mike McQuaid
04abc51d1f
Cleanup use of CxxStdlib
- remove usage on macOS as we don't care about it there
- don't error out on incompatibility but still store stdlib on Linux
- remove (now) unused methods
2021-04-02 13:55:29 +01:00
Mike McQuaid
e65e310fd0
Fix brew style 2021-01-29 20:56:59 +00:00
Mike McQuaid
9216d8abe6
rubocop-rails: make fixes. 2020-12-02 10:43:04 +00:00
Markus Reiter
da9289eff0 Add more type signatures. 2020-11-13 12:26:36 +01:00
EricFromCanada
3768b7a6e9 apidoc: update comment wording, punctuation, formatting 2020-11-06 00:21:02 -05:00
Markus Reiter
24ae318a3d Move type annotations into files. 2020-10-10 14:59:39 +02:00
Markus Reiter
4eff378d09 Refactor and document CxxStdlib. 2020-08-14 18:50:17 +02: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
EricFromCanada
20167e5f1b Adjust comments to tidy API docs output. 2018-10-18 21:42:43 -04:00
Markus Reiter
e9b9ea49a1 Update to RuboCop 0.59.1. 2018-09-17 03:45:59 +02:00
Andrew Janke
e0a8a79921 Style fixes for Rubocop 0.57.1 2018-06-30 19:40:14 -04:00
Markus Reiter
9bee9ca575 Use “squiggly” heredocs. 2017-10-18 14:39:09 +02:00
Mike McQuaid
7a38bab333 Fixup all RuboCop warnings. 2017-05-29 18:43:18 +01:00
Markus Reiter
52ff988530 Fix RuboCop CaseEquality. 2016-09-23 15:30:06 +02:00
BrewTestBot
13d544e11e Core files style updates.
Closes Homebrew/homebrew#42354.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-08-03 13:22:35 +01:00
Xu Cheng
0f4cbd99b5 cxxstdlib: use Formula#full_name 2015-05-29 17:02:23 +08:00
Jack Nagel
262a503b6f Decouple IncompatibleCxxStdlibs from its superclass
This exception is never used outside of the CxxStdlib class, so we don't
need the Homebrew::InstallationError superclass.
2014-08-22 22:37:35 -05:00
Jack Nagel
3d26b75847 Pull common stdlib checking code into a method 2014-08-22 22:18:03 -05:00
Jack Nagel
cf3c12dd5b Add inspect to CxxStdlib 2014-08-03 15:28:51 -05:00
Jack Nagel
5b38e89107 Simplify compatibility logic 2014-08-02 20:11:04 -05:00
Jack Nagel
fccfddb510 Partially revert e1f97e2 to pass new test cases 2014-08-02 20:03:42 -05:00
Jack Nagel
018aeb05ab Drop unnecessary parens 2014-08-02 19:43:13 -05:00
Jack Nagel
142beddd7a Use polymorphism to simplify stdlib compatibility check 2014-08-02 19:29:59 -05:00
Jack Nagel
90e370d2ef type is guaranteed to be a symbol by the factory method 2014-08-02 19:29:58 -05:00
Jack Nagel
cdf1a7b41c CxxStdlib should be immutable so remove writer methods 2014-08-02 19:29:58 -05:00
Jack Nagel
a5a2141a15 Hide the cxxstdlib data structure better 2014-07-06 15:51:43 -05:00
Jack Nagel
32d84377d5 Move constants so we don't have to load all of ENV to get them 2014-07-02 21:58:43 -05:00
Jack Nagel
330e18bb17 Use predicate methods instead of inspecting the tags array 2014-07-01 21:57:30 -05:00
Mike McQuaid
249aae177f formula: move cxxstdlib methods to the class.
This allows disabling this checks when e.g. pouring bottles.
2014-04-23 08:10:48 +01:00
Xiyue Deng
917b94df98 Add cxxstdlib_check method to request changing C++ stdlib checking.
* In certain cases, a C++ software may result in linking to a different
  and incompatible C++ standard library than its dependencies and still
  works fine because it is by design. Examples include GCC, which will
  bootstrap itself and self-host after finish.

* Add a cxxstdlib_check method to formula to request changing the C++
  standard library checking. Currently using "cxxstdlib_check :skip"
  will let a formula skip such checking. This should only be used on
  rare occasions and be very careful.

Closes Homebrew/homebrew#23687.
2013-11-02 17:30:05 -07:00
Misty De Meo
c24aca4c58 CxxStdlib: don't check buildtime deps
Otherwise it's possible that certain buildtime dependencies, that won't
be linked against, will block a build.

See Homebrew/homebrew#23115.
2013-10-10 08:51:38 -07:00
Misty De Meo
87b0137198 CxxStdlib: allow for nil stdlibs
A nil stdlib value represents non-C++ code.
2013-10-06 19:26:06 -07:00
Misty De Meo
b71682bdc7 Tab: track C++ stdlib in use
There are subtle incompatibilities between Apple's libstdc++ and the
libstdc++ used by the various GNU GCC formulae. In addition, we'll
likely also be supporting libc++ in the future, and that's also
incompatible with the other stdlibs.

Tracking it in the tab lets us make sure that dependencies are all
built against the same stdlib to avoid subtle breakage.
2013-09-01 13:19:13 -07:00