22 Commits

Author SHA1 Message Date
Mike McQuaid
71bab462e1
Add ZeroZeroZeroZero cop
Add a new RuboCop to detect the use of 0.0.0.0 in formulae which
indicates binding to all network interfaces, internally or externally,
so is a bad default and potentially a security risk.

Co-authored-by: Issy Long <me@issylong.com>
2025-07-11 08:24:19 +01:00
botantony
aecdcd4840
rubocops: add no_autobump! rubocop
Signed-off-by: botantony <antonsm21@gmail.com>
2025-06-18 16:16:12 +02:00
Kristján Oddsson
4acdcfcb37
Add a DisableComment Cop
Co-authored-by: Issy Long <issyl0@github.com>
2025-01-31 15:39:17 +01:00
Douglas Eichelberger
c354377f3e Exclude sorbet assignments from Style/MutableConstant cop 2024-09-20 10:45:26 -07:00
Issy Long
e6976ae3d1
rubocop: Discourage the use of FileUtils.rm_rf
- This cop checks for the use of `FileUtils.rm_rf` and suggests using
  `FileUtils.rm_r` because we should know if we couldn't delete a
  thing for some reason, not just force it.
2024-08-01 18:27:59 +01:00
Ruoyu Zhong
5fc0fe21a7
Add a RuboCop for shell command stubs 2024-07-15 14:49:25 -04:00
Mike McQuaid
97ad3567d1
Optimise more command handling/speed
- in `brew.sh` split the `case` into those cases that take a single or
  no arguments and those that take multiple arguments or handle
  multiple commands. This considerably speeds up the
  `brew shellenv bash` case that wasn't being handled here before.
- add `setup-ruby` to the list of commands that can be called quickly
  by `brew.sh` without additional setup. This speeds up the
  `brew setup-ruby` no-op case by ~10x.
- add a parameter to `setup-ruby` to avoid running Bundler if the
  command doesn't need it. This makes many more cases for
  `brew setup-ruby` to be no-op cases.
- Remove the (now) unused `HOMEBREW_RUBY3` check in `setup-ruby`.
- Improve argument handling in `command_path.sh` to allow it to be
  used as a function in `setup-ruby.sh`.
- Add a new RuboCop to check usage of `install_bundler_gems!` is only
  inside `dev-cmd` (or a few other acceptable places).
- Use new `processed_source.file_path` API in `formula_cop.rb`
2024-04-30 12:48:29 +01:00
Issy Long
ff21ef0955
It helps if you actually require the new cop to run it on real code 2024-02-20 23:49:25 +00:00
Douglas Eichelberger
ae249ec282 Vendor InverseMethods cop 2024-01-26 15:03:59 -08:00
Douglas Eichelberger
0caaa1fa36 Vendor SafeNavigationWithBlank cop 2024-01-26 15:03:59 -08:00
Douglas Eichelberger
665bda0fbd Vendor Presence cop 2024-01-26 15:03:59 -08:00
Douglas Eichelberger
f99d39faf9 Vendor CompactBlank cop 2024-01-26 15:03:59 -08:00
Douglas Eichelberger
9d081a67cc Replace Rails/NegateInclude with Inverse/Invertible cops 2024-01-26 12:27:50 -08:00
apainintheneck
70451ea7b1 Add cop to stop bin in service block
The preferred method is opt_bin because that works
with the API and is more portable (works between versions).

Also removed the last example from the docs of `bin/"name"`
from the service block section
2023-04-04 20:00:30 -07:00
Douglas Eichelberger
e68b02c4a6 Move tests and requires 2023-03-03 12:44:23 -08:00
Douglas Eichelberger
ecfceb3fee Revert Utils implementation 2023-03-03 12:44:23 -08:00
Douglas Eichelberger
91ad24b876 Remove Array#to_sentence monkey-patch 2023-03-03 12:44:22 -08:00
Douglas Eichelberger
ed8363fd72 Consolidate some rubocop configurations 2023-02-21 16:50:29 -08:00
Douglas Eichelberger
d9db5e8825 Refactor FormulaCop as a mixin 2023-02-20 18:14:47 -08:00
apainintheneck
c7d53a2d9c Add cop to police os checks
The methods `OS.linux?` and `OS.mac?` should only be used
in `extend/os` and this cop makes sure of that.
2022-11-19 22:01:13 -08:00
Bo Anderson
3e4cb206bb
rubocops: silence parser warning 2021-09-23 03:45:15 +01:00
Bo Anderson
a06d136d2c
Move Sorbet gems into an optional group 2021-06-11 08:10:30 +01:00