standard 0.10.0 → 0.13.0

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: dce5ce63f9e226f30eaaa25c24c99038f2007e79d636a6af0ad6e878cccef228
4
- data.tar.gz: edc3e716e5a91a2e5ba0632aeb56a7d3902dd552aeb9c930b0f49b96b567ba48
3
+ metadata.gz: f0e6cc49d6d26e0bb428b7d05637a45b00ea6e0542f04a215a621ae5238c35dc
4
+ data.tar.gz: b7599f068adeff886b013330d72c2dd8fceb415ac6d53299fee208eec6c7b141
5
5
  SHA512:
6
- metadata.gz: 208f8e2885c0f243117e3c2545f5c828a693979298e6e3cac3e487e1b30d7fd9a22c2408a3b836d1aa601744c9d8ea010604a465be64d6a8972d9497fc2f7157
7
- data.tar.gz: 6b6137108b78d58928688655467f117d72576ce8273cb47649ac482940363c2a5d091b979c72fc1d5d31055d5f5c2d7f0eb7733a26f309f750fd6d000b1104bf
6
+ metadata.gz: 5711e67885d2ed2167fc9ec61614a69397967cbe57f97d313973e17b0d932c822b4fc832e4159caec22a204ac4e4a8144b260bd8368ead6917f9429f8464ce41
7
+ data.tar.gz: 5f1b78ef4a3962a83bfae6b4593c42efc9cdd588da671e912ed66ff1f9d1bd3571cf05960198989405627211207aa4303f58dc173c8a650d37468d984d66ce3e
@@ -0,0 +1,8 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: bundler
4
+ directory: "/"
5
+ schedule:
6
+ interval: weekly
7
+ time: "10:00"
8
+ open-pull-requests-limit: 10
@@ -9,15 +9,29 @@ on:
9
9
  jobs:
10
10
  test:
11
11
 
12
- runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ os: [ ubuntu-latest ]
15
+ ruby-version: [2.4, 2.7, 3.0]
16
+
17
+ runs-on: ${{ matrix.os }}
13
18
 
14
19
  steps:
15
20
  - uses: actions/checkout@v2
16
- - name: Set up Ruby
21
+ - name: Set up Ruby ${{ matrix.ruby-version }}
17
22
  uses: ruby/setup-ruby@v1
18
23
  with:
19
- ruby-version: 2.7
24
+ ruby-version: ${{ matrix.ruby-version }}
25
+ - name: Set up caching
26
+ uses: actions/cache@v1
27
+ with:
28
+ path: vendor/bundle
29
+ key: bundle-user-ruby-${{ matrix.os }}-${{matrix.ruby-version }}-${{ hashFiles('**/Gemfile.lock') }}
30
+ restore-keys: |
31
+ bundle-use-ruby-${{ matrix.os }}-${{ matrix.ruby-version }}-
20
32
  - name: Install dependencies
21
- run: bundle
22
- - name: Run tests
33
+ run: |
34
+ bundle config path vendor/bundle
35
+ bundle install --jobs 4 --retry 3
36
+ - name: Run tests for Ruby ${{ matrix.ruby-version }} on ${{ matrix.os }}
23
37
  run: bundle exec rake
data/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.13.0
4
+
5
+ * Update rubocop from 1.7.0 to [1.10.0](https://github.com/rubocop-hq/rubocop/releases/tag/v1.10.0) enabling:
6
+ * [`Lint/AmbiguousAssignment`](https://github.com/rubocop-hq/rubocop/issues/9223)
7
+ * [`Style/HashExcept`](https://github.com/rubocop-hq/rubocop/pull/9283)
8
+ * [`Lint/DeprecatedConstants`](https://github.com/rubocop-hq/rubocop/pull/9324)
9
+
10
+ ## 0.12.0
11
+
12
+ * Update rubocop from 1.7.0 to [1.8.1](https://github.com/rubocop-hq/rubocop/releases/tag/v1.8.1)
13
+ * Enabled [`Style/SlicingWithRange`](https://github.com/testdouble/standard/issues/175)
14
+
15
+ ## 0.11.0
16
+
17
+ * Update rubocop-performance from 1.9.1 to [1.9.2](https://github.com/rubocop-hq/rubocop-performance/releases/tag/v1.9.2)
18
+ * Update rubocop from 1.4.2 to [1.7.0](https://github.com/rubocop-hq/rubocop/releases/tag/v1.7.0)
19
+ * Changed `Style/NegatedIf` to `postfix`
20
+
21
+ ## 0.10.2
22
+
23
+ * Remove
24
+ [`Lint/DuplicateBranch`](https://github.com/testdouble/standard/pull/228)
25
+
26
+ ## 0.10.1
27
+
28
+ * Remove [`Performance/ArraySemiInfiniteRangeSlice`](https://github.com/testdouble/standard/pull/225#discussion_r532678908)
29
+
3
30
  ## 0.10.0
4
31
 
5
32
  * Update rubocop-performance from 1.8.1 to [1.9.1](https://github.com/rubocop-hq/rubocop-performance/releases/tag/v1.9.1) enabling:
@@ -9,7 +36,7 @@
9
36
  * Update rubocop from 1.2.0 to [1.4.2](https://github.com/rubocop-hq/rubocop/releases/tag/v1.4.2) enabling:
10
37
  * [`Style/NilLambda`](https://github.com/rubocop-hq/rubocop/pull/9020)
11
38
  * [`Lint/DuplicateBranch`](https://github.com/rubocop-hq/rubocop/pull/8404)
12
-
39
+
13
40
  ## 0.9.0
14
41
 
15
42
  * Update rubocop from 1.0.0 to [1.2.0](https://github.com/rubocop-hq/rubocop/releases/tag/v1.2.0) enabling:
data/Gemfile CHANGED
@@ -1,3 +1,13 @@
1
1
  source "https://rubygems.org"
2
2
 
3
3
  gemspec
4
+
5
+ gem "bundler"
6
+ gem "minitest", "~> 5.0"
7
+ gem "pry"
8
+ gem "rake", "~> 13.0"
9
+ gem "gimme"
10
+
11
+ if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.5")
12
+ gem "simplecov"
13
+ end
data/Gemfile.lock CHANGED
@@ -1,49 +1,51 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- standard (0.10.0)
5
- rubocop (= 1.4.2)
6
- rubocop-performance (= 1.9.1)
4
+ standard (0.13.0)
5
+ rubocop (= 1.10.0)
6
+ rubocop-performance (= 1.9.2)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- ast (2.4.1)
11
+ ast (2.4.2)
12
12
  coderay (1.1.3)
13
- docile (1.3.2)
13
+ docile (1.3.5)
14
14
  gimme (0.5.0)
15
15
  method_source (1.0.0)
16
- minitest (5.14.2)
16
+ minitest (5.14.3)
17
17
  parallel (1.20.1)
18
- parser (2.7.2.0)
18
+ parser (3.0.0.0)
19
19
  ast (~> 2.4.1)
20
- pry (0.13.1)
20
+ pry (0.14.0)
21
21
  coderay (~> 1.1)
22
22
  method_source (~> 1.0)
23
23
  rainbow (3.0.0)
24
- rake (13.0.1)
25
- regexp_parser (2.0.0)
24
+ rake (13.0.3)
25
+ regexp_parser (2.0.3)
26
26
  rexml (3.2.4)
27
- rubocop (1.4.2)
27
+ rubocop (1.10.0)
28
28
  parallel (~> 1.10)
29
- parser (>= 2.7.1.5)
29
+ parser (>= 3.0.0.0)
30
30
  rainbow (>= 2.2.2, < 4.0)
31
- regexp_parser (>= 1.8)
31
+ regexp_parser (>= 1.8, < 3.0)
32
32
  rexml
33
- rubocop-ast (>= 1.1.1)
33
+ rubocop-ast (>= 1.2.0, < 2.0)
34
34
  ruby-progressbar (~> 1.7)
35
- unicode-display_width (>= 1.4.0, < 2.0)
36
- rubocop-ast (1.2.0)
35
+ unicode-display_width (>= 1.4.0, < 3.0)
36
+ rubocop-ast (1.4.1)
37
37
  parser (>= 2.7.1.5)
38
- rubocop-performance (1.9.1)
38
+ rubocop-performance (1.9.2)
39
39
  rubocop (>= 0.90.0, < 2.0)
40
40
  rubocop-ast (>= 0.4.0)
41
- ruby-progressbar (1.10.1)
42
- simplecov (0.19.0)
41
+ ruby-progressbar (1.11.0)
42
+ simplecov (0.21.2)
43
43
  docile (~> 1.1)
44
44
  simplecov-html (~> 0.11)
45
- simplecov-html (0.12.2)
46
- unicode-display_width (1.7.0)
45
+ simplecov_json_formatter (~> 0.1)
46
+ simplecov-html (0.12.3)
47
+ simplecov_json_formatter (0.1.2)
48
+ unicode-display_width (2.0.0)
47
49
 
48
50
  PLATFORMS
49
51
  ruby
@@ -58,4 +60,4 @@ DEPENDENCIES
58
60
  standard!
59
61
 
60
62
  BUNDLED WITH
61
- 2.1.4
63
+ 2.2.6
data/README.md CHANGED
@@ -367,7 +367,7 @@ Refer to RuboCop's [documentation on
367
367
  formatters](https://rubocop.readthedocs.io/en/latest/formatters/) for more
368
368
  information.
369
369
 
370
- ## How do I run standard in my editor?
370
+ ## How do I run Standard in my editor?
371
371
 
372
372
  It can be very handy to know about failures while editing to shorten the
373
373
  feedback loop. Some editors support asynchronously running linters.
@@ -378,6 +378,10 @@ feedback loop. Some editors support asynchronously running linters.
378
378
  - [vim (via ALE)](https://github.com/testdouble/standard/wiki/IDE:-vim)
379
379
  - [VS Code](https://github.com/testdouble/standard/wiki/IDE:-vscode)
380
380
 
381
+ ## How do I use Standard with Rubocop extensions?
382
+
383
+ 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.
384
+
381
385
  ## Does Standard work with [Insert other tool name here]?
382
386
 
383
387
  Maybe! Start by searching the repository to see if there's an existing issue open for
data/config/base.yml CHANGED
@@ -329,6 +329,9 @@ Layout/TrailingWhitespace:
329
329
  Enabled: true
330
330
  AllowInHeredoc: true
331
331
 
332
+ Lint/AmbiguousAssignment:
333
+ Enabled: true
334
+
332
335
  Lint/AmbiguousOperator:
333
336
  Enabled: true
334
337
 
@@ -360,10 +363,10 @@ Lint/Debugger:
360
363
  Lint/DeprecatedClassMethods:
361
364
  Enabled: true
362
365
 
363
- Lint/DeprecatedOpenSSLConstant:
366
+ Lint/DeprecatedConstants:
364
367
  Enabled: true
365
368
 
366
- Lint/DuplicateBranch:
369
+ Lint/DeprecatedOpenSSLConstant:
367
370
  Enabled: true
368
371
 
369
372
  Lint/DuplicateCaseCondition:
@@ -621,9 +624,6 @@ Naming/VariableName:
621
624
  Enabled: true
622
625
  EnforcedStyle: snake_case
623
626
 
624
- Performance/ArraySemiInfiniteRangeSlice:
625
- Enabled: true
626
-
627
627
  Performance/BigDecimalWithNumericArgument:
628
628
  Enabled: true
629
629
 
@@ -886,6 +886,9 @@ Style/GlobalVars:
886
886
  Enabled: true
887
887
  AllowedVariables: []
888
888
 
889
+ Style/HashExcept:
890
+ Enabled: true
891
+
889
892
  Style/HashSyntax:
890
893
  Enabled: true
891
894
  EnforcedStyle: ruby19_no_mixed_keys
@@ -945,7 +948,7 @@ Style/MultilineWhenThen:
945
948
 
946
949
  Style/NegatedIf:
947
950
  Enabled: true
948
- EnforcedStyle: both
951
+ EnforcedStyle: postfix
949
952
 
950
953
  Style/NegatedWhile:
951
954
  Enabled: true
@@ -1108,6 +1111,9 @@ Style/SingleLineMethods:
1108
1111
  Enabled: true
1109
1112
  AllowIfMethodIsEmpty: false
1110
1113
 
1114
+ Style/SlicingWithRange:
1115
+ Enabled: true
1116
+
1111
1117
  Style/StabbyLambdaParentheses:
1112
1118
  Enabled: true
1113
1119
  EnforcedStyle: require_parentheses
data/config/ruby-2.3.yml CHANGED
@@ -1,4 +1,4 @@
1
- inherit_from: ./base.yml
1
+ inherit_from: ./ruby-2.5.yml
2
2
 
3
3
  AllCops:
4
4
  TargetRubyVersion: 2.4 # The oldest supported
@@ -0,0 +1,7 @@
1
+ inherit_from: ./ruby-2.7.yml
2
+
3
+ AllCops:
4
+ TargetRubyVersion: 2.5
5
+
6
+ Style/SlicingWithRange:
7
+ Enabled: false
@@ -0,0 +1,7 @@
1
+ inherit_from: ./base.yml
2
+
3
+ AllCops:
4
+ TargetRubyVersion: 2.7
5
+
6
+ Style/HashExcept:
7
+ Enabled: true
@@ -1,7 +1,8 @@
1
1
  module RuboCop::Cop
2
2
  module Standard
3
- class SemanticBlocks < RuboCop::Cop::Cop
3
+ class SemanticBlocks < RuboCop::Cop::Base
4
4
  include RuboCop::Cop::IgnoredMethods
5
+ extend RuboCop::Cop::AutoCorrector
5
6
 
6
7
  def on_send(node)
7
8
  return unless node.arguments?
@@ -22,16 +23,14 @@ module RuboCop::Cop
22
23
  proper_block_style?(node) ||
23
24
  (!node.braces? && rescue_child_block?(node))
24
25
 
25
- add_offense(node, location: :begin)
26
- end
27
-
28
- def autocorrect(node)
29
- return if correction_would_break_code?(node)
26
+ add_offense(node.loc.begin, message: message(node)) do |corrector|
27
+ return if correction_would_break_code?(node)
30
28
 
31
- if node.braces?
32
- replace_braces_with_do_end(node.loc)
33
- else
34
- replace_do_end_with_braces(node.loc)
29
+ if node.braces?
30
+ replace_braces_with_do_end(corrector, node.loc)
31
+ else
32
+ replace_do_end_with_braces(corrector, node.loc)
33
+ end
35
34
  end
36
35
  end
37
36
 
@@ -47,29 +46,25 @@ module RuboCop::Cop
47
46
  end
48
47
  end
49
48
 
50
- def replace_braces_with_do_end(loc)
49
+ def replace_braces_with_do_end(corrector, loc)
51
50
  b = loc.begin
52
51
  e = loc.end
53
52
 
54
- lambda do |corrector|
55
- corrector.insert_before(b, " ") unless whitespace_before?(b)
56
- corrector.insert_before(e, " ") unless whitespace_before?(e)
57
- corrector.insert_after(b, " ") unless whitespace_after?(b)
58
- corrector.replace(b, "do")
59
- corrector.replace(e, "end")
60
- end
53
+ corrector.insert_before(b, " ") unless whitespace_before?(b)
54
+ corrector.insert_before(e, " ") unless whitespace_before?(e)
55
+ corrector.insert_after(b, " ") unless whitespace_after?(b)
56
+ corrector.replace(b, "do")
57
+ corrector.replace(e, "end")
61
58
  end
62
59
 
63
- def replace_do_end_with_braces(loc)
60
+ def replace_do_end_with_braces(corrector, loc)
64
61
  b = loc.begin
65
62
  e = loc.end
66
63
 
67
- lambda do |corrector|
68
- corrector.insert_after(b, " ") unless whitespace_after?(b, 2)
64
+ corrector.insert_after(b, " ") unless whitespace_after?(b, 2)
69
65
 
70
- corrector.replace(b, "{")
71
- corrector.replace(e, "}")
72
- end
66
+ corrector.replace(b, "{")
67
+ corrector.replace(e, "}")
73
68
  end
74
69
 
75
70
  def whitespace_before?(range)
@@ -18,6 +18,10 @@ class Standard::CreatesConfigStore
18
18
  "ruby-2.2.yml"
19
19
  elsif desired_version < Gem::Version.new("2.4")
20
20
  "ruby-2.3.yml"
21
+ elsif desired_version < Gem::Version.new("2.6")
22
+ "ruby-2.5.yml"
23
+ elsif desired_version < Gem::Version.new("3.0")
24
+ "ruby-2.7.yml"
21
25
  else
22
26
  "base.yml"
23
27
  end
@@ -28,7 +28,11 @@ module Standard
28
28
  def print_corrected_code_if_fixing_stdin(rubocop_options)
29
29
  return unless rubocop_options[:stdin] && rubocop_options[:auto_correct]
30
30
 
31
- puts "=" * 20
31
+ if rubocop_options[:stderr]
32
+ warn "=" * 20
33
+ else
34
+ puts "=" * 20
35
+ end
32
36
  print rubocop_options[:stdin]
33
37
  end
34
38
  end
@@ -1,3 +1,3 @@
1
1
  module Standard
2
- VERSION = Gem::Version.new("0.10.0")
2
+ VERSION = Gem::Version.new("0.13.0")
3
3
  end
data/standard.gemspec CHANGED
@@ -19,13 +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.4.2"
23
- spec.add_dependency "rubocop-performance", "1.9.1"
24
-
25
- spec.add_development_dependency "bundler"
26
- spec.add_development_dependency "minitest", "~> 5.0"
27
- spec.add_development_dependency "pry"
28
- spec.add_development_dependency "rake", "~> 13.0"
29
- spec.add_development_dependency "simplecov"
30
- spec.add_development_dependency "gimme"
22
+ spec.add_dependency "rubocop", "1.10.0"
23
+ spec.add_dependency "rubocop-performance", "1.9.2"
31
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: 0.10.0
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Searls
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-11-30 00:00:00.000000000 Z
11
+ date: 2021-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -16,112 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 1.4.2
19
+ version: 1.10.0
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.4.2
26
+ version: 1.10.0
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.9.1
33
+ version: 1.9.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.9.1
41
- - !ruby/object:Gem::Dependency
42
- name: bundler
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: minitest
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '5.0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '5.0'
69
- - !ruby/object:Gem::Dependency
70
- name: pry
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: rake
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '13.0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: '13.0'
97
- - !ruby/object:Gem::Dependency
98
- name: simplecov
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: gimme
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0'
40
+ version: 1.9.2
125
41
  description:
126
42
  email:
127
43
  - searls@gmail.com
@@ -130,6 +46,7 @@ executables:
130
46
  extensions: []
131
47
  extra_rdoc_files: []
132
48
  files:
49
+ - ".github/dependabot.yml"
133
50
  - ".github/workflows/test.yml"
134
51
  - ".gitignore"
135
52
  - ".standard.yml"
@@ -146,6 +63,8 @@ files:
146
63
  - config/ruby-1.9.yml
147
64
  - config/ruby-2.2.yml
148
65
  - config/ruby-2.3.yml
66
+ - config/ruby-2.5.yml
67
+ - config/ruby-2.7.yml
149
68
  - docs/RELEASE.md
150
69
  - exe/standardrb
151
70
  - lib/standard.rb