rubocop-sensei 0.1.2 → 0.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7f8ecd680160660a5b4445cd504edfd3307f3411cf128a39c7d0585cfb60e1eb
4
- data.tar.gz: 743d055afd20f09ee158d3dfc98fa54fd8df74734ff172bf6a60454d5f1ed34e
3
+ metadata.gz: 4417b210dffcd34adf72e0699d8f8fb835da4adf6495800f61b4d20337ef1789
4
+ data.tar.gz: 0e52dde379f1e0f6d1bef9e6e294c8504dc07862522712edcd2162ff0170ecc0
5
5
  SHA512:
6
- metadata.gz: ac08f2b720e36c363e911a2a07230d65455cc3275456d61344f952e90af05b95ad366d8a2760a4c126d324555c2641ae2d783dc1fc2425f307eaf4457bb92ebc
7
- data.tar.gz: 2a8bf2ad71da661994ab758a9b331ae18939c38a12e4e715b7617fc0245d18a36c211e2f382faff4013b5cacdd71cb972d4ab3ee2a5892cac173f19abe9fadd8
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.2)
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.1.3.0)
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.3.0)
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: '`elsif` can be replaced with `case`'
2
+ Description: "`elsif` can be replaced with `case`"
3
3
  Enabled: true
4
- VersionAdded: '0.1.0'
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
@@ -1,3 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative 'lecture/replace_elsif'
4
+ require_relative 'lecture/unless_else'
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RuboCop
4
4
  module Sensei
5
- VERSION = "0.1.2"
5
+ VERSION = "0.1.3"
6
6
  end
7
7
  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.2
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-02 00:00:00.000000000 Z
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