standard 1.7.0 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +1 -1
- data/.standard.yml +1 -1
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +3 -3
- data/README.md +69 -27
- data/lib/standard/creates_config_store/assigns_rubocop_yaml.rb +1 -1
- data/lib/standard/version.rb +1 -1
- data/standard.gemspec +2 -2
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9d7e41be999895d2ccd72d50fd5023792af89a2e0456ebadf233d1bab9769e2
|
4
|
+
data.tar.gz: 1a5387cefbf33539d46001b751ea9a7ad800d6dcc940f422421097e561dcba00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9174f67d57161c8b3cd8942f67399a3260e8c86e232c7e82c7d865ae147bc50eec2eece52bec727dddf336ac64e24311ba0d933c5432491da364fda3ad4cc70a
|
7
|
+
data.tar.gz: 84d4bb6c00601685030464d0d89c432ce4ae15d6f7b3d43a592b424b86b950efd0a43236957de51cb7fd52049491b3f3fda0db09985d51a9e09adad3b82579b5
|
data/.github/workflows/test.yml
CHANGED
data/.standard.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
standard (1.7.
|
5
|
-
rubocop (= 1.25.
|
4
|
+
standard (1.7.1)
|
5
|
+
rubocop (= 1.25.1)
|
6
6
|
rubocop-performance (= 1.13.2)
|
7
7
|
|
8
8
|
GEM
|
@@ -24,7 +24,7 @@ GEM
|
|
24
24
|
rake (13.0.6)
|
25
25
|
regexp_parser (2.2.0)
|
26
26
|
rexml (3.2.5)
|
27
|
-
rubocop (1.25.
|
27
|
+
rubocop (1.25.1)
|
28
28
|
parallel (~> 1.10)
|
29
29
|
parser (>= 3.1.0.0)
|
30
30
|
rainbow (>= 2.2.2, < 4.0)
|
data/README.md
CHANGED
@@ -14,17 +14,16 @@ to save you (and others!) time in the same three ways:
|
|
14
14
|
* **Catch style issues & programmer errors early.** Save precious code review
|
15
15
|
time by eliminating back-and-forth between reviewer & contributor.
|
16
16
|
|
17
|
-
No decisions to make. It just works. Here's a [⚡ lightning talk
|
17
|
+
No decisions to make. It just works. Here's a [⚡ lightning talk
|
18
|
+
⚡](https://www.youtube.com/watch?v=uLyV5hOqGQ8) about it.
|
18
19
|
|
19
|
-
Install by adding it to your Gemfile
|
20
|
+
Install Standard by adding it to your Gemfile and running `bundle install`:
|
20
21
|
|
21
22
|
```ruby
|
22
23
|
gem "standard", group: [:development, :test]
|
23
24
|
```
|
24
25
|
|
25
|
-
|
26
|
-
|
27
|
-
Run Standard from the command line with:
|
26
|
+
You can then run Standard from the command line with:
|
28
27
|
|
29
28
|
```ruby
|
30
29
|
$ bundle exec standardrb
|
@@ -33,6 +32,14 @@ $ bundle exec standardrb
|
|
33
32
|
And if you'd like, Standard can autocorrect your code by tacking on a `--fix`
|
34
33
|
flag.
|
35
34
|
|
35
|
+
If your project uses Rake, adding `require "standard/rake"` adds two tasks:
|
36
|
+
`standard` and `standard:fix`. In most new projects, we tend to add the fixer
|
37
|
+
variant to our default `rake` task after our test command, similar to this:
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
task default: [:test, "standard:fix"]
|
41
|
+
```
|
42
|
+
|
36
43
|
## StandardRB — The Rules
|
37
44
|
|
38
45
|
- **2 spaces** – for indentation
|
@@ -73,8 +80,8 @@ standard: Run `standardrb --fix` to automatically fix some problems.
|
|
73
80
|
/Users/code/cli.rb:31:23: Style/Semicolon: Do not use semicolons to terminate expressions.
|
74
81
|
```
|
75
82
|
|
76
|
-
You can optionally pass in a directory (or directories) using
|
77
|
-
sure to quote paths containing glob patterns so that they are expanded by
|
83
|
+
You can optionally pass in a directory (or directories) using a glob pattern.
|
84
|
+
Be sure to quote paths containing glob patterns so that they are expanded by
|
78
85
|
`standardrb` instead of your shell:
|
79
86
|
|
80
87
|
```bash
|
@@ -84,19 +91,20 @@ $ bundle exec standardrb "lib/**/*.rb" test
|
|
84
91
|
**Note:** by default, StandardRB will look for all `*.rb` files (and some other
|
85
92
|
files typically associated with Ruby like `*.gemspec` and `Gemfile`)
|
86
93
|
|
87
|
-
If you
|
88
|
-
|
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:
|
89
97
|
|
90
98
|
```bash
|
91
99
|
$ bundle exec standardrb --generate-todo
|
92
100
|
```
|
93
101
|
|
94
|
-
This will create a `.standard_todo.yml` that lists all the files that contain
|
95
|
-
When you run Standard in the future it will ignore these files as if
|
96
|
-
`ignore` section in the `.standard.yml` file.
|
102
|
+
This will create a `.standard_todo.yml` that lists all the files that contain
|
103
|
+
errors. When you run Standard in the future, it will ignore these files as if
|
104
|
+
they were listed under the `ignore` section in the `.standard.yml` file.
|
97
105
|
|
98
|
-
As you refactor your existing project you can remove files from the list.
|
99
|
-
also regenerate the
|
106
|
+
As you refactor your existing project you can remove files from the list. You
|
107
|
+
can also regenerate the TODO file at any time by re-running the above command.
|
100
108
|
|
101
109
|
### Using with Rake
|
102
110
|
|
@@ -151,9 +159,8 @@ ignore: # default: []
|
|
151
159
|
Note: If you're running Standard in a context where your `.standard.yml` file
|
152
160
|
cannot be found by ascending the current working directory (i.e., against a
|
153
161
|
temporary file buffer in your editor), you can specify the config location with
|
154
|
-
`--config path/to/.standard.yml`.
|
155
|
-
|
156
|
-
Similarly, for the `.standard_todo.yml` file, you can specify `--todo path/to/.standard_todo.yml`.
|
162
|
+
`--config path/to/.standard.yml`. (Similarly, for the `.standard_todo.yml` file,
|
163
|
+
you can specify `--todo path/to/.standard_todo.yml`.)
|
157
164
|
|
158
165
|
## What you might do if you're REALLY clever
|
159
166
|
|
@@ -190,10 +197,11 @@ community conventions higher than personal style. This might not make sense for
|
|
190
197
|
place for newbies. Setting up clear, automated contributor expectations makes a
|
191
198
|
project healthier.
|
192
199
|
|
193
|
-
## Usage via
|
200
|
+
## Usage via RuboCop
|
194
201
|
|
195
|
-
If you only want to use
|
196
|
-
|
202
|
+
If you only want to use Standard's rules while continuing to use RuboCop's CLI
|
203
|
+
(for example, to continue using your favorite IDE/tooling/workflow with RuboCop
|
204
|
+
support), you can configure this in your `.rubocop.yml`:
|
197
205
|
|
198
206
|
```yaml
|
199
207
|
require: standard
|
@@ -230,7 +238,6 @@ if you've used StandardJS.)
|
|
230
238
|
* [Renuo](https://www.renuo.ch/)
|
231
239
|
* [RubyCI](https://ruby.ci)
|
232
240
|
* [thoughtbot](https://thoughtbot.com/)
|
233
|
-
* And that's about it so far!
|
234
241
|
|
235
242
|
If your team starts using Standard, [send a pull
|
236
243
|
request](https://github.com/testdouble/standard/edit/main/README.md) to let us
|
@@ -428,15 +435,50 @@ feedback loop. Some editors support asynchronously running linters.
|
|
428
435
|
- [vim (via ALE)](https://github.com/testdouble/standard/wiki/IDE:-vim)
|
429
436
|
- [VS Code](https://github.com/testdouble/standard/wiki/IDE:-vscode)
|
430
437
|
|
431
|
-
##
|
432
|
-
|
433
|
-
|
438
|
+
## Why aren't `frozen_string_literal: true` magic comments enforced?
|
439
|
+
|
440
|
+
Standard does not take a stance on whether you should plaster a
|
441
|
+
[frozen_string_literal magic
|
442
|
+
comment](https://docs.ruby-lang.org/en/3.0/doc/syntax/comments_rdoc.html#label-Magic+Comments)
|
443
|
+
directive at the top of every file. Enforcing use of the comment became popular
|
444
|
+
when it was believed that string literals would be frozen by default in a future
|
445
|
+
version of Ruby, but [according to
|
446
|
+
Matz](https://bugs.ruby-lang.org/issues/11473#note-53) there are no (longer any)
|
447
|
+
such plans.
|
448
|
+
|
449
|
+
Aside from one's personal opinion on the degree to which the comment is an
|
450
|
+
eyesore, the decision to include the magic comment at the top of every file
|
451
|
+
listing ought to be made based on the performance characteristics of each
|
452
|
+
project (e.g. whether it defines a significant number of string literals,
|
453
|
+
whether the commensurate memory usage is a material constraint, whether the code
|
454
|
+
is run as a one-off command or a long-lived server application). These tend to
|
455
|
+
indicate whether the magic comment might lead to meaningful reductions in memory
|
456
|
+
usage.
|
457
|
+
|
458
|
+
Because Standard is intended to be used as a default for every kind of Ruby
|
459
|
+
file—from shell scripts to Rails apps—it wouldn't be appropriate for Standard to
|
460
|
+
either enforce or preclude the magic comment. Instead, you might consider
|
461
|
+
either:
|
462
|
+
|
463
|
+
* Measuring memory performance by enabling frozen string literals as
|
464
|
+
the default at runtime (with `RUBYOPT=--enable-frozen-string-literal`)
|
465
|
+
* Introducing the
|
466
|
+
[magic_frozen_string_literal](https://github.com/Invoca/magic_frozen_string_literal)
|
467
|
+
gem to your build, which will automatically ensure that the comment is
|
468
|
+
prepended for every applicable file in your project
|
469
|
+
|
470
|
+
## How do I use Standard with RuboCop extensions?
|
471
|
+
|
472
|
+
This is not officially supported by Standard. However, Evil Martians wrote up [a
|
473
|
+
regularly updated
|
474
|
+
guide](https://evilmartians.com/chronicles/rubocoping-with-legacy-bring-your-ruby-code-up-to-standard)
|
475
|
+
on how to do so.
|
434
476
|
|
435
477
|
## Does Standard work with [Insert other tool name here]?
|
436
478
|
|
437
|
-
Maybe! Start by searching the repository to see if there's an existing issue
|
438
|
-
the tool you're interested in. That aside, here are other known
|
439
|
-
from editor plugins:
|
479
|
+
Maybe! Start by searching the repository to see if there's an existing issue
|
480
|
+
open for the tool you're interested in. That aside, here are other known
|
481
|
+
integrations aside from editor plugins:
|
440
482
|
|
441
483
|
* [Code Climate](https://github.com/testdouble/standard/wiki/CI:-Code-Climate)
|
442
484
|
* [Pronto](https://github.com/julianrubisch/pronto-standardrb)
|
@@ -4,7 +4,7 @@ class Standard::CreatesConfigStore
|
|
4
4
|
class AssignsRubocopYaml
|
5
5
|
def call(config_store, standard_config)
|
6
6
|
config_store.options_config = rubocop_yaml_path(standard_config[:ruby_version])
|
7
|
-
config_store.instance_variable_get(
|
7
|
+
config_store.instance_variable_get(:@options_config)
|
8
8
|
end
|
9
9
|
|
10
10
|
private
|
data/lib/standard/version.rb
CHANGED
data/standard.gemspec
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
|
|
7
7
|
spec.version = Standard::VERSION
|
8
8
|
spec.authors = ["Justin Searls"]
|
9
9
|
spec.email = ["searls@gmail.com"]
|
10
|
-
spec.required_ruby_version = ">= 2.
|
10
|
+
spec.required_ruby_version = ">= 2.6.0"
|
11
11
|
|
12
12
|
spec.summary = "Ruby Style Guide, with linter & automatic code fixer"
|
13
13
|
spec.homepage = "https://github.com/testdouble/standard"
|
@@ -19,6 +19,6 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
|
-
spec.add_dependency "rubocop", "1.25.
|
22
|
+
spec.add_dependency "rubocop", "1.25.1"
|
23
23
|
spec.add_dependency "rubocop-performance", "1.13.2"
|
24
24
|
end
|
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.7.
|
4
|
+
version: 1.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Searls
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-02-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.25.
|
19
|
+
version: 1.25.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.25.
|
26
|
+
version: 1.25.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rubocop-performance
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -106,14 +106,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
106
106
|
requirements:
|
107
107
|
- - ">="
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: 2.
|
109
|
+
version: 2.6.0
|
110
110
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
111
|
requirements:
|
112
112
|
- - ">="
|
113
113
|
- !ruby/object:Gem::Version
|
114
114
|
version: '0'
|
115
115
|
requirements: []
|
116
|
-
rubygems_version: 3.2.
|
116
|
+
rubygems_version: 3.2.32
|
117
117
|
signing_key:
|
118
118
|
specification_version: 4
|
119
119
|
summary: Ruby Style Guide, with linter & automatic code fixer
|