standard 1.39.0 → 1.39.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +1 -1
- data/.github/workflows/update.yml +2 -2
- data/CHANGELOG.md +9 -0
- data/Gemfile.lock +1 -1
- data/README.md +39 -23
- data/lib/ruby_lsp/standard/addon.rb +1 -1
- data/lib/standard/lsp/diagnostic.rb +8 -2
- data/lib/standard/lsp/routes.rb +8 -1
- data/lib/standard/lsp/stdin_rubocop_runner.rb +5 -3
- data/lib/standard/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d4af941058eb542737ef5766b38878bf776cc1d2c2f63483259a083289d6ead
|
4
|
+
data.tar.gz: bb2ee384fe411f73b28a82dc71b7076c9fe5d434484d1ee2f86b71244a73724f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3660c9dbacfb529228e9a537993b8a3a7890be024dc8c4c58483d2a49c6068b0b717ee75fc2ff4b854fdd60f3dfd3c20e6591fe7dd2a556c190ad1fadc78ca18
|
7
|
+
data.tar.gz: 5f52474c6dc41df0cf2df552931c73c905cd5316c68081bfc893ac15a2fe4ef6ec7db37e1883ffbff2444b9a668c625b135e0ac5ac5741de90cefceb0978af71
|
data/.github/workflows/test.yml
CHANGED
@@ -14,7 +14,7 @@ jobs:
|
|
14
14
|
runs-on: ubuntu-latest
|
15
15
|
|
16
16
|
steps:
|
17
|
-
- uses: actions/checkout@
|
17
|
+
- uses: actions/checkout@v4
|
18
18
|
- name: Set up Ruby
|
19
19
|
uses: ruby/setup-ruby@v1
|
20
20
|
with:
|
@@ -45,7 +45,7 @@ jobs:
|
|
45
45
|
id: date
|
46
46
|
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
|
47
47
|
- name: Create Pull Request
|
48
|
-
uses: peter-evans/create-pull-request@
|
48
|
+
uses: peter-evans/create-pull-request@v6
|
49
49
|
with:
|
50
50
|
reviewers: camilopayan
|
51
51
|
commit-message: '[ ${{ steps.date.outputs.date }} ] - Update dependencies'
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,15 @@
|
|
2
2
|
|
3
3
|
## Unreleased
|
4
4
|
|
5
|
+
## 1.39.2
|
6
|
+
|
7
|
+
* Ensure a URI scheme on file paths from the built-in LSP [#642](https://github.com/standardrb/standard/pull/642).
|
8
|
+
|
9
|
+
## 1.39.1
|
10
|
+
|
11
|
+
* Fix LSP when `format` is set [#638](https://github.com/standardrb/standard/issues/638)
|
12
|
+
* Fix LSP when todo is present (I think) [vscode-standard-ruby#26](https://github.com/standardrb/vscode-standard-ruby/issues/26)
|
13
|
+
|
5
14
|
## 1.39.0
|
6
15
|
|
7
16
|
* Add support for LSP Code Actions / Quick Fix under Ruby LSP [#636](https://github.com/standardrb/standard/pull/636)
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -11,7 +11,8 @@ configuration** to all of RuboCop's built-in rules as well as those included in
|
|
11
11
|
[rubocop-performance](https://github.com/rubocop/rubocop-performance). It also
|
12
12
|
supports plugins built with
|
13
13
|
[lint_roller](https://github.com/standardrb/lint_roller), like
|
14
|
-
[standard-rails](https://github.com/standardrb/standard-rails)
|
14
|
+
[standard-rails](https://github.com/standardrb/standard-rails) and
|
15
|
+
[standard-sorbet](https://github.com/standardrb/standard-sorbet).
|
15
16
|
|
16
17
|
Standard Ruby was created and is maintained by the team at [Test
|
17
18
|
Double](https://testdouble.com), because we appreciate the importance of
|
@@ -35,7 +36,7 @@ good idea. People also agree it's easier to work in codebases that exhibit a
|
|
35
36
|
consistent style and format. So, what's the problem? **No two developers will
|
36
37
|
ever agree on what all the rules and format should be.**
|
37
38
|
|
38
|
-
This has resulted in innumerable teams arguing how to configure their linters
|
39
|
+
This has resulted in innumerable teams arguing about how to configure their linters
|
39
40
|
and formatters over literal decades. Some teams routinely divert time and energy
|
40
41
|
from whatever they're building to reach consensus on where commas should go.
|
41
42
|
Other teams have an overzealous tech lead who sets up everything _his favorite
|
@@ -76,17 +77,18 @@ is in using one at all and not in the particulars of how it's configured.
|
|
76
77
|
### Install
|
77
78
|
|
78
79
|
Getting started is as easy as `gem install standard` or throwing it in your
|
79
|
-
project's Gemfile
|
80
|
+
project's Gemfile and running `bundle install`:
|
80
81
|
|
81
82
|
```ruby
|
82
|
-
gem "standard"
|
83
|
+
gem "standard"
|
83
84
|
```
|
84
85
|
|
85
|
-
### Running Standard
|
86
|
+
### Running Standard Ruby
|
86
87
|
|
87
|
-
Once installed, you can
|
88
|
+
Once installed, you can run Standard from the command line via its built-in
|
89
|
+
executable or as a Rake task.
|
88
90
|
|
89
|
-
|
91
|
+
Standard Ruby's binary is named `standardrb` to distinguish it from
|
90
92
|
[StandardJS](https://github.com/standard/standard):
|
91
93
|
|
92
94
|
```
|
@@ -137,8 +139,8 @@ $ rake standard:fix_unsafely
|
|
137
139
|
|
138
140
|
So long as your code is checked into source control, there's no mortal harm in
|
139
141
|
running with unsafe fixes enabled. If the changes look good to you and your
|
140
|
-
tests pass, then it's probably
|
141
|
-
by hand.
|
142
|
+
tests pass, then it's probably no more error prone than manually editing
|
143
|
+
every change by hand.
|
142
144
|
|
143
145
|
## Integrating Standard into your workflow
|
144
146
|
|
@@ -151,7 +153,7 @@ continuous integration systems.
|
|
151
153
|
|
152
154
|
We've added a number of editing guides for getting started:
|
153
155
|
|
154
|
-
- [VS Code](https://github.com/standardrb/vscode
|
156
|
+
- [VS Code](https://github.com/standardrb/standard/wiki/IDE:-vscode)
|
155
157
|
- [vim](https://github.com/standardrb/standard/wiki/IDE:-vim)
|
156
158
|
- [neovim](https://github.com/standardrb/standard/wiki/IDE:-neovim)
|
157
159
|
- [RubyMine](https://www.jetbrains.com/help/ruby/rubocop.html#disable_rubocop)
|
@@ -165,19 +167,32 @@ added!
|
|
165
167
|
|
166
168
|
#### Language Server Protocol support
|
167
169
|
|
168
|
-
If you don't see your preferred editor above, Standard Ruby also
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
170
|
+
If you don't see your preferred editor above, Standard Ruby also offers robust
|
171
|
+
[language server](https://microsoft.github.io/language-server-protocol/) support,
|
172
|
+
in two ways, both included with the `standard` gem:
|
173
|
+
|
174
|
+
1. A [Ruby LSP](https://github.com/Shopify/ruby-lsp) add-on, which (if
|
175
|
+
the `standard` gem is in your `Gemfile`) will be loaded automatically
|
176
|
+
2. A language server executable, which can be run from the command line
|
177
|
+
with `standardrb --lsp`
|
178
|
+
|
179
|
+
| Capability | Ruby LSP Add-on | Internal Server |
|
180
|
+
| ------------- | ------------- | ------------- |
|
181
|
+
| Diagnostics (Linting) | ✅ ([Pull](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_pullDiagnostics)) | ✅ ([Push](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_publishDiagnostics)) |
|
182
|
+
| [Formatting](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_formatting) | ✅ | ✅ |
|
183
|
+
| [Code Actions](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_codeAction) | ✅ | ❌ |
|
184
|
+
| Everything else | ❌ | ❌ |
|
185
|
+
|
186
|
+
Due to the advantages of Pull diagnostics and its inclusion of Code Actions
|
187
|
+
("Quick Fixes" in VS Code parlance), we recommend using Standard's [Ruby LSP
|
188
|
+
add-on](https://github.com/standardrb/standard/wiki/IDE:-vscode#using-ruby-lsp)
|
189
|
+
where possible.
|
190
|
+
|
191
|
+
Regardless of which language server you use, many editors have added LSP
|
192
|
+
support, with each bringing their own approach to configuration. Many LSP
|
193
|
+
features should "just work", but when in doubt, please consult our [editor
|
194
|
+
guides above](#editor-support) as well as your editor's own documentation on how
|
195
|
+
to configure LSP formatters and linters.
|
181
196
|
|
182
197
|
### CI support
|
183
198
|
|
@@ -477,6 +492,7 @@ Here are a few examples of Ruby Standard-compliant teams & projects:
|
|
477
492
|
* [Brave Software](https://github.com/brave-intl/publishers)
|
478
493
|
* [Collective Idea](https://collectiveidea.com/)
|
479
494
|
* [Culture Foundry](https://www.culturefoundry.com/)
|
495
|
+
* [Datadog](https://www.datadoghq.com/)
|
480
496
|
* [Donut](https://www.donut.com/)
|
481
497
|
* [Elevate Labs](https://elevatelabs.com)
|
482
498
|
* [Envoy](https://www.envoy.com)
|
@@ -36,7 +36,7 @@ module RubyLsp
|
|
36
36
|
register_options: Interface::DidChangeWatchedFilesRegistrationOptions.new(
|
37
37
|
watchers: [
|
38
38
|
Interface::FileSystemWatcher.new(
|
39
|
-
glob_pattern: "**/.standard.yml",
|
39
|
+
glob_pattern: "**/.standard{,_todo}.yml",
|
40
40
|
kind: Constant::WatchKind::CREATE | Constant::WatchKind::CHANGE | Constant::WatchKind::DELETE
|
41
41
|
)
|
42
42
|
]
|
@@ -82,7 +82,7 @@ module Standard
|
|
82
82
|
document_changes: [
|
83
83
|
Interface::TextDocumentEdit.new(
|
84
84
|
text_document: Interface::OptionalVersionedTextDocumentIdentifier.new(
|
85
|
-
uri: @uri.to_s,
|
85
|
+
uri: ensure_uri_scheme(@uri.to_s).to_s,
|
86
86
|
version: nil
|
87
87
|
),
|
88
88
|
edits: correctable? ? offense_replacements : []
|
@@ -113,7 +113,7 @@ module Standard
|
|
113
113
|
document_changes: [
|
114
114
|
Interface::TextDocumentEdit.new(
|
115
115
|
text_document: Interface::OptionalVersionedTextDocumentIdentifier.new(
|
116
|
-
uri: @uri.to_s,
|
116
|
+
uri: ensure_uri_scheme(@uri.to_s).to_s,
|
117
117
|
version: nil
|
118
118
|
),
|
119
119
|
edits: line_disable_comment
|
@@ -163,6 +163,12 @@ module Standard
|
|
163
163
|
def correctable?
|
164
164
|
!@offense.corrector.nil?
|
165
165
|
end
|
166
|
+
|
167
|
+
def ensure_uri_scheme(uri)
|
168
|
+
uri = URI.parse(uri)
|
169
|
+
uri.scheme = "file" if uri.scheme.nil?
|
170
|
+
uri
|
171
|
+
end
|
166
172
|
end
|
167
173
|
end
|
168
174
|
end
|
data/lib/standard/lsp/routes.rb
CHANGED
@@ -72,8 +72,15 @@ module Standard
|
|
72
72
|
@logger.puts "Ignoring workspace/didChangeConfiguration"
|
73
73
|
end
|
74
74
|
|
75
|
+
CONFIGURATION_FILE_PATTERNS = [
|
76
|
+
".standard.yml",
|
77
|
+
".standard_todo.yml"
|
78
|
+
].freeze
|
79
|
+
|
75
80
|
handle "workspace/didChangeWatchedFiles" do |request|
|
76
|
-
if request[:params][:changes].any? { |change|
|
81
|
+
if request[:params][:changes].any? { |change|
|
82
|
+
CONFIGURATION_FILE_PATTERNS.any? { |path| change[:uri].end_with?(path) }
|
83
|
+
}
|
77
84
|
@logger.puts "Configuration file changed; restart required"
|
78
85
|
@kills_server.call
|
79
86
|
end
|
@@ -12,8 +12,10 @@ module Standard
|
|
12
12
|
DEFAULT_RUBOCOP_OPTIONS = {
|
13
13
|
stderr: true,
|
14
14
|
force_exclusion: true,
|
15
|
-
|
16
|
-
raise_cop_error: true
|
15
|
+
formatters: ["RuboCop::Formatter::BaseFormatter"],
|
16
|
+
raise_cop_error: true,
|
17
|
+
todo_file: nil,
|
18
|
+
todo_ignore_files: []
|
17
19
|
}.freeze
|
18
20
|
|
19
21
|
def initialize(config)
|
@@ -27,7 +29,7 @@ module Standard
|
|
27
29
|
super(
|
28
30
|
config.rubocop_options.merge(DEFAULT_RUBOCOP_OPTIONS),
|
29
31
|
config.rubocop_config_store
|
30
|
-
|
32
|
+
)
|
31
33
|
end
|
32
34
|
|
33
35
|
def run(path, contents)
|
data/lib/standard/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: standard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.39.
|
4
|
+
version: 1.39.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Searls
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -188,7 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
188
188
|
- !ruby/object:Gem::Version
|
189
189
|
version: '0'
|
190
190
|
requirements: []
|
191
|
-
rubygems_version: 3.5.
|
191
|
+
rubygems_version: 3.5.14
|
192
192
|
signing_key:
|
193
193
|
specification_version: 4
|
194
194
|
summary: Ruby Style Guide, with linter & automatic code fixer
|