18 Commits

Author SHA1 Message Date
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
Mike McQuaid
6e9288470e
brew style --fix 2024-05-23 17:15:43 +01:00
Markus Reiter
0f0055ede4
Make documentation @api private by default. 2024-04-26 19:04:20 +02:00
Markus Reiter
24ae318a3d Move type annotations into files. 2020-10-10 14:59:39 +02:00
Markus Reiter
73c05f36ab Document InstallRenamed. 2020-08-26 03:13:58 +02:00
Mike McQuaid
36dbad3922
Add frozen_string_literal to all files. 2019-04-20 13:27:36 +09:00
Mike McQuaid
cf5fdeef1d Rubocop: manual rule fixes. 2017-09-24 21:23:59 +01:00
Mike McQuaid
0578ba0f42 install_renamed: handle recursive installs.
Closes Homebrew/homebrew#49845.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-03-08 13:47:29 +08: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
Jack Nagel
96f7a8015f Pass around only pathname objects 2015-03-26 22:22:45 -04:00
Jack Nagel
3721e0be6f Always yield a path from install_p extension 2015-03-26 22:22:45 -04:00
Jack Nagel
6f0efd6f3d Always pass basename to install_p
Currently, when called with one argument, dst is set to self, i.e. the
directory into which the source file should be moved.

When called with a second argument (for renames), dst is the full path,
including the basename, to the moved file.

Instead, let's always pass the full path, which means we can remove the
branching logic around computing dst.
2015-03-24 21:03:45 -04:00
Mike McQuaid
95a8a50aa0 install_renamed: ignore unused parameter. 2015-03-08 09:39:15 +00:00
Mike McQuaid
58cb4444da etc.install: handle recursive directory installs.
We need to install the helper module not just on `etc` but also on all
subdirectories of it too. Also, handle the case where we install
a subdirectory with etc.install.

Closes Homebrew/homebrew#26145.
2014-08-26 08:30:47 +01:00
Mike McQuaid
a28b57d3fb git-etc: remove all code.
I've given up on this; too many edge cases.
If someone else wants to pick it up then send me a message and I'll walk
you through the approach.
2013-10-30 16:15:31 -07:00
Mike McQuaid
a6e2245732 git_etc: update based on bottle etc/var changes. 2013-10-10 16:46:47 +01:00
Mike McQuaid
19852bc47c Pathname: add cp_path_sub method.
This method allows copying a file to a new location by performing a
substitution on the pathname.
2013-10-10 16:46:47 +01:00
Mike McQuaid
caa2f87728 InstallRenamed: don't overwrite etc files; rename.
If an etc file exists on installation instead of overwriting it (or
requiring all the manual checks in formula) simply copy it with the
extension `.default` appended.
2013-10-10 16:46:47 +01:00