110 Commits

Author SHA1 Message Date
Issy Long
9302090404
Revert "Allow resource blocks to include on_* blocks or conditionals"
This reverts commit b4cd90a3cc47bc2f94e4449fa99b37445b878a5f.

This should never have been merged, given its extraction into PR 15062
had a reasonably long discussion and was decided against in
https://github.com/Homebrew/homebrew-core/pull/126705#discussion_r1149545828,
but I didn't realise I hadn't backed it out of PR 15060 before it was
approved and I merged it.
2023-03-29 00:40:46 +01:00
Issy Long
b4cd90a3cc
Allow resource blocks to include on_* blocks or conditionals
- d2a58a7853 was deemed "unwiedly", but it passes the RuboCop.
- https://github.com/Homebrew/homebrew-core/pull/126705#discussion_r1148558613 is more wieldy, but needed RuboCop tweaks.
2023-03-26 18:25:33 +01:00
Mike McQuaid
7ac31f7d65
Merge pull request #14732 from dduugg/formula-cop-mixin
Refactor FormulaCop as an abstract class
2023-02-21 23:05:58 +00:00
Douglas Eichelberger
387d2f859f Use exclude_from_registry instead 2023-02-20 18:14:47 -08:00
Douglas Eichelberger
d9db5e8825 Refactor FormulaCop as a mixin 2023-02-20 18:14:47 -08: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
Douglas Eichelberger
6c93f6fe91 Enable typing in rubocops 2023-02-16 15:51:20 -08:00
Carlo Cabrera
86161e8c32
Fix test failures 2023-01-24 14:19:28 +08:00
Carlo Cabrera
8c5e6e10a7
rubocops/lines: update hard-coded compiler check
1. `llvm-g{cc,++}` has been gone for a long time. We don't need to check
   for this anymore.
2. Also check for calling the compiler as `cc`, `c89`, `c99`, or `c++`.
2023-01-24 14:04:51 +08:00
Mike McQuaid
e71d1e2dd4
rubocop/lines: cleanup weird interpolation. 2022-12-13 11:37:05 +00:00
Bo Anderson
6ede5d2dd5
rubocops: handle empty formula body in various cops 2022-11-05 04:40:16 +00:00
Max Eisner
088dce08d6
fix: return if no install def
Co-authored-by: Rylan Polster <rslpolster@gmail.com>
2022-09-06 14:42:03 +02:00
Max Eisner
2c4ef98f0d
fix additional quotes already handled by #inspect 2022-09-06 14:42:03 +02:00
Max Eisner
ea4fb0fe09
update command comparison to *commands vararg 2022-09-06 14:42:03 +02:00
Max Eisner
3fec64f386
skip offenses for heredoc scripts and calls with custom env
needed for e.g. àwscli`, `hatch`, `pipenv`
2022-09-06 14:42:02 +02:00
Max Eisner
02c9cc0720
add check if executable and subcmd are the same before combining
e.g. ˚jrsonnet˚ needs this
2022-09-06 14:42:01 +02:00
Max Eisner
cf84800939
fix style 2022-09-06 14:42:01 +02:00
Max Eisner
5b3f5dcbf2
fix whitespace removal, fix string concatenation 2022-09-06 14:42:01 +02:00
Max Eisner
8282b15a2a
simplify and unify node handling 2022-09-06 14:42:01 +02:00
Max Eisner
e18432089b
fix typecheck 2022-09-06 14:42:00 +02:00
Max Eisner
ab6a4d757a
fix dangling enclosed comma 2022-09-06 14:42:00 +02:00
Max Eisner
a175d6b7a1
fix style 2022-09-06 14:42:00 +02:00
Max Eisner
a56feff5d0
adapt to executable and subcmd being mandatory 2022-09-06 14:42:00 +02:00
Max Eisner
60db35096f
simplify and comment dangling comma handling 2022-09-06 14:42:00 +02:00
Max Eisner
ab09d15703
remove newlines left behind after correction 2022-09-06 14:42:00 +02:00
Max Eisner
de7ef64f61
use #inspect instead of wrapping symbols 2022-09-06 14:41:59 +02:00
Max Eisner
a002463362
#delete_suffix instead of #sub 2022-09-06 14:41:59 +02:00
Max Eisner
1b15d03634
remove always-true condition 2022-09-06 14:41:59 +02:00
Max Eisner
8398dfbae0
fix condition array substraction 2022-09-06 14:41:59 +02:00
Max Eisner
06518ec613
add RuboCop to combine multiple calls 2022-09-06 14:41:59 +02:00
Max Eisner
e4b67e84dd
fix shell parameter type 2022-09-06 14:41:59 +02:00
Max Eisner
d963a1ae2f
style 2022-09-06 14:41:59 +02:00
Max Eisner
2329844f50
refactor: naming 2022-09-06 14:41:58 +02:00
Max Eisner
50ae38a372
add :arg shell_parameter 2022-09-06 14:41:58 +02:00
Max Eisner
b901e5873d
do not use parantheses if no args given to method 2022-09-06 14:41:58 +02:00
Max Eisner
0509eebda4
fix: don't write binary param if base_name == binary/base_name 2022-09-06 14:41:58 +02:00
Max Eisner
fd98c3df58
add preliminary RuboCop for generate_completions DSL 2022-09-06 14:41:57 +02:00
Rylan Polster
af99dfba00
Refactor on_system rubocops for use in casks 2022-08-14 17:31:07 -04:00
Mike McQuaid
6b697470fd
brew style --fix
For https://github.com/Homebrew/brew/pull/13671
2022-08-10 14:19:33 +01:00
Rylan Polster
d5d6456b24
Add checks for on_system method 2022-07-24 23:01:56 +02:00
Rylan Polster
7b24ed3b4d
Update OnSystem cop to check other on_{system} methods 2022-07-24 23:01:56 +02:00
Mike McQuaid
2d5eab2e1c
brew style --fix 2022-06-30 08:56:21 +01:00
Mike McQuaid
03f7b254e9
rubocops: fix OnOs block checks.
This wasn't correctly flagging the use of `on_os` in `test do` as
invalid.
2022-03-29 19:15:03 +01:00
Carlo Cabrera
0f26522fad
rubocops/lines: disallow pyoxidizer as a build/runtime dependency
PyOxidizer downloads pre-built versions of Rust and Python, and embeds
this Python into the binaries it produces.

This goes against a number of our packaging policies, so let's make sure
formulae in Homebrew/core don't do this.

See Homebrew/homebrew-core#90025.
2021-11-30 17:36:26 +08:00
Carlo Cabrera
1ffbcc04d4
rubocops/lines: allow OS.foo? in service blocks
These seem more natural, and I don't think we need to be able to mock
service blocks on other OSs.

See Homebrew/homebrew-core#90091.
2021-11-28 21:47:21 +08:00
Bo Anderson
4836ea0ba2
Remove XQuartz handling 2021-11-05 12:40:22 +00:00
Michka Popoff
1cc7ca33c0
update: migrate everyone from linuxbrew-core to homebrew-core
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2021-10-20 11:01:38 +01:00
Mike McQuaid
56753c9d08
rubocops/lines: be less strict about OS.{mac,linux}? in taps.
Fixes #12040.
2021-09-15 12:23:07 +01:00
Mike McQuaid
ebc4cce456
rubocops/lines: add some OS cop comments/exceptions.
Exclude and comment the cases the autocorrect currently doesn't work.

Follow-up from #11955.
2021-09-08 13:46:01 +01:00
Mike McQuaid
a6e4e195c1
rubocops/lines: recommend on_os/OS.os? based on context.
Recommend the use of `on_macos` and `on_linux` unless we're in
`def install`, `def post_install` or `test do` in which case recommend
`OS.mac?` and `OS.linux?` instead.
2021-09-08 13:18:07 +01:00