rubocop-osc7501 0.1.0
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 +7 -0
- data/ACCESSIBILITY.md +30 -0
- data/CHANGELOG.md +11 -0
- data/CODE_OF_CONDUCT.md +68 -0
- data/CONTRIBUTING.md +126 -0
- data/LICENSE +201 -0
- data/README.md +155 -0
- data/SECURITY.md +18 -0
- data/examples/.rubocop +6 -0
- data/lib/rubocop/osc7501/formatter.rb +47 -0
- data/lib/rubocop/osc7501/lifecycle.rb +302 -0
- data/lib/rubocop/osc7501/version.rb +9 -0
- data/lib/rubocop/osc7501/writer.rb +97 -0
- data/lib/rubocop/osc7501.rb +16 -0
- data/sig/rubocop/osc7501/formatter.rbs +22 -0
- data/sig/rubocop/osc7501/lifecycle.rbs +158 -0
- data/sig/rubocop/osc7501/version.rbs +8 -0
- data/sig/rubocop/osc7501/writer.rbs +46 -0
- data/sig/rubocop/osc7501.rbs +6 -0
- metadata +75 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 1f5fd674d7fc499061d87cf01bdcfda1e06e9e688e73db0404c129a24eaf0247
|
|
4
|
+
data.tar.gz: 501bfb77a215116462ad6e92a3355fafa385194946f62573fb9f7e016b8e8118
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: fe527b0575c7c819d68bb917ef61c801746b6bcce236bd3851096482341edcb51303b719633fd542cfa9b2d68307de6a569df3cfde87a16bc629db47450792e7
|
|
7
|
+
data.tar.gz: 618859b3fe899e1c7e1465be5ef4357059eddbcb1952d8e13b7fd1ad048c0f2c9a4451fe22a2d732a0d41a89d251ff531e5d7c84a619a325f580652a0c47df58
|
data/ACCESSIBILITY.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Accessibility
|
|
2
|
+
|
|
3
|
+
Read RuboCop output without relying on terminal status indicators. RuboCop keeps
|
|
4
|
+
ordinary formatter output and errors available as text.
|
|
5
|
+
|
|
6
|
+
## Plain text output
|
|
7
|
+
|
|
8
|
+
Disable status reporting and preselect an ordinary formatter:
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
RUBOCOP_OSC7501=off bundle exec rubocop --require rubocop/osc7501 --format progress
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
`RUBOCOP_OSC7501=off` bypasses eager formatter construction. By default RuboCop
|
|
15
|
+
sends records only to a TTY with a terminal other than `dumb`.
|
|
16
|
+
`RUBOCOP_OSC7501=force` overrides both checks.
|
|
17
|
+
|
|
18
|
+
## Environments and limits
|
|
19
|
+
|
|
20
|
+
Terminal status requires an OSC 7501-capable terminal. The gem checks for a TTY
|
|
21
|
+
and honors `TERM=dumb` but does not detect OSC support. Your terminal controls
|
|
22
|
+
display and announcements. I have not tested status display with screen readers,
|
|
23
|
+
and live Rex or tmux presentation has not been verified.
|
|
24
|
+
|
|
25
|
+
## Report a barrier
|
|
26
|
+
|
|
27
|
+
Open an [issue](https://github.com/cosgroveb/rubocop-osc7501/issues) describing
|
|
28
|
+
what you tried, what prevented you, and what would help. Include terminal,
|
|
29
|
+
operating system, and assistive technology versions when relevant. You do not
|
|
30
|
+
need to disclose a disability or medical information.
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
## 0.1.0 - 2026-11-13
|
|
6
|
+
|
|
7
|
+
- Add opt-in OSC 7501 reporting for RuboCop ([60239fa](https://github.com/cosgroveb/rubocop-osc7501/commit/60239faa66d79897525a96f66d4f988d22b00a41))
|
|
8
|
+
- Fix hosted compatibility test environments ([e2923a9](https://github.com/cosgroveb/rubocop-osc7501/commit/e2923a9c97a501b0636ec9dac9778f59e2354d46))
|
|
9
|
+
- Preserve Bundler load path in legacy checks ([47e351d](https://github.com/cosgroveb/rubocop-osc7501/commit/47e351d5aed51ce90bc295af593f6fb856bb1f50))
|
|
10
|
+
- Trace legacy compatibility child startup ([33546a1](https://github.com/cosgroveb/rubocop-osc7501/commit/33546a108bbe7ed16e1e44195ce9dcf047437b39))
|
|
11
|
+
- Use loaded Bundler path in legacy checks ([d211604](https://github.com/cosgroveb/rubocop-osc7501/commit/d21160489066c54f4a7d2745060cfb87d98fe339))
|
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Code of conduct
|
|
2
|
+
|
|
3
|
+
Everyone who participates in good faith is welcome in rubocop-osc7501. Treat
|
|
4
|
+
people with respect, regardless of race, ethnicity, caste, color, age, physical
|
|
5
|
+
characteristics, neurodiversity, disability, sex, gender identity or expression,
|
|
6
|
+
sexual orientation, language, philosophy, religion, national or social origin,
|
|
7
|
+
income, education, or other status.
|
|
8
|
+
|
|
9
|
+
## Working together
|
|
10
|
+
|
|
11
|
+
Respect the project's purpose and other people's time. Discuss ideas without
|
|
12
|
+
attacking people. Make room for different viewpoints and experiences. Give and
|
|
13
|
+
accept constructive feedback. Account for differences in language, culture,
|
|
14
|
+
and communication when interpreting what someone says.
|
|
15
|
+
|
|
16
|
+
Take responsibility for what you submit, including code, reports, and comments
|
|
17
|
+
produced with AI assistance. Review it before sharing, make sure you understand
|
|
18
|
+
it, and respond to questions and corrections. Respect the time others spend
|
|
19
|
+
reviewing your work. Take responsibility for repairing harm you cause.
|
|
20
|
+
|
|
21
|
+
Do not:
|
|
22
|
+
|
|
23
|
+
- Harass people, ignore a request to stop, or violate stated boundaries.
|
|
24
|
+
- Make personal attacks, discriminate, or stereotype people by identity.
|
|
25
|
+
- Make unwanted sexual comments or advances.
|
|
26
|
+
- Share or use someone's private information without permission.
|
|
27
|
+
- Threaten, encourage, or cause violence or other harm.
|
|
28
|
+
- Impersonate someone or evade moderation with another identity.
|
|
29
|
+
- Contribute someone else's work without credit.
|
|
30
|
+
- Post unrelated advertising or present harmful content without appropriate
|
|
31
|
+
context and care.
|
|
32
|
+
|
|
33
|
+
Threatening or encouraging these behaviors also violates this policy. Other
|
|
34
|
+
behavior that threatens the community's well-being may warrant moderation.
|
|
35
|
+
Disagreement alone is not a conduct violation.
|
|
36
|
+
|
|
37
|
+
## Reporting and enforcement
|
|
38
|
+
|
|
39
|
+
Report concerns privately to Brian Cosgrove at
|
|
40
|
+
[cosgroveb@gmail.com](mailto:cosgroveb@gmail.com). Include what happened and any
|
|
41
|
+
relevant links or messages. Do not post private reports in public issues.
|
|
42
|
+
|
|
43
|
+
I review and investigate reports, hear from the people involved as needed, and
|
|
44
|
+
prioritize safety and confidentiality. I share report details only as needed
|
|
45
|
+
to investigate and respond. I handle enforcement privately and discuss any
|
|
46
|
+
public resolution with the people involved. I respond as availability permits,
|
|
47
|
+
without a guaranteed deadline.
|
|
48
|
+
|
|
49
|
+
Depending on severity and repetition, I may issue a warning, remove content,
|
|
50
|
+
restrict participation, or impose a temporary or permanent ban. Serious
|
|
51
|
+
violations may lead to an immediate ban. Where continued participation is
|
|
52
|
+
appropriate, I explain what needs to change and any conditions for returning.
|
|
53
|
+
These rules apply to maintainers as well as other participants.
|
|
54
|
+
|
|
55
|
+
## Scope
|
|
56
|
+
|
|
57
|
+
This policy covers project spaces and anyone officially representing the
|
|
58
|
+
project elsewhere, including through project accounts or at events.
|
|
59
|
+
|
|
60
|
+
## Attribution
|
|
61
|
+
|
|
62
|
+
Adapted from [Contributor Covenant 3.0](https://www.contributor-covenant.org/version/3/0/code_of_conduct/),
|
|
63
|
+
stewarded by the Organization for Ethical Source. This adaptation shortens the
|
|
64
|
+
wording and uses a maintainer-led reporting and enforcement process.
|
|
65
|
+
|
|
66
|
+
This document is licensed under
|
|
67
|
+
[CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/).
|
|
68
|
+
The software remains licensed under [Apache License 2.0](LICENSE).
|
data/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Follow the [code of conduct](CODE_OF_CONDUCT.md). Report vulnerabilities through
|
|
4
|
+
the private channel in [SECURITY.md](SECURITY.md).
|
|
5
|
+
|
|
6
|
+
AI-assisted contributions are welcome. Verify claims in code and reports, state
|
|
7
|
+
what you tested, and take responsibility for what you submit.
|
|
8
|
+
|
|
9
|
+
Use MRI Ruby 3.4 or newer for development tooling. Install actionlint 1.7.12 on
|
|
10
|
+
your PATH, then run:
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
bundle install
|
|
14
|
+
bundle exec rake
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
`rake` runs RuboCop with rubocop-rspec, bundler-audit, actionlint, inline RBS
|
|
18
|
+
checks, specs, and an isolated installed-gem smoke test. Run `bundle exec rake
|
|
19
|
+
lint`, `audit`, `workflows`, `types`, `spec`, `package` or `smoke` separately.
|
|
20
|
+
Dependency auditing uses the ignored lockfile from `bundle install`.
|
|
21
|
+
|
|
22
|
+
Keep runtime dependencies limited to RuboCop. Cover lifecycle behavior with
|
|
23
|
+
real subprocesses and fake native boundaries. Specs run in random order and
|
|
24
|
+
report their seed. Reproduce an ordering failure with `bundle exec rspec --seed
|
|
25
|
+
<seed> --bisect`.
|
|
26
|
+
|
|
27
|
+
`rake types` checks annotation coverage across authored Ruby files, generates
|
|
28
|
+
inline RBS, and uses Steep for implementations in `lib/` and `script/`. Specs
|
|
29
|
+
and build configuration receive annotation and signature validation, not
|
|
30
|
+
implementation checking. Generated signatures live in ignored `tmp/` during
|
|
31
|
+
development and inside the built gem under `sig/`, never in the source tree.
|
|
32
|
+
`sig/dependencies.rbs` declares the private RuboCop and RubyGems boundaries that
|
|
33
|
+
bundled signatures lack.
|
|
34
|
+
|
|
35
|
+
The smoke task installs the built gem and RuboCop's dependency closure in a
|
|
36
|
+
temporary gem home, then checks clean and offending inspections without loading
|
|
37
|
+
companion gems. Modern CI lanes build the canonical package and verify its
|
|
38
|
+
generated runtime signatures. The `pure-rubocop` lane builds a source artifact
|
|
39
|
+
in isolation to check the runtime-only dependency closure without development
|
|
40
|
+
gems.
|
|
41
|
+
|
|
42
|
+
## Runtime compatibility
|
|
43
|
+
|
|
44
|
+
The gem targets MRI Ruby 2.1 or newer and RuboCop 0.52.0 or newer. Use
|
|
45
|
+
`Gemfile.compat` and `RUBOCOP_VERSION` to select the runtime pair:
|
|
46
|
+
|
|
47
|
+
```sh
|
|
48
|
+
export BUNDLE_GEMFILE=Gemfile.compat
|
|
49
|
+
export RUBOCOP_VERSION=0.52.0
|
|
50
|
+
bundle install
|
|
51
|
+
bundle exec ruby script/compat.rb
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
On Ruby 2.1 install Bundler 1.17.3 first. The compatibility harness checks
|
|
55
|
+
done, error and idle outcomes, first Ctrl-C, output and stderr parity, silent
|
|
56
|
+
modes, File `--out` finalization and idempotent hooks against the actual
|
|
57
|
+
selected executable. It exits nonzero on any failed assertion. Do not treat a
|
|
58
|
+
smoke-only lane as full behavior coverage.
|
|
59
|
+
|
|
60
|
+
Executed pairs are listed in the README. Remove `Gemfile.compat.lock` before
|
|
61
|
+
changing RuboCop versions and keep it out of commits. Supporting an older
|
|
62
|
+
runtime does not extend its upstream security maintenance.
|
|
63
|
+
|
|
64
|
+
## Release
|
|
65
|
+
|
|
66
|
+
Release reviewed commits on remote `main`:
|
|
67
|
+
|
|
68
|
+
```sh
|
|
69
|
+
gh workflow run release.yml --ref main -f version=NEW_VERSION
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Use a stable `major.minor.patch` version without a `v` prefix. The workflow
|
|
73
|
+
captures `main`, updates `VERSION`, builds changelog notes from non-merge
|
|
74
|
+
subjects since the previous tag, tests the exact prepared commit, then pushes
|
|
75
|
+
the commit and tag atomically. Publication resumes an existing tag instead of
|
|
76
|
+
releasing newer commits.
|
|
77
|
+
|
|
78
|
+
Before the first publication, configure a RubyGems pending Trusted Publisher
|
|
79
|
+
for owner `cosgroveb`, repository `rubocop-osc7501`, workflow `release.yml`.
|
|
80
|
+
Store a write-enabled repository deploy key as `RELEASE_DEPLOY_KEY`. The publish
|
|
81
|
+
job uses OIDC for RubyGems and the workflow token for the GitHub Release.
|
|
82
|
+
|
|
83
|
+
Update user-visible behavior documentation and write commit subjects that
|
|
84
|
+
describe the change, because release notes use them. Do not maintain
|
|
85
|
+
`Unreleased` entries by hand.
|
|
86
|
+
|
|
87
|
+
## Live terminal check
|
|
88
|
+
|
|
89
|
+
Encoded-frame specs do not prove display or notifications. Check these cases
|
|
90
|
+
manually in Rex or tmux against a built gem before making a display claim:
|
|
91
|
+
|
|
92
|
+
1. Create `sample.rb` with a clean file and `slow_cop.rb` with a slow cop:
|
|
93
|
+
|
|
94
|
+
```ruby
|
|
95
|
+
# frozen_string_literal: true
|
|
96
|
+
|
|
97
|
+
module RuboCop
|
|
98
|
+
module Cop
|
|
99
|
+
module Manual
|
|
100
|
+
class Slow < Base
|
|
101
|
+
def on_send(_node)
|
|
102
|
+
200.times { sleep 0.1 }
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
2. Run the slow inspection and confirm working status is visible during the
|
|
111
|
+
cop delay, then `done` on exit 0:
|
|
112
|
+
|
|
113
|
+
```sh
|
|
114
|
+
RUBOCOP_OSC7501=force bundle exec rubocop --no-server \
|
|
115
|
+
--require rubocop/osc7501 --require ./slow_cop.rb \
|
|
116
|
+
--format progress --format RuboCop::OSC7501::Formatter sample.rb
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
3. Add an offense and repeat without the slow cop. Confirm `error` accompanies
|
|
120
|
+
exit 1 and the ordinary offense output remains readable.
|
|
121
|
+
4. Start the slow command again and press Ctrl-C once. Confirm `idle` is shown
|
|
122
|
+
and the process exits nonzero without a second record.
|
|
123
|
+
5. Repeat with `RUBOCOP_OSC7501=off` and confirm no status is shown.
|
|
124
|
+
|
|
125
|
+
Live Rex and tmux acceptance was not run on 2026-11-13. Record the terminal,
|
|
126
|
+
tmux and gem versions when someone performs it.
|
data/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
data/README.md
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
# rubocop-osc7501
|
|
2
|
+
|
|
3
|
+
Report finite direct RuboCop inspections through OSC 7501 terminal status while
|
|
4
|
+
preserving ordinary formatter output and exit behavior.
|
|
5
|
+
|
|
6
|
+
Requires MRI Ruby 2.1 or newer and RuboCop 0.52.0 or newer. The runtime
|
|
7
|
+
dependency is RuboCop only.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```ruby
|
|
12
|
+
# Gemfile
|
|
13
|
+
gem 'rubocop-osc7501', require: false
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Run `bundle install`.
|
|
17
|
+
|
|
18
|
+
## Use
|
|
19
|
+
|
|
20
|
+
Select the formatter alongside the ordinary formatter you already use:
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
bundle exec rubocop --require rubocop/osc7501 \
|
|
24
|
+
--format progress --format RuboCop::OSC7501::Formatter
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
On RuboCop versions with the server, add `--no-server` for the supported
|
|
28
|
+
direct-process path:
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
bundle exec rubocop --no-server --require rubocop/osc7501 \
|
|
32
|
+
--format progress --format RuboCop::OSC7501::Formatter
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Selecting only the OSC formatter deliberately requests no ordinary diagnostics.
|
|
36
|
+
|
|
37
|
+
Equivalent project arguments preserve your formatter selection:
|
|
38
|
+
|
|
39
|
+
```text
|
|
40
|
+
--require rubocop/osc7501
|
|
41
|
+
--format progress
|
|
42
|
+
--format RuboCop::OSC7501::Formatter
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
`examples/.rubocop` is a RuboCop argument file, not YAML. It contains the
|
|
46
|
+
`--require` and formatter arguments above. Copy it beside `.rubocop.yml` when
|
|
47
|
+
every invocation from that directory should select both formatters. Do not add
|
|
48
|
+
these arguments to a shared configuration when other users do not have the gem.
|
|
49
|
+
|
|
50
|
+
Requiring `rubocop/osc7501` registers the formatter and installs inert hooks.
|
|
51
|
+
Without formatter selection, or with reporting off, an inspection produces no
|
|
52
|
+
records.
|
|
53
|
+
|
|
54
|
+
## Output controls
|
|
55
|
+
|
|
56
|
+
| Setting | Behavior |
|
|
57
|
+
| --- | --- |
|
|
58
|
+
| `RUBOCOP_OSC7501=auto` | Default. Report when the selected formatter output is a TTY and `TERM` is not `dumb`. |
|
|
59
|
+
| `RUBOCOP_OSC7501=force` | Report even to redirected output or a file. |
|
|
60
|
+
| `RUBOCOP_OSC7501=off` | Disable reporting and bypass eager formatter construction. |
|
|
61
|
+
| any other value | Raise `ArgumentError` for a selected inspection. |
|
|
62
|
+
|
|
63
|
+
RuboCop assigns each formatter its own output. Existing `--out` destinations
|
|
64
|
+
remain attached to their original formatter. When reporting is enabled and that
|
|
65
|
+
output is a File, the adapter writes through its own duplicate so the final
|
|
66
|
+
record survives RuboCop closing the original. It closes only that duplicate.
|
|
67
|
+
|
|
68
|
+
## What is reported
|
|
69
|
+
|
|
70
|
+
One root record per supported invocation has `app=rubocop`, `title=RuboCop`, no
|
|
71
|
+
identity and no numeric progress. The first frame appears before target
|
|
72
|
+
discovery and old parallel cache warming. Results use an aggregate message such
|
|
73
|
+
as `3/10 file results, 7 reported offenses`. The adapter does not claim a
|
|
74
|
+
current filename or recompute RuboCop's failure threshold.
|
|
75
|
+
|
|
76
|
+
File-result updates are throttled to one per 0.1 seconds on a monotonic clock.
|
|
77
|
+
Initial and final records bypass the throttle. Counts reflect delivered
|
|
78
|
+
formatter callbacks and their displayed offenses.
|
|
79
|
+
|
|
80
|
+
Normal return with status 0 reports `done`. A nonzero status reports `error`.
|
|
81
|
+
A captured runner abort reports `idle`, so the first Ctrl-C does not appear as a
|
|
82
|
+
lint failure. An escaping `Interrupt` or successful `SystemExit` reports
|
|
83
|
+
`idle`. An unsuccessful `SystemExit` or other escaping exception reports
|
|
84
|
+
`error`. The exception identity and exit status stay unchanged. The formatter's
|
|
85
|
+
`finished` callback never publishes a terminal result.
|
|
86
|
+
|
|
87
|
+
## Boundaries
|
|
88
|
+
|
|
89
|
+
Supported: finite direct CLI inspections, including autocorrection, fail-level,
|
|
90
|
+
fail-fast, parallel runs, multiple formatters, and `--out` files. Help,
|
|
91
|
+
version, show-cops, docs/explain, LSP, MCP, initialization, target listing and
|
|
92
|
+
automatic configuration generation produce no records. Embedded `Runner` calls
|
|
93
|
+
without a CLI invocation are outside scope.
|
|
94
|
+
|
|
95
|
+
Server, editor and watch sessions are not supported in the first release. Auto
|
|
96
|
+
mode naturally stays silent when output is redirected, and force is a detection
|
|
97
|
+
override rather than a server claim. The adapter never reopens `/dev/tty`,
|
|
98
|
+
installs a signal handler, or adds an `at_exit` hook. A second Ctrl-C using
|
|
99
|
+
immediate exit, `SIGKILL`, and other forced termination can leave the last record
|
|
100
|
+
in place.
|
|
101
|
+
|
|
102
|
+
Earlier formatter construction is intentional: the adapter builds the
|
|
103
|
+
configured native formatter set before discovery so reporting starts early.
|
|
104
|
+
This can open configured output files before a target discovery failure. A
|
|
105
|
+
formatter set that returns successfully has its still-open File outputs closed
|
|
106
|
+
during cleanup. If construction fails partway, native partial allocations are
|
|
107
|
+
left as RuboCop made them, adapter-owned duplicates are closed, and the primary
|
|
108
|
+
exception is preserved. The adapter does not reconstruct the native set.
|
|
109
|
+
|
|
110
|
+
Concurrent independent top-level invocations can overwrite the same terminal
|
|
111
|
+
root record, as with the sibling gems. No terminal, display, dismissal or
|
|
112
|
+
notification guarantee follows from encoded frames. Live Rex and tmux
|
|
113
|
+
acceptance has not been verified.
|
|
114
|
+
|
|
115
|
+
Messages are bounded to 2048 decoded UTF-8 bytes after ANSI, control and
|
|
116
|
+
whitespace sanitization. Terminal formatting is removed. Writer I/O failures
|
|
117
|
+
disable reporting without closing borrowed streams or replacing the command's
|
|
118
|
+
result.
|
|
119
|
+
|
|
120
|
+
## Compatibility
|
|
121
|
+
|
|
122
|
+
The candidate floor is MRI Ruby 2.1 and RuboCop 0.52.0, derived from
|
|
123
|
+
`CLI#execute_runners`, `Runner#aborting?` and the formatter API. No upper bound
|
|
124
|
+
is claimed.
|
|
125
|
+
|
|
126
|
+
Executed acceptance on 2026-11-13:
|
|
127
|
+
|
|
128
|
+
| Ruby | RuboCop | Result |
|
|
129
|
+
| --- | --- | --- |
|
|
130
|
+
| 2.1.10 | 0.52.0 | compatibility harness passed |
|
|
131
|
+
| 2.1.10 | 0.57.2 | compatibility harness passed |
|
|
132
|
+
| 2.6.5 | 1.50.0 | compatibility harness passed |
|
|
133
|
+
| 3.4.12 | 1.80.0 | compatibility harness passed |
|
|
134
|
+
| 3.4.12 | 1.92.2 | specs and compatibility harness passed |
|
|
135
|
+
| 3.4.12 | 0.52.0 | not supported: RuboCop fails before inspection on Psych `safe_load` arity |
|
|
136
|
+
|
|
137
|
+
Ruby 2.4 with RuboCop 1.0.0 was not available on the implementation machine.
|
|
138
|
+
Ruby 3.4 with RuboCop 0.52.0 installs after adding current standard-library
|
|
139
|
+
gems, then fails inside RuboCop before inspection with `Psych.safe_load` arity
|
|
140
|
+
(`given 5, expected 1`). That pair is not supported. macOS hosted checks and
|
|
141
|
+
the remaining CI matrix were not run locally. An unavailable runtime is a
|
|
142
|
+
verification limit, not evidence of compatibility. Other Ruby engines are
|
|
143
|
+
unverified.
|
|
144
|
+
|
|
145
|
+
## Development
|
|
146
|
+
|
|
147
|
+
```sh
|
|
148
|
+
bundle install
|
|
149
|
+
bundle exec rake
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
The default task runs RuboCop, bundler-audit, actionlint, inline RBS checks,
|
|
153
|
+
specs, and installed-gem smoke tests. `bundle exec rspec` runs specs alone.
|
|
154
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for compatibility lanes, typing and
|
|
155
|
+
release setup. Report vulnerabilities through [SECURITY.md](SECURITY.md).
|
data/SECURITY.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Security policy
|
|
2
|
+
|
|
3
|
+
## Supported versions
|
|
4
|
+
|
|
5
|
+
I provide security fixes for the latest released version of rubocop-osc7501.
|
|
6
|
+
Upgrade before checking whether a problem still occurs. Older releases do not
|
|
7
|
+
receive security backports.
|
|
8
|
+
|
|
9
|
+
## Report a vulnerability
|
|
10
|
+
|
|
11
|
+
Use [GitHub private vulnerability reporting](https://github.com/cosgroveb/rubocop-osc7501/security/advisories/new).
|
|
12
|
+
Do not disclose vulnerabilities in public issues or pull requests.
|
|
13
|
+
|
|
14
|
+
Include the affected gem, Ruby, RuboCop and terminal versions, reproduction
|
|
15
|
+
steps, and impact. Remove credentials and unrelated private data. I coordinate
|
|
16
|
+
fix and disclosure timing with the reporter and cannot guarantee deadlines.
|
|
17
|
+
|
|
18
|
+
For ordinary bugs, use the [issue tracker](https://github.com/cosgroveb/rubocop-osc7501/issues).
|
data/examples/.rubocop
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# rbs_inline: enabled
|
|
3
|
+
|
|
4
|
+
require 'rubocop/formatter/base_formatter'
|
|
5
|
+
require_relative 'lifecycle'
|
|
6
|
+
require_relative 'writer'
|
|
7
|
+
|
|
8
|
+
module RuboCop
|
|
9
|
+
module OSC7501
|
|
10
|
+
# Native RuboCop formatter selected alongside ordinary output. It only
|
|
11
|
+
# observes callbacks; the private lifecycle owns election and outcomes.
|
|
12
|
+
class Formatter < RuboCop::Formatter::BaseFormatter
|
|
13
|
+
# @rbs @invocation: Lifecycle::Invocation?
|
|
14
|
+
# @rbs @writer: Writer?
|
|
15
|
+
|
|
16
|
+
#: (untyped output, ?untyped options) -> void
|
|
17
|
+
def initialize(output, options = {})
|
|
18
|
+
super
|
|
19
|
+
@invocation = Lifecycle.current
|
|
20
|
+
@writer = nil
|
|
21
|
+
invocation = @invocation
|
|
22
|
+
return unless invocation
|
|
23
|
+
# v1 selection is the documented Formatter class only, so subclasses cannot win election.
|
|
24
|
+
return unless self.class.equal?(Formatter)
|
|
25
|
+
return if invocation.reporter
|
|
26
|
+
|
|
27
|
+
writer = Writer.new(output, mode: invocation.mode)
|
|
28
|
+
@writer = writer
|
|
29
|
+
invocation.add_formatter(self, writer)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
#: (untyped files) -> nil
|
|
33
|
+
def started(files)
|
|
34
|
+
invocation = @invocation
|
|
35
|
+
invocation.started(self, files.length) if invocation
|
|
36
|
+
nil
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
#: (untyped file, untyped offenses) -> nil
|
|
40
|
+
def file_finished(_file, offenses)
|
|
41
|
+
invocation = @invocation
|
|
42
|
+
invocation.file_finished(self, offenses) if invocation
|
|
43
|
+
nil
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|