rbcop 0.1.3-aarch64-linux-gnu → 0.2.0-aarch64-linux-gnu
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +24 -15
- data/libexec/rbcop +0 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a438dba46daada0751d91be9e05b6f035a609967d2a67f76bffff68a776394fe
|
|
4
|
+
data.tar.gz: 63c013a5e78546f1ddf99dfe119684ece5d3d167245398bb423e6af7c34be875
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 86330d6ed33cd247993892ceecef89db02faa71f0269b941dedf814262f68bae7a71af824ba39807f989541b0330fe13f59a98a10b1cd0816bc4000ff7b67945
|
|
7
|
+
data.tar.gz: 71571e01f9bd08dd749c318a03a9e8397630d3356dd1120d77fd4167cb7549eba430caa2a649d1a34e1b6fbb5b195e2fec9630970ef7505342efcd18037ffbee
|
data/README.md
CHANGED
|
@@ -1,28 +1,36 @@
|
|
|
1
1
|
# rbcop
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<p align="center"><img src="docs/rbcop.jpg" alt="rbcop logo: a rust-colored shield with a ruby" width="480"></p>
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Drop-in replacement for RuboCop 1.92.2. Same config, same command line, same output, [about 14x faster](#speed) than `rubocop --parallel` in CI.
|
|
6
|
+
|
|
7
|
+
`gem "rbcop", require: false`, then `bundle exec rbcop`.
|
|
8
|
+
|
|
9
|
+
A reimplementation of [RuboCop](https://github.com/rubocop/rubocop) 1.92.2 in Rust, built on [Prism](https://github.com/ruby/prism) (`ruby-prism` crate).
|
|
10
|
+
|
|
11
|
+
The target is byte-identical output: same offenses, ranges, messages, `[Correctable]` flags, autocorrections, formatter output and exit status as RuboCop 1.92.2 for the same files and configuration. All 613 cops in RuboCop's `config/default.yml` are implemented. rubocop-performance, rubocop-rails, rubocop-minitest, rubocop-rspec, rubocop-rspec_rails, rubocop-factory_bot, rubocop-capybara, rubocop-thread_safety and rubocop-sorbet run natively ([docs/plugins.md](docs/plugins.md)). Other plugins (rubocop-i18n and so on) and custom cops do not; rbcop hands them to RuboCop when one is installed, and otherwise says which cops it skips (see [Plugins and custom cops](#plugins-and-custom-cops)).
|
|
6
12
|
|
|
7
13
|
## Install
|
|
8
14
|
|
|
9
15
|
- Gemfile: `gem "rbcop", require: false`, then `bundle exec rbcop` where you ran `bundle exec rubocop`. The gem carries a prebuilt binary (macOS arm64/x86_64, Linux x86_64/aarch64 glibc and musl); no Rust toolchain is needed.
|
|
10
|
-
- GitHub Actions: `uses: costajohnt/rbcop@v<version>` downloads and caches the release binary.
|
|
16
|
+
- GitHub Actions: `uses: costajohnt/rbcop@v<version>` downloads and caches the release binary, and keeps rbcop's result cache between runs ([inputs](docs/migration.md#github-actions)).
|
|
11
17
|
- Homebrew: `brew install costajohnt/tap/rbcop`. Release archives with each release.
|
|
12
18
|
|
|
19
|
+
The Linux glibc binaries (`*-linux-gnu` archives and gems) need glibc 2.17 or newer (CentOS 7, Ubuntu 14.04, Debian 8 and later); the musl ones are statically linked. Each release lists every file's SHA-256 in `SHA256SUMS` (also committed as `packaging/checksums/<version>.sha256`), and releases after 0.1.4 carry a GitHub build-provenance attestation for each file: `gh attestation verify rbcop-<version>-<target>.tar.gz -R costajohnt/rbcop` checks that it was built by this repository's release workflow. rbcop is 0.x: every published release is meant to be pinned, and from the release after 0.1.4 on, patch releases fix bugs only ([docs/releasing.md](docs/releasing.md#versions)).
|
|
20
|
+
|
|
13
21
|
[docs/migration.md](docs/migration.md) covers switching a project from RuboCop: Gemfile, binstubs, CI, editors and plugins. `docs/releasing.md` describes how releases are built.
|
|
14
22
|
|
|
15
23
|
## Build
|
|
16
24
|
|
|
17
25
|
```sh
|
|
18
|
-
cargo build --release # needs Rust 1.
|
|
26
|
+
cargo build --release # needs Rust 1.95 or newer and libclang (e.g. libclang-dev), for bindgen
|
|
19
27
|
```
|
|
20
28
|
|
|
21
29
|
The binary is `target/release/rbcop`. The crate is not published to crates.io: it builds against a patched copy of `ruby-prism` in `vendor/ruby-prism`.
|
|
22
30
|
|
|
23
31
|
## Usage
|
|
24
32
|
|
|
25
|
-
The command line is RuboCop's. Options, `.rubocop.yml` lookup and inheritance, `RUBOCOP_OPTS`, `.rubocop` argument files, inline `# rubocop:disable` / `enable` / `todo` comments, output and exit status follow RuboCop 1.
|
|
33
|
+
The command line is RuboCop's. Options, `.rubocop.yml` lookup and inheritance, `RUBOCOP_OPTS`, `.rubocop` argument files, inline `# rubocop:disable` / `enable` / `todo` comments, output and exit status follow RuboCop 1.92.2.
|
|
26
34
|
|
|
27
35
|
```sh
|
|
28
36
|
rbcop [options] [paths...]
|
|
@@ -31,22 +39,22 @@ rbcop -A [paths...] # all autocorrections
|
|
|
31
39
|
rbcop -f json -o report.json
|
|
32
40
|
```
|
|
33
41
|
|
|
34
|
-
All builtin formatters are supported, as are the display options, `--fail-level`, `--stdin` (with `-a`/`-A` it prints the corrected source after the report), `-L`, `--show-cops`, `-v` and `-V`.
|
|
42
|
+
All builtin formatters are supported (`-f json` is documented, with the exit codes and a compatibility policy, in [docs/json-output.md](docs/json-output.md)), as are the display options, `--fail-level`, `--stdin` (with `-a`/`-A` it prints the corrected source after the report), `-L`, `--show-cops`, `-v` and `-V`.
|
|
35
43
|
|
|
36
|
-
`--auto-gen-config` (with its options), `--regenerate-todo`, `--disable-uncorrectable` and `--report-unused-todo-entries` are supported. The server options are accepted and run in process (no server is started),
|
|
44
|
+
`--auto-gen-config` (with its options), `--regenerate-todo`, `--disable-uncorrectable` and `--report-unused-todo-entries` are supported. The server options are accepted and run in process (no server is started), `--lsp` runs RuboCop's language server, `--mcp` its MCP server, and `--changed` limits the run to files git reports as changed. Plugin and custom cops rbcop does not implement, `-r`/`--plugin` and custom formatter classes run with RuboCop when one is installed (see [Plugins and custom cops](#plugins-and-custom-cops)). ERB in config files is rendered by running `ruby`, as RuboCop renders it, and remote `inherit_from` URLs are fetched as RuboCop fetches them. The result cache (`--cache`, `--cache-root`, `AllCops: UseCache`) works as RuboCop's, in its own `rbcop_cache` directory. [docs/known-gaps.md](docs/known-gaps.md) lists these and every other known difference, including a few deliberate ones (for example, `-o` pointing at a file being inspected is refused). `-a`/`-A` do not write files that resolve (through symlinks) outside the working directory and the paths given on the command line; those are reported uncorrected with a warning.
|
|
37
45
|
|
|
38
46
|
## Plugins and custom cops
|
|
39
47
|
|
|
40
|
-
rbcop reads plugin configuration (`plugins:` and `require:` gems contribute their `config/default.yml`), and runs natively the cops it implements: RuboCop's own and those of the plugins in [docs/plugins.md](docs/plugins.md) (rubocop-performance, rubocop-rails, rubocop-minitest, rubocop-rspec, rubocop-rspec_rails, rubocop-factory_bot, rubocop-capybara). Cops it cannot run (other plugins such as rubocop-
|
|
48
|
+
rbcop reads plugin configuration (`plugins:` and `require:` gems contribute their `config/default.yml`), and runs natively the cops it implements: RuboCop's own and those of the plugins in [docs/plugins.md](docs/plugins.md) (rubocop-performance, rubocop-rails, rubocop-minitest, rubocop-rspec, rubocop-rspec_rails, rubocop-factory_bot, rubocop-capybara, rubocop-thread_safety, rubocop-sorbet). Cops it cannot run (other plugins such as rubocop-i18n, custom cops from `require: ./lib/cops/my_cop.rb`) go to RuboCop: the fallback.
|
|
41
49
|
|
|
42
50
|
The fallback is on by default and needs a RuboCop. rbcop uses `RBCOP_RUBOCOP` when set (for example `RBCOP_RUBOCOP="bin/rubocop"`), else `bundle exec rubocop` when the project's `Gemfile.lock` has the rubocop gem, else `rubocop` on `PATH`. It runs RuboCop once more for exactly the cops rbcop cannot run (`--except` every cop rbcop implements) on the same files with the same configuration and options, and merges its offenses into its own report, so formatters, `--fail-level` and the exit status see one run. The saving is smaller, since RuboCop still parses every file, but core cops no longer run in Ruby. A project that needs no fallback never starts RuboCop. If RuboCop fails to run (say `bundle exec` outside an installed bundle), rbcop exits 2 with its error.
|
|
43
51
|
|
|
44
|
-
RuboCop loads the project's Ruby (its Gemfile, plugins, cop files), as it would if you ran it, so rbcop says so first on stderr: `rbcop: running bundle exec rubocop for
|
|
52
|
+
RuboCop loads the project's Ruby (its Gemfile, plugins, cop files), as it would if you ran it, so rbcop says so first on stderr: `rbcop: running bundle exec rubocop for 6 cops it does not implement (I18n/GetText: 4, I18n/RailsI18n: 2); set RBCOP_FALLBACK=0 to skip RuboCop` (stdout is unchanged; no line under `RBCOP_FALLBACK=1`, which asked for it). Under `--lsp`, `--mcp`, the server options, `--editor-mode` or `--stdin` (an editor opening a project), wherever they come from (command line, `.rubocop`, `RUBOCOP_OPTS`), the fallback and the hand-off run only with `RBCOP_FALLBACK=1`. `RBCOP_FALLBACK=0` turns it off: no Ruby is started for it at all. rbcop also runs `ruby` to render ERB in config files and to fetch remote `inherit_from` URLs, only when the config has them; [docs/known-gaps.md](docs/known-gaps.md) ("Security: when rbcop runs Ruby") lists every case and how to avoid each.
|
|
45
53
|
|
|
46
54
|
With no RuboCop found, or with `RBCOP_FALLBACK=0`, rbcop skips those cops and says so on stderr instead of skipping them silently:
|
|
47
55
|
|
|
48
56
|
```
|
|
49
|
-
rbcop: not running
|
|
57
|
+
rbcop: not running 6 cops it does not implement (I18n/GetText: 4, I18n/RailsI18n: 2); set RBCOP_FALLBACK=1 to run them with RuboCop
|
|
50
58
|
rbcop: RuboCop runs them when one is found: add the rubocop gem to the bundle, put rubocop on PATH, or set RBCOP_RUBOCOP
|
|
51
59
|
```
|
|
52
60
|
|
|
@@ -54,6 +62,8 @@ rbcop: RuboCop runs them when one is found: add the rubocop gem to the bundle, p
|
|
|
54
62
|
|
|
55
63
|
`-r`/`--require`, `--plugin` and custom formatter classes (`-r ./my_formatter.rb --format MyFormatter`) load Ruby code that can change anything, so rbcop hands the whole run to the same RuboCop with the same arguments: the output is RuboCop's, with no speedup. With no RuboCop found, or `RBCOP_FALLBACK=0`, rbcop refuses them (exit 2).
|
|
56
64
|
|
|
65
|
+
`--no-ruby` (or `RBCOP_NO_RUBY=1`), rbcop's own option, guarantees rbcop never starts `ruby`, `rubocop` or `bundle`, whatever `RBCOP_FALLBACK` says: for a pinned binary in an environment without Ruby. The cops the fallback would run are skipped and reported (on stderr, and as `skipped_cops` and `skipped_ruby_code` in `-f json`); anything else that needs Ruby (ERB in config files, remote `inherit_from`, `inherit_gem`, `AllCops/ProjectIndexIncludesGems`, `-r`, `--plugin`, custom formatter classes) fails with exit 2 and a `rbcop: --no-ruby: ...` error. [docs/known-gaps.md](docs/known-gaps.md) ("Security: when rbcop runs Ruby") has the details.
|
|
66
|
+
|
|
57
67
|
Limits of the fallback:
|
|
58
68
|
|
|
59
69
|
- With `-a`/`-A`, RuboCop corrects its cops first, then rbcop corrects the result; the two never iterate together, so a correction that triggers the other side's cop is fixed on the next run.
|
|
@@ -98,13 +108,12 @@ rbcop with a warm result cache (an unchanged tree, as RuboCop's cache serves it)
|
|
|
98
108
|
## Gates
|
|
99
109
|
|
|
100
110
|
```sh
|
|
101
|
-
cargo fmt --check
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
RBCOP_CORPUS=<corpus dir> RBCOP_ORACLE=<oracle dir> scripts/verify.sh # the above plus check-cops.sh all
|
|
111
|
+
scripts/ci.sh # cargo fmt --check, clippy -D warnings, cargo build and cargo test (all --release --locked)
|
|
112
|
+
RBCOP_CORPUS=<corpus dir> RBCOP_ORACLE=<oracle dir> RUBOCOP=<rubocop 1.92.2> scripts/ci.sh
|
|
113
|
+
# the above plus check-cops.sh all, check-cold.sh and check-plugins.sh
|
|
105
114
|
```
|
|
106
115
|
|
|
107
|
-
`cargo test` replays recorded RuboCop output: every cop's RuboCop spec examples with their config variants, offenses and `-A` results (`tests/spec_corpus`, recorded by `scripts/record-spec-corpus.sh`), config scenarios (`tests/scenarios`), formatter and CLI goldens (`tests/formatters`), `--show-cops` (`tests/show_cops`) and autocorrect cases (`tests/autocorrect`). The scripts that record them (`scripts/record-spec-corpus.sh`, `scripts/scenarios.sh`, `scripts/formatters.sh`, `scripts/show-cops.sh`, `tests/autocorrect/record.sh`) and the oracle, autocorrect and cold-corpus gates need RuboCop 1.
|
|
116
|
+
`cargo test` replays recorded RuboCop output: every cop's RuboCop spec examples with their config variants, offenses and `-A` results (`tests/spec_corpus`, recorded by `scripts/record-spec-corpus.sh`), config scenarios (`tests/scenarios`), formatter and CLI goldens (`tests/formatters`), `--show-cops` (`tests/show_cops`) and autocorrect cases (`tests/autocorrect`). The scripts that record them (`scripts/record-spec-corpus.sh`, `scripts/scenarios.sh`, `scripts/formatters.sh`, `scripts/show-cops.sh`, `tests/autocorrect/record.sh`) and the oracle, autocorrect and cold-corpus gates need RuboCop 1.92.2 as `$RUBOCOP` or on `PATH`. Each script's header documents its arguments and environment.
|
|
108
117
|
|
|
109
118
|
[docs/porting-cops.md](docs/porting-cops.md) describes how a cop is ported and checked, including how the corpora and oracles are laid out. [docs/rubocop-config-semantics.md](docs/rubocop-config-semantics.md) describes the configuration rules `src/config/` follows. [docs/upgrading-rubocop.md](docs/upgrading-rubocop.md) is the process for moving to a new RuboCop release.
|
|
110
119
|
|
data/libexec/rbcop
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rbcop
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: aarch64-linux-gnu
|
|
6
6
|
authors:
|
|
7
7
|
- John Costa
|
|
@@ -9,7 +9,7 @@ bindir: exe
|
|
|
9
9
|
cert_chain: []
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies: []
|
|
12
|
-
description: 'A native reimplementation of RuboCop 1.
|
|
12
|
+
description: 'A native reimplementation of RuboCop 1.92: same command line, configuration,
|
|
13
13
|
offenses, autocorrections and formatter output, run by the `rbcop` executable.'
|
|
14
14
|
executables:
|
|
15
15
|
- rbcop
|