standard 1.5.0 → 1.7.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 981607eacda9cd109ef6934f2aec50efef936e8c2f8c999e0ff2d09a2d71590a
4
- data.tar.gz: 45263d2025da0a33aed7a6fb213942601f4b3e4cf542cd0a44de8b1f32df9cc3
3
+ metadata.gz: cc13abf56075fe1b821e69ca788e40bccf21a01458814c2abe4d3f6a0f8fd404
4
+ data.tar.gz: 0c4cfe676dc344656459b505ac12fa10aa396c66bf2aa9ebbab03c54e2d92f40
5
5
  SHA512:
6
- metadata.gz: 40c29eed2f16d6698b779672977ee76ddc895463c92aaedc185e70263a41569e9ab7c1f3fddc5a7f3a84cb1ab4be3ca695939b8a5ed1df9a6bb427459af9d83b
7
- data.tar.gz: f43c126937613621c350a47583bd1f3c2c71a79d6bbd9f1524a1bb03abc9318ae23356d4425cfa36610cbb3a1f546c340dbf82b0707ef5f02780c38abd630ac1
6
+ metadata.gz: 6ae3c11e890df971bb8ad8e268bbf75a5ad42800d3646d7e4f8df22b2edc0e7d586afa7732368061c4f69a02ed083cad94dd3b4466c9fd6e6db88bc6ec05d6b6
7
+ data.tar.gz: b38cd26460d5f5c094d790e8f6ed0fa3257f64b8ac48a81b632696a17945e53b2daf7b51978ea4ef1a40623a0e4be6fc664e26d87dadbdc37c8107c7ecb13b83
@@ -5,6 +5,10 @@ on:
5
5
  branches: [ main ]
6
6
  pull_request:
7
7
  branches: [ main ]
8
+ workflow_run:
9
+ workflows: ["Update"]
10
+ types:
11
+ - completed
8
12
 
9
13
  jobs:
10
14
  test:
@@ -12,7 +16,7 @@ jobs:
12
16
  strategy:
13
17
  matrix:
14
18
  os: [ ubuntu-latest ]
15
- ruby-version: [2.5, 2.6, 2.7, 3.0]
19
+ ruby-version: [2.6, 2.7, '3.0', 3.1]
16
20
 
17
21
  runs-on: ${{ matrix.os }}
18
22
 
data/.standard.yml CHANGED
@@ -1,4 +1,4 @@
1
- ruby_version: 2.2.0
1
+ ruby_version: 2.6
2
2
  ignore:
3
3
  - tmp/**/*
4
4
  - test/fixture/**/*
data/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.7.2
4
+
5
+ * Removes Style/RedundantBegin from Ruby versions <= 2.4
6
+
7
+ ## 1.7.1
8
+
9
+ * Update rubocop from 1.25.0 to [1.25.1](https://github.com/rubocop/rubocop/tag/v1.25.1)
10
+
11
+ ## 1.7.0
12
+
13
+ * Update rubocop-performance from 1.13.1 to [1.13.2](https://github.com/rubocop/rubocop-performance/tag/v1.13.2)
14
+ * Update rubocop from 1.24.1 to [1.25.0](https://github.com/rubocop/rubocop/tag/v1.25.0)
15
+
16
+ ## 1.6.0
17
+
18
+ * Update rubocop-performance from 1.12.0 to [1.13.1](https://github.com/rubocop/rubocop-performance/tag/v1.13.1)
19
+ * Update rubocop from 1.23.0 to [1.24.1](https://github.com/rubocop/rubocop/tag/v1.24.1)
20
+
3
21
  ## 1.5.0
4
22
 
5
23
  * Update rubocop-performance from 1.11.5 to [1.12.0](https://github.com/rubocop/rubocop-performance/tag/v1.12.0)
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- standard (1.5.0)
5
- rubocop (= 1.23.0)
6
- rubocop-performance (= 1.12.0)
4
+ standard (1.7.2)
5
+ rubocop (= 1.25.1)
6
+ rubocop-performance (= 1.13.2)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
@@ -13,29 +13,29 @@ GEM
13
13
  docile (1.4.0)
14
14
  gimme (0.5.0)
15
15
  method_source (1.0.0)
16
- minitest (5.14.4)
16
+ minitest (5.15.0)
17
17
  parallel (1.21.0)
18
- parser (3.0.3.1)
18
+ parser (3.1.0.0)
19
19
  ast (~> 2.4.1)
20
20
  pry (0.14.1)
21
21
  coderay (~> 1.1)
22
22
  method_source (~> 1.0)
23
- rainbow (3.0.0)
23
+ rainbow (3.1.1)
24
24
  rake (13.0.6)
25
- regexp_parser (2.1.1)
25
+ regexp_parser (2.2.0)
26
26
  rexml (3.2.5)
27
- rubocop (1.23.0)
27
+ rubocop (1.25.1)
28
28
  parallel (~> 1.10)
29
- parser (>= 3.0.0.0)
29
+ parser (>= 3.1.0.0)
30
30
  rainbow (>= 2.2.2, < 4.0)
31
31
  regexp_parser (>= 1.8, < 3.0)
32
32
  rexml
33
- rubocop-ast (>= 1.12.0, < 2.0)
33
+ rubocop-ast (>= 1.15.1, < 2.0)
34
34
  ruby-progressbar (~> 1.7)
35
35
  unicode-display_width (>= 1.4.0, < 3.0)
36
- rubocop-ast (1.13.0)
36
+ rubocop-ast (1.15.1)
37
37
  parser (>= 3.0.1.1)
38
- rubocop-performance (1.12.0)
38
+ rubocop-performance (1.13.2)
39
39
  rubocop (>= 1.7.0, < 2.0)
40
40
  rubocop-ast (>= 0.4.0)
41
41
  ruby-progressbar (1.11.0)
@@ -61,4 +61,4 @@ DEPENDENCIES
61
61
  standard!
62
62
 
63
63
  BUNDLED WITH
64
- 2.2.22
64
+ 2.3.4
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 ⚡](https://www.youtube.com/watch?v=uLyV5hOqGQ8) about it.
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
- And running `bundle install`.
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 the glob pattern. Be
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 have an existing project but aren't ready to fix all the files yet you can
88
- generate a todo file:
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 errors.
95
- When you run Standard in the future it will ignore these files as if they lived under the
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. You can
99
- also regenerate the todo file at any time by re-running the above command.
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,20 +197,17 @@ 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 rubocop
200
+ ## Usage via RuboCop
194
201
 
195
- If you only want to use the rules and not the cli (to keep current IDE/tooling/workflow support).
196
- It needs to repeat `AllCops` because of a [rubocop issue](https://github.com/rubocop/rubocop/issues/10175).
197
- Change your `.rubocop.yml` to:
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`:
198
205
 
199
206
  ```yaml
200
207
  require: standard
201
208
 
202
209
  inherit_gem:
203
210
  standard: config/base.yml
204
-
205
- AllCops:
206
- DisabledByDefault: true
207
211
  ```
208
212
 
209
213
  ## Who uses Ruby Standard Style?
@@ -213,27 +217,27 @@ familiar](https://github.com/standard/standard#who-uses-javascript-standard-styl
213
217
  if you've used StandardJS.)
214
218
 
215
219
  * [Test Double](https://testdouble.com/agency)
220
+ * [Amazon Web Services](https://aws.amazon.com/)
221
+ * [Babylist](https://www.babylist.com/)
222
+ * [Brand New Box](https://brandnewbox.com)
223
+ * [Brave Software](https://github.com/brave-intl/publishers)
216
224
  * [Collective Idea](https://collectiveidea.com/)
217
225
  * [Culture Foundry](https://www.culturefoundry.com/)
226
+ * [Envoy](https://www.envoy.com)
218
227
  * [Evil Martians](https://evilmartians.com)
219
- * [Rebase Interactive](https://www.rebaseinteractive.com/)
220
228
  * [Hashrocket](https://hashrocket.com)
221
- * [Brand New Box](https://brandnewbox.com)
222
- * [Monterail](https://www.monterail.com)
223
- * [Level UP Solutions](https://levups.com)
224
229
  * [Honeybadger](https://www.honeybadger.io)
225
- * [Amazon Web Services](https://aws.amazon.com/)
226
- * [Envoy](https://www.envoy.com)
227
- * [myRent](https://www.myrent.co.nz)
228
- * [Renuo](https://www.renuo.ch/)
229
230
  * [JetThoughts](https://www.jetthoughts.com/)
231
+ * [Level UP Solutions](https://levups.com)
232
+ * [Monterail](https://www.monterail.com)
233
+ * [myRent](https://www.myrent.co.nz)
230
234
  * [Oyster](https://www.oysterhr.com/)
235
+ * [Planet Argon](https://www.planetargon.com/)
231
236
  * [Podia](https://www.podia.com/)
237
+ * [Rebase Interactive](https://www.rebaseinteractive.com/)
238
+ * [Renuo](https://www.renuo.ch/)
232
239
  * [RubyCI](https://ruby.ci)
233
240
  * [thoughtbot](https://thoughtbot.com/)
234
- * [Planet Argon](https://www.planetargon.com/)
235
- * [Brave Software](https://github.com/brave-intl/publishers)
236
- * And that's about it so far!
237
241
 
238
242
  If your team starts using Standard, [send a pull
239
243
  request](https://github.com/testdouble/standard/edit/main/README.md) to let us
@@ -431,15 +435,50 @@ feedback loop. Some editors support asynchronously running linters.
431
435
  - [vim (via ALE)](https://github.com/testdouble/standard/wiki/IDE:-vim)
432
436
  - [VS Code](https://github.com/testdouble/standard/wiki/IDE:-vscode)
433
437
 
434
- ## How do I use Standard with Rubocop extensions?
435
-
436
- This is not officially supported by Standard. However, Evil Martians wrote up [a regularly updated guide](https://evilmartians.com/chronicles/rubocoping-with-legacy-bring-your-ruby-code-up-to-standard) on how to do so.
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.
437
476
 
438
477
  ## Does Standard work with [Insert other tool name here]?
439
478
 
440
- Maybe! Start by searching the repository to see if there's an existing issue open for
441
- the tool you're interested in. That aside, here are other known integrations aside
442
- 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:
443
482
 
444
483
  * [Code Climate](https://github.com/testdouble/standard/wiki/CI:-Code-Climate)
445
484
  * [Pronto](https://github.com/julianrubisch/pronto-standardrb)
data/config/base.yml CHANGED
@@ -801,7 +801,7 @@ Lint/Void:
801
801
  CheckForMethodsWithNoSideEffects: false
802
802
 
803
803
  Lint/IncompatibleIoSelectWithFiberScheduler:
804
- Enabled: false
804
+ Enabled: true
805
805
 
806
806
  Lint/RequireRelativeSelfPath:
807
807
  Enabled: true
@@ -896,6 +896,9 @@ Naming/VariableName:
896
896
  Naming/VariableNumber:
897
897
  Enabled: false
898
898
 
899
+ Naming/BlockForwarding:
900
+ Enabled: false
901
+
899
902
  Performance/AncestorsInclude:
900
903
  Enabled: false
901
904
 
@@ -1045,6 +1048,9 @@ Performance/UriDefaultParser:
1045
1048
  Performance/ConcurrentMonotonicTime:
1046
1049
  Enabled: true
1047
1050
 
1051
+ Performance/StringIdentifierArgument:
1052
+ Enabled: true
1053
+
1048
1054
  Security/Eval:
1049
1055
  Enabled: true
1050
1056
 
@@ -1307,6 +1313,7 @@ Style/HashLikeCase:
1307
1313
  Style/HashSyntax:
1308
1314
  Enabled: true
1309
1315
  EnforcedStyle: ruby19_no_mixed_keys
1316
+ EnforcedShorthandSyntax: either
1310
1317
 
1311
1318
  Style/HashTransformKeys:
1312
1319
  Enabled: false
@@ -1824,3 +1831,11 @@ Style/SelectByRegexp:
1824
1831
  Style/OpenStructUse:
1825
1832
  Enabled: false
1826
1833
 
1834
+ Style/MapToHash:
1835
+ Enabled: false
1836
+
1837
+ Style/FileWrite:
1838
+ Enabled: true
1839
+
1840
+ Style/FileRead:
1841
+ Enabled: true
data/config/ruby-1.8.yml CHANGED
@@ -5,3 +5,9 @@ Style/HashSyntax:
5
5
 
6
6
  Style/Lambda:
7
7
  Enabled: false
8
+
9
+ Style/FileWrite:
10
+ Enabled: false
11
+
12
+ Style/FileRead:
13
+ Enabled: false
data/config/ruby-2.4.yml CHANGED
@@ -2,3 +2,6 @@ inherit_from: ./ruby-2.5.yml
2
2
 
3
3
  AllCops:
4
4
  TargetRubyVersion: 2.5 # The oldest supported
5
+
6
+ Style/RedundantBegin:
7
+ Enabled: false
@@ -0,0 +1,10 @@
1
+ inherit_from: ./base.yml
2
+
3
+ AllCops:
4
+ TargetRubyVersion: 3.0
5
+
6
+ Style/HashExcept:
7
+ Enabled: true
8
+
9
+ Naming/BlockForwarding:
10
+ Enabled: false
@@ -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("@options_config")
7
+ config_store.instance_variable_get(:@options_config)
8
8
  end
9
9
 
10
10
  private
@@ -1,3 +1,3 @@
1
1
  module Standard
2
- VERSION = Gem::Version.new("1.5.0")
2
+ VERSION = Gem::Version.new("1.7.2")
3
3
  end
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.5.0"
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.23.0"
23
- spec.add_dependency "rubocop-performance", "1.12.0"
22
+ spec.add_dependency "rubocop", "1.25.1"
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.5.0
4
+ version: 1.7.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: 2021-12-02 00:00:00.000000000 Z
11
+ date: 2022-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 1.23.0
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.23.0
26
+ version: 1.25.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rubocop-performance
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 1.12.0
33
+ version: 1.13.2
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 1.12.0
40
+ version: 1.13.2
41
41
  description:
42
42
  email:
43
43
  - searls@gmail.com
@@ -68,6 +68,7 @@ files:
68
68
  - config/ruby-2.5.yml
69
69
  - config/ruby-2.6.yml
70
70
  - config/ruby-2.7.yml
71
+ - config/ruby-3.0.yml
71
72
  - docs/RELEASE.md
72
73
  - exe/standardrb
73
74
  - lib/standard.rb
@@ -105,14 +106,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
105
106
  requirements:
106
107
  - - ">="
107
108
  - !ruby/object:Gem::Version
108
- version: 2.5.0
109
+ version: 2.6.0
109
110
  required_rubygems_version: !ruby/object:Gem::Requirement
110
111
  requirements:
111
112
  - - ">="
112
113
  - !ruby/object:Gem::Version
113
114
  version: '0'
114
115
  requirements: []
115
- rubygems_version: 3.2.15
116
+ rubygems_version: 3.2.32
116
117
  signing_key:
117
118
  specification_version: 4
118
119
  summary: Ruby Style Guide, with linter & automatic code fixer