rubocop-sensei 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -3
- data/config/default.yml +7 -2
- data/lib/rubocop/cop/lecture/unless_else.rb +30 -0
- data/lib/rubocop/cop/sensei_cops.rb +1 -0
- data/lib/rubocop/sensei/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4417b210dffcd34adf72e0699d8f8fb835da4adf6495800f61b4d20337ef1789
|
4
|
+
data.tar.gz: 0e52dde379f1e0f6d1bef9e6e294c8504dc07862522712edcd2162ff0170ecc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ce15e09a41f442788be5ef73bb6612d1c2716a2860f2d1fa71b1cb8788d6ee0861039e49bdb69436a0ef1010fa0d73a8fd88ae426930795059b89c50084ebf4
|
7
|
+
data.tar.gz: d9cf4aab057cc1af99cb732702eb6deda38ae9c6b4763b599ab36e836ae75a5ed86266990c68adfb7b093328f81d49db74c3a5752016369c9c1d550f1f902f7c
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rubocop-sensei (0.1.
|
4
|
+
rubocop-sensei (0.1.3)
|
5
5
|
rubocop
|
6
6
|
|
7
7
|
GEM
|
@@ -18,7 +18,7 @@ GEM
|
|
18
18
|
json (2.6.3)
|
19
19
|
minitest (5.17.0)
|
20
20
|
parallel (1.22.1)
|
21
|
-
parser (3.
|
21
|
+
parser (3.2.0.0)
|
22
22
|
ast (~> 2.4.1)
|
23
23
|
rainbow (3.1.1)
|
24
24
|
rake (13.0.6)
|
@@ -52,7 +52,7 @@ GEM
|
|
52
52
|
rubocop-ast (1.24.1)
|
53
53
|
parser (>= 3.1.1.0)
|
54
54
|
ruby-progressbar (1.11.0)
|
55
|
-
unicode-display_width (2.
|
55
|
+
unicode-display_width (2.4.2)
|
56
56
|
|
57
57
|
PLATFORMS
|
58
58
|
arm64-darwin-21
|
data/config/default.yml
CHANGED
@@ -1,4 +1,9 @@
|
|
1
1
|
Lecture/ReplaceElsif:
|
2
|
-
Description:
|
2
|
+
Description: "`elsif` can be replaced with `case`"
|
3
3
|
Enabled: true
|
4
|
-
VersionAdded:
|
4
|
+
VersionAdded: "0.1.0"
|
5
|
+
|
6
|
+
Lecture/UnlessElse:
|
7
|
+
Description: "Do not use `unless` with `else`. Rewrite these with the positive case first."
|
8
|
+
Enabled: true
|
9
|
+
VersionAdded: "0.1.3"
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module Lecture
|
6
|
+
class UnlessElse < ::RuboCop::Cop::Style::UnlessElse
|
7
|
+
MSG = <<~STRING
|
8
|
+
`unless` `else` は避けた方が良いです。
|
9
|
+
`if` をつかって書き直すと読みやすくなります。
|
10
|
+
|
11
|
+
unless x == 1
|
12
|
+
puts "foo"
|
13
|
+
else
|
14
|
+
puts "bar"
|
15
|
+
end
|
16
|
+
|
17
|
+
ifをつかって書き直した例です。
|
18
|
+
|
19
|
+
if x == 1
|
20
|
+
puts "bar"
|
21
|
+
else
|
22
|
+
puts "foo"
|
23
|
+
end
|
24
|
+
|
25
|
+
このCopは RuboCop gem Style/UnlessElse と同じ内容です。
|
26
|
+
STRING
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kuniaki Igarashi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-01-
|
11
|
+
date: 2023-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -41,6 +41,7 @@ files:
|
|
41
41
|
- config/default.yml
|
42
42
|
- lib/rubocop-sensei.rb
|
43
43
|
- lib/rubocop/cop/lecture/replace_elsif.rb
|
44
|
+
- lib/rubocop/cop/lecture/unless_else.rb
|
44
45
|
- lib/rubocop/cop/sensei_cops.rb
|
45
46
|
- lib/rubocop/sensei.rb
|
46
47
|
- lib/rubocop/sensei/inject.rb
|