standard 1.27.0 → 1.28.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +18 -0
- data/Gemfile +6 -4
- data/Gemfile.lock +10 -7
- data/LICENSE.txt +3 -4
- data/README.md +353 -465
- data/bin/console +0 -4
- data/bin/run +9 -0
- data/config/base.yml +0 -161
- data/config/default.yml +9 -0
- data/config/ruby-2.2.yml +0 -3
- data/docs/ARCHITECTURE.md +31 -0
- data/lib/standard/base/plugin.rb +65 -0
- data/lib/standard/base.rb +8 -0
- data/lib/standard/creates_config_store/assigns_rubocop_yaml.rb +1 -35
- data/lib/standard/creates_config_store/merges_user_config_extensions.rb +21 -51
- data/lib/standard/creates_config_store.rb +2 -0
- data/lib/standard/formatter.rb +1 -1
- data/lib/standard/loads_yaml_config.rb +1 -0
- data/lib/standard/plugin/combines_plugin_configs.rb +15 -0
- data/lib/standard/plugin/creates_runner_context.rb +15 -0
- data/lib/standard/plugin/determines_class_constant.rb +56 -0
- data/lib/standard/plugin/initializes_plugins.rb +23 -0
- data/lib/standard/plugin/merges_plugins_into_rubocop_config.rb +158 -0
- data/lib/standard/plugin/standardizes_configured_plugins.rb +37 -0
- data/lib/standard/plugin.rb +11 -0
- data/lib/standard/railtie.rb +1 -1
- data/lib/standard/runners/help.rb +2 -2
- data/lib/standard/runners/rubocop.rb +1 -1
- data/lib/standard/version.rb +1 -1
- data/lib/standard.rb +5 -2
- data/standard.gemspec +5 -2
- metadata +54 -15
- data/lib/standard/cop/block_single_line_braces.rb +0 -96
data/README.md
CHANGED
@@ -1,295 +1,247 @@
|
|
1
|
-
|
1
|
+
<img src="https://user-images.githubusercontent.com/79303/233717126-9fd13e6d-9a66-4f1c-b40c-fe875cb1d1b4.png" style="width: 100%"/>
|
2
2
|
|
3
|
-
[![Tests](https://github.com/
|
4
|
-
[![Ruby Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/
|
3
|
+
[![Tests](https://github.com/standardrb/standard/actions/workflows/test.yml/badge.svg)](https://github.com/standardrb/standard/actions/workflows/test.yml)
|
4
|
+
[![Ruby Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/standardrb/standard)
|
5
5
|
[![Gem Version](https://badge.fury.io/rb/standard.svg)](https://rubygems.org/gems/standard)
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
The `standard` gem brings the ethos of [StandardJS](https://standardjs.com) to
|
8
|
+
Ruby. It's a linter & formatter built on
|
9
|
+
[RuboCop](https://github.com/rubocop/rubocop) and provides an **unconfigurable
|
10
|
+
configuration** to all of RuboCop's built-in rules as well as those included in
|
11
|
+
[rubocop-performance](https://github.com/rubocop/rubocop-performance). It also
|
12
|
+
supports plugins built with
|
13
|
+
[lint_roller](https://github.com/standardrb/lint_roller), like
|
14
|
+
[standard-rails](https://github.com/standardrb/standard-rails).
|
15
|
+
|
16
|
+
Standard Ruby was created and is maintained by the team at [Test
|
17
|
+
Double](https://testdouble.com), because we appreciate the importance of
|
18
|
+
balancing predictably consistent code with preserving developers' autonomy. 💚
|
19
|
+
|
20
|
+
Topics covered in this README:
|
21
|
+
|
22
|
+
* [Wait, what?!](#wait-did-you-say-unconfigurable-configuration)
|
23
|
+
* [Basic usage](#usage)
|
24
|
+
* [Editor & CI integrations](#integrating-standard-into-your-workflow)
|
25
|
+
* [Ignoring errors](#ignoring-errors)
|
26
|
+
* [Configuration options](#configuring-standard)
|
27
|
+
* [Plugins and extensions](#extending-standard)
|
28
|
+
* [Community](#who-uses-standard-ruby)
|
29
|
+
|
30
|
+
## Wait, did you say unconfigurable configuration?
|
31
|
+
|
32
|
+
Yes, Standard is unconfigurable. See, pretty much every developer can agree that
|
33
|
+
automatically identifying and fixing slow, insecure, and error-prone code is a
|
34
|
+
good idea. People also agree it's easier to work in codebases that exhibit a
|
35
|
+
consistent style and format. So, what's the problem? **No two developers will
|
36
|
+
ever agree on what all the rules and format should be.**
|
37
|
+
|
38
|
+
This has resulted in innumerable teams arguing how to configure their linters
|
39
|
+
and formatters over literal decades. Some teams routinely divert time and energy
|
40
|
+
from whatever they're building to reach concensus on where commas should go.
|
41
|
+
Other teams have an overzealous tech lead who sets up everything _his favorite
|
42
|
+
way_ and then imposes his will on others. It's not uncommon to witness
|
43
|
+
passive-aggressive programmers change a contentious rule back-and-forth,
|
44
|
+
resulting in both acrimony and git churn (and acrimony _about_ git churn).
|
45
|
+
Still, most developers give way to whoever cares more, often resulting in an
|
46
|
+
inconsistent configuration that nobody understands and isn't kept up-to-date
|
47
|
+
with changes to their linter and its target language. Whatever the approach,
|
48
|
+
time spent
|
49
|
+
[bikeshedding](https://blog.testdouble.com/posts/2019-09-17-bike-shed-history/)
|
50
|
+
is time wasted.
|
51
|
+
|
52
|
+
**But you can't configure Standard Ruby.** You can take it or leave it. If this
|
53
|
+
seems presumptive, constraining, and brusque: you're right, it usually does feel
|
54
|
+
that way at first. But [since
|
55
|
+
2018](https://www.youtube.com/watch?v=uLyV5hOqGQ8), the Ruby community has
|
56
|
+
debated Standard Ruby's ruleset, ultimately landing us on a
|
57
|
+
[sensible](/config/base.yml)
|
58
|
+
[set](https://github.com/standardrb/standard-performance/blob/main/config/base.yml)
|
59
|
+
of
|
60
|
+
[defaults](https://github.com/standardrb/standard-custom/blob/main/config/base.yml)
|
61
|
+
that—_while no one person's favorite way to format Ruby_—seems to be good enough
|
62
|
+
for most of the ways people use Ruby, most of the time.
|
63
|
+
|
64
|
+
If you adopt Standard Ruby, what's in it for you? Time saved that would've been
|
65
|
+
spent arguing over how to set things up. Also, seamless upgrades: we stay on top
|
66
|
+
of each new RuboCop rule ship an updated configuration on a monthly release
|
67
|
+
cadence. But the best part of adopting Standard as your linter and formatter?
|
68
|
+
You'll spend a whole lot less time thinking about linters and formatters.
|
69
|
+
|
70
|
+
So please, give Standard Ruby a try. If you're like [these
|
71
|
+
folks](#who-uses-standard-ruby), you'll soon realize that the value of a linter
|
72
|
+
is in using one at all and not in the particulars of how it's configured.
|
9
73
|
|
10
|
-
|
11
|
-
project. Just drop it in.
|
12
|
-
* **Automatically format code.** Just run `standardrb --fix` and say goodbye to
|
13
|
-
messy or inconsistent code.
|
14
|
-
* **Catch style issues & programmer errors early.** Save precious code review
|
15
|
-
time by eliminating back-and-forth between reviewer & contributor.
|
74
|
+
## Usage
|
16
75
|
|
17
|
-
|
18
|
-
⚡](https://www.youtube.com/watch?v=uLyV5hOqGQ8) about it.
|
76
|
+
### Install
|
19
77
|
|
20
|
-
|
78
|
+
Getting started is as easy as `gem install standard` or throwing it in your
|
79
|
+
project's Gemfile:
|
21
80
|
|
22
81
|
```ruby
|
23
82
|
gem "standard", group: [:development, :test]
|
24
83
|
```
|
25
84
|
|
26
|
-
|
27
|
-
|
28
|
-
```ruby
|
29
|
-
$ bundle exec standardrb
|
30
|
-
```
|
85
|
+
### Running Standard
|
31
86
|
|
32
|
-
|
33
|
-
flag.
|
87
|
+
Once installed, you can either run it as a CLI or as a Rake task.
|
34
88
|
|
35
|
-
|
36
|
-
|
37
|
-
variant to our default `rake` task after our test command, similar to this:
|
89
|
+
The CLI is called `standardrb` to distinguish it from
|
90
|
+
[StandardJS](https://github.com/standard/standard):
|
38
91
|
|
39
|
-
```ruby
|
40
|
-
task default: [:test, "standard:fix"]
|
41
92
|
```
|
42
|
-
|
43
|
-
## StandardRB — The Rules
|
44
|
-
|
45
|
-
- **2 spaces** – for indentation
|
46
|
-
- **Double quotes for string literals** - because pre-committing to whether
|
47
|
-
you'll need interpolation in a string slows people down
|
48
|
-
- **1.9 hash syntax** - When all the keys in a hash literal are symbols,
|
49
|
-
Standard enforces Ruby 1.9's `{hash: syntax}`
|
50
|
-
- **Braces for single-line blocks** - Require `{`/`}` for one-line blocks, but
|
51
|
-
allow either braces or `do`/`end` for multiline blocks. Like using `do`/`end`
|
52
|
-
for multiline blocks? Prefer `{`/`}` when chaining? A fan of expressing intent
|
53
|
-
with Jim Weirich's [semantic
|
54
|
-
block](http://www.virtuouscode.com/2011/07/26/the-procedurefunction-block-convention-in-ruby/)
|
55
|
-
approach? Standard lets you do you!
|
56
|
-
- **Leading dots on multi-line method chains** - chosen for
|
57
|
-
[these](https://github.com/testdouble/standard/issues/75) reasons.
|
58
|
-
- **Spaces inside blocks, but not hash literals** - In Ruby, the `{` and `}`
|
59
|
-
characters do a lot of heavy lifting. To visually distinguish hash literals
|
60
|
-
from blocks, Standard enforces that (like arrays), no leading or trailing
|
61
|
-
spaces be added to pad hashes
|
62
|
-
- **And a good deal more**
|
63
|
-
|
64
|
-
If you're familiar with [RuboCop](https://github.com/rubocop-hq/rubocop), you
|
65
|
-
can look at Standard's current base configuration in
|
66
|
-
[config/base.yml](/config/base.yml). In lieu of a separate changelog file,
|
67
|
-
significant changes to the configuration will be documented as [GitHub release
|
68
|
-
notes](https://github.com/testdouble/standard/releases).
|
69
|
-
|
70
|
-
## Usage
|
71
|
-
|
72
|
-
Once you've installed Standard, you should be able to use the `standardrb`
|
73
|
-
program. The simplest use case would be checking the style of all Ruby
|
74
|
-
files in the current working directory:
|
75
|
-
|
76
|
-
```bash
|
77
|
-
$ bundle exec standardrb
|
78
|
-
standard: Use Ruby Standard Style (https://github.com/testdouble/standard)
|
79
|
-
standard: Run `standardrb --fix` to potentially fix one problem.
|
80
|
-
/Users/jill/code/cli.rb:31:23: Style/Semicolon: Do not use semicolons to terminate expressions.
|
93
|
+
$ standardrb
|
81
94
|
```
|
82
95
|
|
83
|
-
|
84
|
-
|
85
|
-
`standardrb` instead of your shell:
|
96
|
+
And the Rake task can be run if your Rakefile includes `require
|
97
|
+
"standard/rake"`. This will load the `standard` task, allowing you to run:
|
86
98
|
|
87
|
-
```bash
|
88
|
-
$ bundle exec standardrb "lib/**/*.rb" test
|
89
99
|
```
|
90
|
-
|
91
|
-
**Note:** by default, StandardRB will look for all `*.rb` files (and some other
|
92
|
-
files typically associated with Ruby like `*.gemspec` and `Gemfile`)
|
93
|
-
|
94
|
-
If you want to add Standard to an existing project, but don't want to stop all
|
95
|
-
development until you've fixed every violation in every file, you can create a
|
96
|
-
backlog of to-be-converted files by generating a TODO file:
|
97
|
-
|
98
|
-
```bash
|
99
|
-
$ bundle exec standardrb --generate-todo
|
100
|
+
$ rake standard
|
100
101
|
```
|
101
102
|
|
102
|
-
|
103
|
-
|
104
|
-
|
103
|
+
Either way, Standard will inspect any Ruby files found in the current directory
|
104
|
+
tree. If any errors are found, it'll report them. If your code is
|
105
|
+
standard-compliant, it will get out of your way by quietly exiting code 0.
|
105
106
|
|
106
|
-
|
107
|
-
can also regenerate the TODO file at any time by re-running the above command.
|
107
|
+
### Fixing errors
|
108
108
|
|
109
|
-
|
109
|
+
A majority of Standard's rules can be safely fixed automatically.
|
110
110
|
|
111
|
-
|
112
|
-
|
113
|
-
|
111
|
+
```
|
112
|
+
# CLI
|
113
|
+
$ standard --fix
|
114
114
|
|
115
|
-
|
116
|
-
|
115
|
+
# Rake
|
116
|
+
$ rake standard:fix
|
117
117
|
```
|
118
118
|
|
119
|
-
|
119
|
+
Because we're confident Standard's fixes won't change the behavior of our code,
|
120
|
+
we typically run with fix enabled _all the time_ because it saves us from having
|
121
|
+
to look at and think about problems the computer can solve for us.
|
120
122
|
|
121
|
-
|
122
|
-
$ rake standard # equivalent to running `standardrb`
|
123
|
-
$ rake standard:fix # equivalent to running `standardrb --fix`
|
124
|
-
$ rake standard:fix_unsafely # equivalent to running `standardrb --fix-unsafely`
|
125
|
-
```
|
123
|
+
### Applying unsafe fixes
|
126
124
|
|
127
|
-
|
128
|
-
|
129
|
-
|
125
|
+
There are a number of other rules that can be automatically remedied, but not
|
126
|
+
without the risk of changing your code's behavior. While we wouldn't recommend
|
127
|
+
running it all the time, if the CLI suggests that additional errors can be fixed
|
128
|
+
_unsafely_, here's how to do that:
|
130
129
|
|
131
130
|
```
|
132
|
-
#
|
133
|
-
$
|
131
|
+
# CLI
|
132
|
+
$ standardrb --fix-unsafely
|
134
133
|
|
135
|
-
#
|
136
|
-
$ rake standard
|
134
|
+
# Rake
|
135
|
+
$ rake standard:fix_unsafely
|
137
136
|
```
|
138
137
|
|
139
|
-
|
138
|
+
So long as your code is checked into source control, there's no mortal harm in
|
139
|
+
running with unsafe fixes enabled. If the changes look good to you and your
|
140
|
+
tests pass, then it's probably less error prone than manually editing everything
|
141
|
+
by hand.
|
140
142
|
|
141
|
-
|
142
|
-
available by creating a `.standard.yml` file in the root of your project.
|
143
|
+
## Integrating Standard into your workflow
|
143
144
|
|
144
|
-
|
145
|
+
Because code formatting is so integral to programming productivity and linter
|
146
|
+
violations risk becoming bugs if released into production, tools like
|
147
|
+
Standard Ruby are only as useful as their integration into code editors and
|
148
|
+
continuous integration systems.
|
145
149
|
|
146
|
-
|
147
|
-
fix: true # default: false
|
148
|
-
parallel: true # default: false
|
149
|
-
format: progress # default: Standard::Formatter
|
150
|
-
ruby_version: 2.3 # default: RUBY_VERSION
|
151
|
-
default_ignores: false # default: true
|
150
|
+
### Editor support
|
152
151
|
|
153
|
-
|
154
|
-
- 'db/schema.rb'
|
155
|
-
- 'vendor/**/*'
|
156
|
-
- 'test/**/*':
|
157
|
-
- Layout/AlignHash
|
158
|
-
```
|
159
|
-
|
160
|
-
Note: If you're running Standard in a context where your `.standard.yml` file
|
161
|
-
cannot be found by ascending the current working directory (i.e., against a
|
162
|
-
temporary file buffer in your editor), you can specify the config location with
|
163
|
-
`--config path/to/.standard.yml`. (Similarly, for the `.standard_todo.yml` file,
|
164
|
-
you can specify `--todo path/to/.standard_todo.yml`.)
|
152
|
+
We've added a number of editing guides for getting started:
|
165
153
|
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
[
|
170
|
-
|
154
|
+
- [VS Code](https://github.com/standardrb/vscode-standard-ruby)
|
155
|
+
- [vim](https://github.com/standardrb/standard/wiki/IDE:-vim)
|
156
|
+
- [neovim](https://github.com/standardrb/standard/wiki/IDE:-neovim)
|
157
|
+
- [RubyMine](https://www.jetbrains.com/help/ruby/rubocop.html#disable_rubocop)
|
158
|
+
- [emacs](https://github.com/julianrubisch/flycheck-standardrb)
|
159
|
+
- [Atom](https://github.com/standardrb/standard/wiki/IDE:-Atom)
|
171
160
|
|
172
|
-
|
173
|
-
|
174
|
-
|
161
|
+
If you'd like to help by creating a guide, please draft one [in an
|
162
|
+
issue](https://github.com/standardrb/standard/issues/new) and we'll get it
|
163
|
+
added!
|
175
164
|
|
176
|
-
|
165
|
+
#### Language Server Protocol support
|
177
166
|
|
178
|
-
|
179
|
-
|
180
|
-
|
167
|
+
If you don't see your preferred editor above, Standard Ruby also ships with a
|
168
|
+
built-in [language
|
169
|
+
server](https://microsoft.github.io/language-server-protocol/) that many modern
|
170
|
+
editors can support natively, even without a Standard-specific plugin.
|
181
171
|
|
182
|
-
|
183
|
-
maintain multiple hundred-line style configuration files for every module/project
|
184
|
-
they work on. Enough of this madness!
|
172
|
+
You can run the server by supplying the `--lsp` flag:
|
185
173
|
|
186
|
-
|
174
|
+
```
|
175
|
+
standard --lsp
|
176
|
+
```
|
187
177
|
|
188
|
-
|
189
|
-
|
190
|
-
- **Automatically format code.** Just run `standardrb --fix` and say goodbye to
|
191
|
-
messy or inconsistent code.
|
192
|
-
- **Catch style issues & programmer errors early.** Save precious code review
|
193
|
-
time by eliminating back-and-forth between reviewer & contributor.
|
194
|
-
- **Deliberate pace.** We strive to take the hassle of upgrading Rubocop out of each
|
195
|
-
individual team's hands and shoulder it ourselves. We enable about ~20% of new
|
196
|
-
cops and generally choose conservative configurations for them.
|
178
|
+
If your editor offers LSP support, it probably has a place to configure the
|
179
|
+
above command and will subsequently manage the server process for you.
|
197
180
|
|
198
|
-
|
199
|
-
community conventions higher than personal style. This might not make sense for
|
200
|
-
100% of projects and development cultures, however open source can be a hostile
|
201
|
-
place for newbies. Setting up clear, automated contributor expectations makes a
|
202
|
-
project healthier.
|
181
|
+
### CI support
|
203
182
|
|
204
|
-
|
183
|
+
Various continuous integration and quality-checking tools have been made to
|
184
|
+
support Standard Ruby, as well.
|
205
185
|
|
206
|
-
|
186
|
+
* [Github Actions](https://github.com/andrewmcodes/standardrb-action)
|
187
|
+
* [Code Climate](https://github.com/standardrb/standard/wiki/CI:-Code-Climate)
|
188
|
+
* [Pronto](https://github.com/julianrubisch/pronto-standardrb)
|
189
|
+
* [Danger](https://github.com/ashfurrow/danger-rubocop/)
|
207
190
|
|
208
|
-
|
209
|
-
|
210
|
-
* [Arrows](https://arrows.to/)
|
211
|
-
* [Avo Admin](https://avohq.io/)
|
212
|
-
* [Babylist](https://www.babylist.com/)
|
213
|
-
* [Brand New Box](https://brandnewbox.com)
|
214
|
-
* [Brave Software](https://github.com/brave-intl/publishers)
|
215
|
-
* [Collective Idea](https://collectiveidea.com/)
|
216
|
-
* [Culture Foundry](https://www.culturefoundry.com/)
|
217
|
-
* [Elevate Labs](https://elevatelabs.com)
|
218
|
-
* [Envoy](https://www.envoy.com)
|
219
|
-
* [Evil Martians](https://evilmartians.com)
|
220
|
-
* [Firstline](https://firstline.org/)
|
221
|
-
* [Hashrocket](https://hashrocket.com)
|
222
|
-
* [Honeybadger](https://www.honeybadger.io)
|
223
|
-
* [JetThoughts](https://www.jetthoughts.com/)
|
224
|
-
* [Level UP Solutions](https://levups.com)
|
225
|
-
* [Monterail](https://www.monterail.com)
|
226
|
-
* [myRent](https://www.myrent.co.nz)
|
227
|
-
* [OBLSK](https://oblsk.com/)
|
228
|
-
* [Oyster](https://www.oysterhr.com/)
|
229
|
-
* [Planet Argon](https://www.planetargon.com/)
|
230
|
-
* [PLT4M](https://plt4m.com/)
|
231
|
-
* [Podia](https://www.podia.com/)
|
232
|
-
* [Rebase Interactive](https://www.rebaseinteractive.com/)
|
233
|
-
* [Renuo](https://www.renuo.ch/)
|
234
|
-
* [RubyCI](https://ruby.ci)
|
235
|
-
* [Spinal](https://spinalcms.com/)
|
236
|
-
* [Teamtailor](https://www.teamtailor.com/)
|
237
|
-
* [thoughtbot](https://thoughtbot.com/)
|
191
|
+
Of course, no special plugin is necessary to run Standard Ruby in a CI
|
192
|
+
environment, as `standardrb` and `rake standard` work just fine on their own!
|
238
193
|
|
239
|
-
|
194
|
+
### Other tools
|
240
195
|
|
241
|
-
|
196
|
+
These tool integrations are also available:
|
242
197
|
|
243
|
-
|
244
|
-
|
245
|
-
style.
|
198
|
+
* [Guard](https://github.com/JodyVanden/guard-standardrb)
|
199
|
+
* [Spring](https://github.com/lakim/spring-commands-standard)
|
246
200
|
|
247
|
-
|
201
|
+
## Ignoring errors
|
248
202
|
|
249
|
-
|
250
|
-
|
251
|
-
|
203
|
+
While Standard is very strict in how each formatting and linting rule is configured,
|
204
|
+
it's mercifully flexible when you need to ignore a violation to focus on a higher
|
205
|
+
priority (like, say, keeping the build running). There are a number of ways to
|
206
|
+
ignore any errors, with the right answer depending on the situation.
|
252
207
|
|
253
|
-
|
208
|
+
### Ignoring a line with a comment
|
254
209
|
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
whole philosophy of Standard -- it's a bunch of sensible 'just pick something'
|
261
|
-
opinions. Hopefully, users see the value in that over defending their own
|
262
|
-
opinions.
|
210
|
+
Individual lines can be ignored with a comment directive at the end of the line.
|
211
|
+
As an example, the line `text = 'hi'` violates two rules,
|
212
|
+
[Lint/UselessAssignment](https://docs.rubocop.org/rubocop/cops_lint.html#lintuselessassignment)
|
213
|
+
and
|
214
|
+
[Style/StringLiterals](https://docs.rubocop.org/rubocop/cops_style.html#stylestringliterals).
|
263
215
|
|
264
|
-
|
265
|
-
you could spend your time solving! :P
|
216
|
+
You could ignore one, both, or all errors with the following comments:
|
266
217
|
|
267
|
-
|
218
|
+
```ruby
|
219
|
+
# Disable one error but keep Lint/UselessAssignment
|
220
|
+
text = 'hi' # standard:disable Style/StringLiterals
|
268
221
|
|
269
|
-
|
222
|
+
# Disable both errors explicitly
|
223
|
+
text = 'hi' # standard:disable Style/StringLiterals, Lint/UselessAssignment
|
270
224
|
|
271
|
-
|
272
|
-
|
225
|
+
# Disable all errors on the line with "all"
|
226
|
+
text = "hi" # standard:disable all
|
227
|
+
```
|
273
228
|
|
274
|
-
|
275
|
-
will also perform fixes, even if they run the risk of altering program behavior.
|
276
|
-
If you read your git diffs closely and have good tests, this is often okay, but
|
277
|
-
YMMV… it's called unsafe for a reason!
|
229
|
+
### Ignoring multiple lines with comments
|
278
230
|
|
279
|
-
|
231
|
+
Similarly to individual lines, you can also disable multiple lines by wrapping
|
232
|
+
them in comments that disable and re-enable them:
|
280
233
|
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
234
|
+
```ruby
|
235
|
+
# standard:disable Style/StringLiterals, Lint/UselessAssignment
|
236
|
+
text = "hi"
|
237
|
+
puts 'bye'
|
238
|
+
# standard:enable Style/StringLiterals, Lint/UselessAssignment
|
239
|
+
```
|
287
240
|
|
288
|
-
|
241
|
+
### Ignoring entire files and globs
|
289
242
|
|
290
|
-
|
291
|
-
|
292
|
-
list of files and globs that should be excluded:
|
243
|
+
You can ignore entire files and file patterns by adding them to `ignore:` in
|
244
|
+
your project's `.standard.yml` file:
|
293
245
|
|
294
246
|
```yaml
|
295
247
|
ignore:
|
@@ -297,159 +249,173 @@ ignore:
|
|
297
249
|
- 'a/whole/directory/**/*'
|
298
250
|
```
|
299
251
|
|
300
|
-
|
301
|
-
[here](https://github.com/testdouble/standard/blob/main/lib/standard/creates_config_store/configures_ignored_paths.rb#L3-L13)
|
252
|
+
### Ignoring specific rules in files and globs
|
302
253
|
|
303
|
-
|
304
|
-
|
305
|
-
In rare cases, you'll need to break a rule and hide the warning generated by
|
306
|
-
Standard.
|
307
|
-
|
308
|
-
Ruby Standard Style uses [RuboCop](https://github.com/rubocop-hq/rubocop)
|
309
|
-
under-the-hood and you can hide warnings as you normally would if you used
|
310
|
-
RuboCop directly.
|
311
|
-
|
312
|
-
To ignore only certain rules from certain globs (not recommended, but maybe your
|
313
|
-
test suite uses a non-standardable DSL, you can specify an array of RuboCop
|
314
|
-
rules to ignore for a particular glob:
|
254
|
+
For a given file or glob, you can even ignore only specific rules by nesting an
|
255
|
+
array of the rules you'd like to ignore:
|
315
256
|
|
316
257
|
```yaml
|
317
258
|
ignore:
|
318
259
|
- 'test/**/*':
|
319
|
-
- Layout/
|
260
|
+
- Layout/AlignHash
|
320
261
|
```
|
321
262
|
|
322
|
-
|
323
|
-
|
324
|
-
You can also use special comments to disable all or certain rules within your
|
325
|
-
source code.
|
263
|
+
### Ignoring every violation and converting them into a todo list
|
326
264
|
|
327
|
-
|
265
|
+
If you're adopting Standard in a large codebase and you don't want to convert
|
266
|
+
everything all at once, you can work incrementally by generating a "todo" file
|
267
|
+
which will cause Standard to ignore every violation present in each file of the
|
268
|
+
codebase.
|
328
269
|
|
329
|
-
|
330
|
-
|
331
|
-
|
270
|
+
This way, you can gradually work through the todo list, removing ignore
|
271
|
+
directives and fixing any associated errors, while also being alerted to any
|
272
|
+
regressions if they're introduced into the project.
|
332
273
|
|
333
|
-
|
274
|
+
Here are the commands you might run to get started:
|
334
275
|
|
335
276
|
```
|
336
|
-
|
277
|
+
# Start by clearing any auto-fixable errors:
|
278
|
+
$ standardrb --fix
|
279
|
+
|
280
|
+
# Generate a `.standard_todo.yml' to work from
|
281
|
+
$ standardrb --generate-todo
|
337
282
|
```
|
338
283
|
|
339
|
-
|
284
|
+
## Configuring Standard
|
340
285
|
|
341
|
-
|
342
|
-
|
343
|
-
```
|
286
|
+
While the rules aren't configurable, Standard offers a number of options that
|
287
|
+
can be configured as CLI flags and YAML properties.
|
344
288
|
|
345
|
-
|
346
|
-
suppress the error and Standard would succeed.
|
289
|
+
### CLI flags
|
347
290
|
|
348
|
-
|
349
|
-
open and closing directives like this:
|
291
|
+
The easiest way to summarize the available CLI flags is to invoke `standardrb -h`:
|
350
292
|
|
351
|
-
```ruby
|
352
|
-
# standard:disable Layout/IndentationWidth
|
353
|
-
def foo
|
354
|
-
123
|
355
|
-
end
|
356
|
-
# standard:enable Layout/IndentationWidth
|
357
293
|
```
|
294
|
+
Usage: standardrb [--fix] [--lsp] [-vh] [--format <name>] [--] [FILE]...
|
358
295
|
|
359
|
-
|
360
|
-
substitute its name for "all". This line actually triggers three different
|
361
|
-
violations, so we can suppress them like this:
|
296
|
+
Options:
|
362
297
|
|
363
|
-
|
364
|
-
|
365
|
-
|
298
|
+
--fix Apply automatic fixes that we're confident won't break your code
|
299
|
+
--fix-unsafely Apply even more fixes, including some that may change code behavior
|
300
|
+
--no-fix Do not automatically fix failures
|
301
|
+
--format <name> Format output with any RuboCop formatter (e.g. "json")
|
302
|
+
--generate-todo Create a .standard_todo.yml that lists all the files that contain errors
|
303
|
+
--lsp Start a LSP server listening on STDIN
|
304
|
+
-v, --version Print the version of Standard
|
305
|
+
-V, --verbose-version Print the version of Standard and its dependencies.
|
306
|
+
-h, --help Print this message
|
307
|
+
FILE Files to lint [default: ./]
|
366
308
|
|
367
|
-
|
309
|
+
Standard also forwards most CLI arguments to RuboCop. To see them, run:
|
368
310
|
|
369
|
-
|
370
|
-
|
371
|
-
that's MRI 2.3 and newer. While Standard can't avoid this runtime requirement,
|
372
|
-
it does allow you to lint codebases that target Ruby versions older than 2.3 by
|
373
|
-
narrowing the ruleset somewhat.
|
311
|
+
$ rubocop --help
|
312
|
+
```
|
374
313
|
|
375
|
-
Standard
|
376
|
-
|
377
|
-
down, you can specify `ruby_version` in `.standard.yml`.
|
314
|
+
If you run Standard via Rake, you can specify your CLI flags in an environment
|
315
|
+
variable named `STANDARDOPTS` like so:
|
378
316
|
|
379
317
|
```
|
380
|
-
|
318
|
+
$ rake standard STANDARDOPTS="--format progress"
|
381
319
|
```
|
382
320
|
|
383
|
-
|
384
|
-
[testdouble/suture](https://github.com/testdouble/suture/blob/main/.standard.yml)
|
385
|
-
for an example.
|
321
|
+
### YAML options
|
386
322
|
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
the runtime, RuboCop may behave in surprising or inconsistent ways.
|
323
|
+
In addition to CLI flags, Standard will search for a `.standard.yml` file
|
324
|
+
(ascending to parent directories if the current working directory doesn't
|
325
|
+
contain one). If you find yourself repeatedly running Standard with the same
|
326
|
+
CLI options, it probably makes more sense to set it once in a YAML file:
|
392
327
|
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
328
|
+
```yaml
|
329
|
+
fix: true # default: false
|
330
|
+
parallel: true # default: false
|
331
|
+
format: progress # default: Standard::Formatter
|
332
|
+
ruby_version: 3.0 # default: RUBY_VERSION
|
333
|
+
default_ignores: false # default: true
|
398
334
|
|
399
|
-
|
335
|
+
ignore: # default: []
|
336
|
+
- 'vendor/**/*'
|
400
337
|
|
401
|
-
|
402
|
-
|
403
|
-
YAML](https://docs.rubocop.org/rubocop/configuration.html) files and
|
404
|
-
`.standard.yml` using the "extend_config` setting.
|
338
|
+
plugins: # default: []
|
339
|
+
- standard-rails
|
405
340
|
|
406
|
-
|
407
|
-
|
341
|
+
extend_config: # default: []
|
342
|
+
- .standard_ext.yml
|
343
|
+
```
|
408
344
|
|
409
|
-
|
410
|
-
# .standard.yml
|
345
|
+
#### Configuring ruby_version
|
411
346
|
|
412
|
-
|
413
|
-
|
414
|
-
|
347
|
+
One notable YAML setting is `ruby_version`, which allows you to set the **oldest
|
348
|
+
version of Ruby the project needs to support** [RuboCop's `TargetRubyVersion`
|
349
|
+
setting](https://docs.rubocop.org/rubocop/configuration.html#setting-the-target-ruby-version)
|
350
|
+
explicitly. Because this value is inferred from any `.ruby-version`,
|
351
|
+
`.tool-versions`, `Gemfile.lock`, and `*.gemspec` files that might be present,
|
352
|
+
most applications won't need to set this.
|
415
353
|
|
416
|
-
|
354
|
+
However, gems and libraries that support older versions of Ruby will want
|
355
|
+
to lock the `ruby-version:` explicitly in their `.standard.yml` file to ensure
|
356
|
+
new rules don't break old rubies:
|
417
357
|
|
418
358
|
```yaml
|
419
|
-
|
420
|
-
|
421
|
-
require:
|
422
|
-
- rubocop-rails
|
359
|
+
ruby_version: 2.7
|
423
360
|
```
|
424
361
|
|
425
|
-
|
426
|
-
and `rake standard` will also execute the default configuration of the
|
427
|
-
`rubocop-rails` gem without needing to invoke `rubocop` separately.
|
362
|
+
## Extending Standard
|
428
363
|
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
configuration file is:
|
364
|
+
Standard includes two extension mechanisms: plugins and configuration
|
365
|
+
extensions. While neither can _change_ the rules configured out-of-the-box by
|
366
|
+
Standard, they can define, require, and configure _additional_ RuboCop rules.
|
433
367
|
|
434
|
-
|
435
|
-
|
368
|
+
Both are "first-in-wins", meaning once a rule is configured by a plugin or
|
369
|
+
extension, it can't be changed or reconfigured by a later plugin or extension.
|
370
|
+
This way, each Standard plugin you add becomes a de facto "standard" of its
|
371
|
+
own. Plugins have precedence over extensions as they are loaded first.
|
436
372
|
|
437
|
-
|
438
|
-
|
373
|
+
### Plugins
|
374
|
+
|
375
|
+
Adding a plugin to your project is as easy as adding it to your Gemfile and
|
376
|
+
specifying it in `.standard.yml` in the root of your project. For example, after
|
377
|
+
installing [standard-rails](https://github.com/standardrb/standard-rails), you
|
378
|
+
can configure it by adding it to `plugins`:
|
379
|
+
|
380
|
+
```yaml
|
381
|
+
plugins:
|
382
|
+
- standard-rails
|
439
383
|
```
|
440
384
|
|
441
|
-
|
442
|
-
|
385
|
+
Each plugin can be passed configuration options by specifying them in a nested
|
386
|
+
hash. For example, `standard-rails` allows you to configure its rules for
|
387
|
+
a particular version of Rails (though this will usually be detected for you
|
388
|
+
automatically):
|
443
389
|
|
444
|
-
```
|
445
|
-
|
390
|
+
```yaml
|
391
|
+
plugins:
|
392
|
+
- standard-rails:
|
393
|
+
target_rails_version: 7.0
|
394
|
+
```
|
395
|
+
|
396
|
+
You can develop your own plugins, too! Check out the
|
397
|
+
[lint_roller](https://github.com/standardrb/lint_roller) gem to learn how. For a
|
398
|
+
simple example, you can look at
|
399
|
+
[standard-custom](https://github.com/standardrb/standard-custom), which is one
|
400
|
+
of the default plugins included by Standard.
|
446
401
|
|
402
|
+
### Extended config files
|
403
|
+
|
404
|
+
Of course, you may want to add more rules without going to the trouble
|
405
|
+
of packaging them in a plugin gem. For cases like this, you can define one or
|
406
|
+
more [RuboCop configuration
|
407
|
+
files](https://docs.rubocop.org/rubocop/configuration.html) and then list them
|
408
|
+
in your `.standard.yml` file under `extend_config`.
|
409
|
+
|
410
|
+
For example, after installing the
|
411
|
+
[betterlint](https://github.com/Betterment/betterlint) gem from our friends at
|
412
|
+
[Betterment](https://www.betterment.com), we could create a RuboCop config
|
413
|
+
file named `.betterlint.yml`:
|
414
|
+
|
415
|
+
```yaml
|
447
416
|
require:
|
448
417
|
- rubocop/cop/betterment.rb
|
449
418
|
|
450
|
-
AllCops:
|
451
|
-
DisabledByDefault: true
|
452
|
-
|
453
419
|
Betterment/UnscopedFind:
|
454
420
|
Enabled: true
|
455
421
|
|
@@ -457,157 +423,79 @@ Betterment/UnscopedFind:
|
|
457
423
|
- SystemConfiguration
|
458
424
|
```
|
459
425
|
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
in order (i.e. last-in-wins).
|
474
|
-
|
475
|
-
### Usage via RuboCop
|
476
|
-
|
477
|
-
If you find that Standard's `extend_config` feature doesn't meet your needs or
|
478
|
-
if you only want to use Standard's rules while continuing to use RuboCop's CLI
|
479
|
-
(e.g., to continue using your favorite IDE/tooling/workflow with RuboCop
|
480
|
-
support) Evil Martians also maintains [a regularly updated
|
426
|
+
And then reference it in our `.standard.yml`:
|
427
|
+
|
428
|
+
```yml
|
429
|
+
extend_config:
|
430
|
+
- .betterlint.yml
|
431
|
+
```
|
432
|
+
|
433
|
+
### Running Standard's rules via RuboCop
|
434
|
+
|
435
|
+
If you find that neither plugins or configuration extensions meet your needs or
|
436
|
+
if you have some other reason to run Standard's rules with RuboCop's CLI (e.g.,
|
437
|
+
to continue using your favorite IDE/tooling/workflow with RuboCop support) Evil
|
438
|
+
Martians also maintains [a regularly updated
|
481
439
|
guide](https://evilmartians.com/chronicles/rubocoping-with-legacy-bring-your-ruby-code-up-to-standard)
|
482
440
|
on how to configure RuboCop to load and execute Standard's ruleset.
|
483
441
|
|
484
|
-
In short, you can configure this in your `.rubocop.yml` to load Standard's
|
485
|
-
|
442
|
+
In short, you can configure this in your `.rubocop.yml` to load Standard's three
|
443
|
+
default rulesets, just as you would any other gem:
|
486
444
|
|
487
445
|
```yaml
|
488
|
-
require:
|
446
|
+
require:
|
447
|
+
- standard
|
448
|
+
- rubocop-performance
|
489
449
|
|
490
450
|
inherit_gem:
|
491
451
|
standard: config/base.yml
|
452
|
+
standard-performance: config/base.yml
|
453
|
+
standard-custom: config/base.yml
|
492
454
|
```
|
493
455
|
|
494
|
-
##
|
456
|
+
## Who uses Standard Ruby?
|
495
457
|
|
496
|
-
|
497
|
-
failures or (when successful) printing nothing at all. If you'd like to use a
|
498
|
-
different formatter, you can specify any of RuboCop's built-in formatters or
|
499
|
-
write your own.
|
500
|
-
|
501
|
-
For example, if you'd like to see colorful progress dots, you can either run
|
502
|
-
Standard with:
|
503
|
-
|
504
|
-
```
|
505
|
-
$ bundle exec standardrb --format progress
|
506
|
-
Inspecting 15 files
|
507
|
-
...............
|
508
|
-
|
509
|
-
15 files inspected, no offenses detected
|
510
|
-
```
|
511
|
-
|
512
|
-
Or, in your project's `.standard.yml` file, specify:
|
513
|
-
|
514
|
-
```yaml
|
515
|
-
format: progress
|
516
|
-
```
|
517
|
-
|
518
|
-
Refer to RuboCop's [documentation on
|
519
|
-
formatters](https://rubocop.readthedocs.io/en/latest/formatters/) for more
|
520
|
-
information.
|
521
|
-
|
522
|
-
## How do I run Standard in my editor?
|
523
|
-
|
524
|
-
It can be very handy to know about failures while editing to shorten the
|
525
|
-
feedback loop.
|
526
|
-
|
527
|
-
### Language Server Protocol support
|
528
|
-
|
529
|
-
To provide immediate feedback of Standard violations and support autofixing
|
530
|
-
of your code while avoiding the performance cost of starting and stopping the
|
531
|
-
`standardrb` binary repeatedly, Standard Ruby ships with a built-in [Language
|
532
|
-
Server Protocol](https://microsoft.github.io/language-server-protocol/) server,
|
533
|
-
which is powered by the [language_server-protocol
|
534
|
-
gem](https://github.com/mtsmfm/language_server-protocol-ruby) and can be
|
535
|
-
activated from the command line with the `--lsp` flag.
|
536
|
-
|
537
|
-
Most likely, you'd instantiate this server indirectly in your editor's
|
538
|
-
configuration, as can be demonstrated easily with
|
539
|
-
[neovim](https://github.com/testdouble/standard/wiki/IDE:-neovim).
|
540
|
-
Theoretically, this feature could be leveraged by a purpose-built editor plugin
|
541
|
-
to performantly format and fix your code. (If you're looking for a project, we'd
|
542
|
-
love to see one created for VS Code!)
|
458
|
+
Here are a few examples of Ruby Standard-compliant teams & projects:
|
543
459
|
|
544
|
-
|
460
|
+
* [Test Double](https://testdouble.com/agency)
|
461
|
+
* [Amazon Web Services](https://aws.amazon.com/)
|
462
|
+
* [Arrows](https://arrows.to/)
|
463
|
+
* [Avo Admin](https://avohq.io/)
|
464
|
+
* [Babylist](https://www.babylist.com/)
|
465
|
+
* [Brand New Box](https://brandnewbox.com)
|
466
|
+
* [Brave Software](https://github.com/brave-intl/publishers)
|
467
|
+
* [Collective Idea](https://collectiveidea.com/)
|
468
|
+
* [Culture Foundry](https://www.culturefoundry.com/)
|
469
|
+
* [Elevate Labs](https://elevatelabs.com)
|
470
|
+
* [Envoy](https://www.envoy.com)
|
471
|
+
* [Evil Martians](https://evilmartians.com)
|
472
|
+
* [Firstline](https://firstline.org/)
|
473
|
+
* [Hashrocket](https://hashrocket.com)
|
474
|
+
* [Honeybadger](https://www.honeybadger.io)
|
475
|
+
* [JetThoughts](https://www.jetthoughts.com/)
|
476
|
+
* [Level UP Solutions](https://levups.com)
|
477
|
+
* [Monterail](https://www.monterail.com)
|
478
|
+
* [myRent](https://www.myrent.co.nz)
|
479
|
+
* [OBLSK](https://oblsk.com/)
|
480
|
+
* [Oyster](https://www.oysterhr.com/)
|
481
|
+
* [Planet Argon](https://www.planetargon.com/)
|
482
|
+
* [PLT4M](https://plt4m.com/)
|
483
|
+
* [Podia](https://www.podia.com/)
|
484
|
+
* [Rebase Interactive](https://www.rebaseinteractive.com/)
|
485
|
+
* [Renuo](https://www.renuo.ch/)
|
486
|
+
* [RubyCI](https://ruby.ci)
|
487
|
+
* [Spinal](https://spinalcms.com/)
|
488
|
+
* [Teamtailor](https://www.teamtailor.com/)
|
489
|
+
* [thoughtbot](https://thoughtbot.com/)
|
545
490
|
|
546
|
-
|
547
|
-
- [emacs (via flycheck)](https://github.com/julianrubisch/flycheck-standardrb)
|
548
|
-
- [RubyMine](https://www.jetbrains.com/help/ruby/rubocop.html#disable_rubocop)
|
549
|
-
- [vim (via ALE)](https://github.com/testdouble/standard/wiki/IDE:-vim)
|
550
|
-
- [neovim (via LSP)](https://github.com/testdouble/standard/wiki/IDE:-neovim)
|
551
|
-
- [VS Code](https://github.com/testdouble/standard/wiki/IDE:-vscode)
|
552
|
-
|
553
|
-
## Why aren't `frozen_string_literal: true` magic comments enforced?
|
554
|
-
|
555
|
-
Standard does not take a stance on whether you should plaster a
|
556
|
-
[frozen_string_literal magic
|
557
|
-
comment](https://docs.ruby-lang.org/en/3.0/doc/syntax/comments_rdoc.html#label-Magic+Comments)
|
558
|
-
directive at the top of every file. Enforcing use of the comment became popular
|
559
|
-
when it was believed that string literals would be frozen by default in a future
|
560
|
-
version of Ruby, but [according to
|
561
|
-
Matz](https://bugs.ruby-lang.org/issues/11473#note-53) there are no (longer any)
|
562
|
-
such plans.
|
563
|
-
|
564
|
-
Aside from one's personal opinion on the degree to which the comment is an
|
565
|
-
eyesore, the decision to include the magic comment at the top of every file
|
566
|
-
listing ought to be made based on the performance characteristics of each
|
567
|
-
project (e.g. whether it defines a significant number of string literals,
|
568
|
-
whether the commensurate memory usage is a material constraint, whether the code
|
569
|
-
is run as a one-off command or a long-lived server application). These tend to
|
570
|
-
indicate whether the magic comment might lead to meaningful reductions in memory
|
571
|
-
usage.
|
572
|
-
|
573
|
-
Because Standard is intended to be used as a default for every kind of Ruby
|
574
|
-
file—from shell scripts to Rails apps—it wouldn't be appropriate for Standard to
|
575
|
-
either enforce or preclude the magic comment. Instead, you might consider
|
576
|
-
either:
|
577
|
-
|
578
|
-
* Measuring memory performance by enabling frozen string literals as
|
579
|
-
the default at runtime (with `RUBYOPT=--enable-frozen-string-literal`)
|
580
|
-
* Introducing the
|
581
|
-
[magic_frozen_string_literal](https://github.com/Invoca/magic_frozen_string_literal)
|
582
|
-
gem to your build, which will automatically ensure that the comment is
|
583
|
-
prepended for every applicable file in your project
|
584
|
-
|
585
|
-
## How often is Standard updated?
|
586
|
-
|
587
|
-
We aim to update Standard once a month, in the first week of the month. In between releases, we'll be considering RuboCop updates, RuboCop Performance updates, and community contributions.
|
588
|
-
|
589
|
-
## Does Standard work with [Insert other tool name here]?
|
590
|
-
|
591
|
-
Maybe! Start by searching the repository to see if there's an existing issue
|
592
|
-
open for the tool you're interested in. That aside, here are other known
|
593
|
-
integrations aside from editor plugins:
|
594
|
-
|
595
|
-
* [Code Climate](https://github.com/testdouble/standard/wiki/CI:-Code-Climate)
|
596
|
-
* [Pronto](https://github.com/julianrubisch/pronto-standardrb)
|
597
|
-
* [Spring](https://github.com/lakim/spring-commands-standard)
|
598
|
-
* [Guard](https://github.com/JodyVanden/guard-standardrb)
|
599
|
-
* [Danger](https://github.com/ashfurrow/danger-rubocop/)
|
491
|
+
Does your team use Standard? [Add your name to the list](https://github.com/standardrb/standard/edit/main/README.md)!
|
600
492
|
|
601
|
-
|
493
|
+
If you really want to show off, you can also add a badge to your project's README, like this one:
|
602
494
|
|
603
|
-
|
495
|
+
[![Ruby Code Style](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/standardrb/standard)
|
604
496
|
|
605
|
-
```
|
606
|
-
|
607
|
-
$ cd standard
|
608
|
-
$ gem install bundler # if working with ruby version below 2.6.0
|
609
|
-
$ bundle install
|
610
|
-
$ bundle exec rake # to run test suite
|
497
|
+
```md
|
498
|
+
[![Ruby Code Style](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/standardrb/standard)
|
611
499
|
```
|
612
500
|
|
613
501
|
## Code of Conduct
|