rubocop-sensei 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +10 -10
- data/config/default.yml +1 -1
- data/lib/rubocop/cop/{style → lecture}/replace_elsif.rb +5 -2
- data/lib/rubocop/cop/sensei_cops.rb +1 -1
- data/lib/rubocop/sensei/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f8ecd680160660a5b4445cd504edfd3307f3411cf128a39c7d0585cfb60e1eb
|
4
|
+
data.tar.gz: 743d055afd20f09ee158d3dfc98fa54fd8df74734ff172bf6a60454d5f1ed34e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac08f2b720e36c363e911a2a07230d65455cc3275456d61344f952e90af05b95ad366d8a2760a4c126d324555c2641ae2d783dc1fc2425f307eaf4457bb92ebc
|
7
|
+
data.tar.gz: 2a8bf2ad71da661994ab758a9b331ae18939c38a12e4e715b7617fc0245d18a36c211e2f382faff4013b5cacdd71cb972d4ab3ee2a5892cac173f19abe9fadd8
|
data/Gemfile.lock
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rubocop-sensei (0.1.
|
4
|
+
rubocop-sensei (0.1.2)
|
5
5
|
rubocop
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
10
|
ast (2.4.2)
|
11
|
-
debug (1.7.
|
11
|
+
debug (1.7.1)
|
12
12
|
irb (>= 1.5.0)
|
13
13
|
reline (>= 0.3.1)
|
14
14
|
diff-lcs (1.5.0)
|
15
|
-
io-console (0.
|
16
|
-
irb (1.6.
|
15
|
+
io-console (0.6.0)
|
16
|
+
irb (1.6.2)
|
17
17
|
reline (>= 0.3.0)
|
18
18
|
json (2.6.3)
|
19
|
-
minitest (5.
|
19
|
+
minitest (5.17.0)
|
20
20
|
parallel (1.22.1)
|
21
21
|
parser (3.1.3.0)
|
22
22
|
ast (~> 2.4.1)
|
23
23
|
rainbow (3.1.1)
|
24
24
|
rake (13.0.6)
|
25
25
|
regexp_parser (2.6.1)
|
26
|
-
reline (0.3.
|
26
|
+
reline (0.3.2)
|
27
27
|
io-console (~> 0.5)
|
28
28
|
rexml (3.2.5)
|
29
29
|
rspec (3.12.0)
|
@@ -32,21 +32,21 @@ GEM
|
|
32
32
|
rspec-mocks (~> 3.12.0)
|
33
33
|
rspec-core (3.12.0)
|
34
34
|
rspec-support (~> 3.12.0)
|
35
|
-
rspec-expectations (3.12.
|
35
|
+
rspec-expectations (3.12.1)
|
36
36
|
diff-lcs (>= 1.2.0, < 2.0)
|
37
37
|
rspec-support (~> 3.12.0)
|
38
|
-
rspec-mocks (3.12.
|
38
|
+
rspec-mocks (3.12.1)
|
39
39
|
diff-lcs (>= 1.2.0, < 2.0)
|
40
40
|
rspec-support (~> 3.12.0)
|
41
41
|
rspec-support (3.12.0)
|
42
|
-
rubocop (1.
|
42
|
+
rubocop (1.42.0)
|
43
43
|
json (~> 2.3)
|
44
44
|
parallel (~> 1.10)
|
45
45
|
parser (>= 3.1.2.1)
|
46
46
|
rainbow (>= 2.2.2, < 4.0)
|
47
47
|
regexp_parser (>= 1.8, < 3.0)
|
48
48
|
rexml (>= 3.2.5, < 4.0)
|
49
|
-
rubocop-ast (>= 1.
|
49
|
+
rubocop-ast (>= 1.24.1, < 2.0)
|
50
50
|
ruby-progressbar (~> 1.7)
|
51
51
|
unicode-display_width (>= 1.4.0, < 3.0)
|
52
52
|
rubocop-ast (1.24.1)
|
data/config/default.yml
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module RuboCop
|
4
4
|
module Cop
|
5
|
-
module
|
5
|
+
module Lecture
|
6
6
|
# `elsif`は`case`で書き換え可能です。
|
7
7
|
# N個の分岐から1つ選ぶ「N者択一」のときはcaseをつかうと読みやすくなります。
|
8
8
|
#
|
@@ -65,7 +65,10 @@ module RuboCop
|
|
65
65
|
return unless node.elsif?
|
66
66
|
|
67
67
|
add_offense(node) do |corrector|
|
68
|
-
|
68
|
+
# if => case when
|
69
|
+
replacing_string = "case" + "\n" +
|
70
|
+
" " * node.parent.source_range.column + "when"
|
71
|
+
corrector.replace(node.parent.loc.keyword, replacing_string)
|
69
72
|
corrector.replace(node.loc.keyword, "when") # elsif => when
|
70
73
|
end
|
71
74
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-sensei
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kuniaki Igarashi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -40,8 +40,8 @@ files:
|
|
40
40
|
- Rakefile
|
41
41
|
- config/default.yml
|
42
42
|
- lib/rubocop-sensei.rb
|
43
|
+
- lib/rubocop/cop/lecture/replace_elsif.rb
|
43
44
|
- lib/rubocop/cop/sensei_cops.rb
|
44
|
-
- lib/rubocop/cop/style/replace_elsif.rb
|
45
45
|
- lib/rubocop/sensei.rb
|
46
46
|
- lib/rubocop/sensei/inject.rb
|
47
47
|
- lib/rubocop/sensei/version.rb
|