slimcop 0.4.0 → 0.5.0

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: 9ab6599d37901d9e9929043564f7f33d4146f73f0cd7074e35f4d7270132593a
4
- data.tar.gz: 6ffe356cf877e21bd58b96372c32f5b3c013ac411a90b94d883688f8ed324923
3
+ metadata.gz: 294e38d0a479f35dc2d3c6c2c042af57645927ec17cc2b91b6e6c68107defd40
4
+ data.tar.gz: 5f65145f2f89a7fbae3341228bc5d3b2ac8c53c065748ed2dc2e86a1f49d8d95
5
5
  SHA512:
6
- metadata.gz: 6571cd6e9631d02cb9bc5ee50c565e59f4bcfd0bea78fa9a1eb77ca0fdd4804851f5edf0b65b84b7e643fcbf844c117e33daf3c5d66992b998839f2f9438ef0b
7
- data.tar.gz: 56ca6a6482bbffd3d1c7c3204a3bd1370d60aa18fce6535439c71ebbb3ada51a248a16d0d272ecb9cd9a0291dcb011c3996f3e0c26b03089b7c55fd06c30d179
6
+ metadata.gz: cd736f85dafc680f45a77ab81f791620909eda2c23523cf0d7ce4e999587c464946c14a77a2e1853cd4f14da26e9cd2fd17b444ef0d53e031ae38220adef9998
7
+ data.tar.gz: 840ee9ef8e7db1c8fb6590b36c157114784c51c20de7adad8a947fc4df305bb54b838fd63faadcbfafb52f715533effaaa95d5fd408a5be81fea546456dfaf95
data/.rubocop.yml CHANGED
@@ -1,3 +1,6 @@
1
+ require:
2
+ - rubocop-rspec
3
+
1
4
  AllCops:
2
5
  NewCops: enable
3
6
  SuggestExtensions: false
@@ -9,5 +12,20 @@ Layout/LineLength:
9
12
  Metrics:
10
13
  Enabled: false
11
14
 
15
+ RSpec/AnyInstance:
16
+ Enabled: false
17
+
18
+ RSpec/ExampleLength:
19
+ Enabled: false
20
+
21
+ RSpec/ImplicitSubject:
22
+ Enabled: false
23
+
24
+ RSpec/MultipleExpectations:
25
+ Enabled: false
26
+
27
+ RSpec/NamedSubject:
28
+ Enabled: false
29
+
12
30
  Style/Documentation:
13
31
  Enabled: false
data/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.5.0 - 2021-12-27
6
+
7
+ ### Changed
8
+
9
+ - Ignore Lint/EmptyFile by default.
10
+ - Ignore Style/RescueModifier by default.
11
+
12
+ ### Fixed
13
+
14
+ - Fix NoMethodError on some RuboCop offenses.
15
+ - Fix bug when uncorrectable RuboCop offense exists.
16
+
5
17
  ## 0.4.0 - 2021-12-26
6
18
 
7
19
  ### Added
data/Gemfile CHANGED
@@ -2,11 +2,9 @@
2
2
 
3
3
  source 'https://rubygems.org'
4
4
 
5
- # Specify your gem's dependencies in slimcop.gemspec
6
5
  gemspec
7
6
 
8
7
  gem 'rake', '~> 13.0'
9
-
10
- gem 'rspec', '~> 3.0'
11
-
12
- gem 'rubocop', '~> 1.21'
8
+ gem 'rspec'
9
+ gem 'rubocop'
10
+ gem 'rubocop-rspec'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- slimcop (0.4.0)
4
+ slimcop (0.5.0)
5
5
  rainbow
6
6
  rubocop (>= 0.87)
7
7
  slimi (>= 0.4)
@@ -42,8 +42,10 @@ GEM
42
42
  unicode-display_width (>= 1.4.0, < 3.0)
43
43
  rubocop-ast (1.15.0)
44
44
  parser (>= 3.0.1.1)
45
+ rubocop-rspec (2.6.0)
46
+ rubocop (~> 1.19)
45
47
  ruby-progressbar (1.11.0)
46
- slimi (0.4.0)
48
+ slimi (0.4.1)
47
49
  temple
48
50
  temple (0.8.2)
49
51
  unicode-display_width (2.1.0)
@@ -53,8 +55,9 @@ PLATFORMS
53
55
 
54
56
  DEPENDENCIES
55
57
  rake (~> 13.0)
56
- rspec (~> 3.0)
57
- rubocop (~> 1.21)
58
+ rspec
59
+ rubocop
60
+ rubocop-rspec
58
61
  slimcop!
59
62
 
60
63
  BUNDLED WITH
data/default.yml CHANGED
@@ -10,6 +10,9 @@ Layout/BlockAlignment:
10
10
  Layout/ClosingParenthesisIndentation:
11
11
  Enabled: false
12
12
 
13
+ Lint/EmptyFile:
14
+ Enabled: false
15
+
13
16
  Layout/EmptyLineAfterGuardClause:
14
17
  Enabled: false
15
18
 
@@ -100,6 +103,9 @@ Style/IfUnlessModifier:
100
103
  Style/Next:
101
104
  Enabled: false
102
105
 
106
+ Style/RescueModifier:
107
+ Enabled: false
108
+
103
109
  Style/WhileUntilDo:
104
110
  Enabled: false
105
111
 
@@ -4,6 +4,9 @@ require 'parser'
4
4
 
5
5
  module Slimcop
6
6
  class Offense
7
+ # @return [String]
8
+ attr_reader :file_path
9
+
7
10
  # @return [Integer]
8
11
  attr_reader :offset
9
12
 
@@ -13,7 +16,8 @@ module Slimcop
13
16
  # @param [Integer] offset
14
17
  # @param [RuboCop::Cop::Offense] rubocop_offense
15
18
  # @param [String] source Slim code.
16
- def initialize(offset:, rubocop_offense:, source:)
19
+ def initialize(file_path:, offset:, rubocop_offense:, source:)
20
+ @file_path = file_path
17
21
  @offset = offset
18
22
  @rubocop_offense = rubocop_offense
19
23
  @source = source
@@ -24,11 +28,6 @@ module Slimcop
24
28
  @rubocop_offense.corrector
25
29
  end
26
30
 
27
- # @return [String]
28
- def file_path
29
- @rubocop_offense.location.source_buffer.name
30
- end
31
-
32
31
  # @return [Integer]
33
32
  def line
34
33
  range.line
@@ -24,7 +24,7 @@ module Slimcop
24
24
 
25
25
  # @return [Array<Proc>]
26
26
  def corrections
27
- @offenses.map do |offense|
27
+ @offenses.select(&:corrector).map do |offense|
28
28
  lambda do |corrector|
29
29
  corrector.import!(offense.corrector, offset: offense.offset)
30
30
  end
@@ -24,6 +24,7 @@ module Slimcop
24
24
  source: snippet[:code]
25
25
  ).call.map do |rubocop_offense|
26
26
  Offense.new(
27
+ file_path: @file_path,
27
28
  offset: snippet[:begin_],
28
29
  rubocop_offense: rubocop_offense,
29
30
  source: @source
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Slimcop
4
- VERSION = '0.4.0'
4
+ VERSION = '0.5.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slimcop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryo Nakamura