rubocop-changes 0.2.1 → 0.5.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: 50e0fe36dd214c6ebca9ce5ea0a28097067b2848ccd564d93948de80b6e48716
4
- data.tar.gz: 323e47e805dcfe812de8a0122233bc7fa550ed4985bba84920695cf26eebe11a
3
+ metadata.gz: 06a4d924f28228a2e5514caeb0f2c2f6879522e2e1fe4ca718424706ce8559ad
4
+ data.tar.gz: a4422055a7c6caffef88d1abc1bdb5e13cef6e64c077c5df5f45c72359ca1cda
5
5
  SHA512:
6
- metadata.gz: 6da1d6432513a289128cf1a23e641b80ea17a3b7a42fe87c208e44c58d32a943618a66dc826ab0368fef043a89412d54bb65e2b862bc3c62b463692f851cdbe3
7
- data.tar.gz: 7c0670bfcbe7d1b5662d5c0ae7e9d1df5212ea130de6ec4693ac04d511f4354576c0c633d9b8b78e05c942e61c3652fb9c66a3aec9d889c0a01253cd76020309
6
+ metadata.gz: f70ab20c2eb40ba114735c1dfa4d24d2823b681ccc64b21c9e5f81497311438bb14afd050e5c4c9a387355d2fa1522004e34a7ddda46afdba979289ec7e1cf88
7
+ data.tar.gz: c2548a708550197c75f9e83b85f1c975ab55e81a6eecee9b552901724f1297fe0d1f5225b25e0f91693ea26b5c7b7a3f35d2f37b582edcef79ee63a0dc904429
data/.gitignore CHANGED
@@ -10,3 +10,5 @@
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
12
  .byebug_history
13
+
14
+ *.gem
data/.rubocop.yml CHANGED
@@ -1,5 +1,27 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.5
3
+ NewCops: disable
4
+
5
+ Lint/RaiseException:
6
+ Enabled: false
7
+
8
+ Lint/StructNewOverride:
9
+ Enabled: false
10
+
11
+ Style/HashEachMethods:
12
+ Enabled: false
13
+
14
+ Style/HashTransformKeys:
15
+ Enabled: false
16
+
17
+ Style/HashTransformValues:
18
+ Enabled: false
19
+
1
20
  Style/Documentation:
2
21
  Enabled: false
3
22
 
4
- Metrics/LineLength:
23
+ Style/FrozenStringLiteralComment:
24
+ Enabled: false
25
+
26
+ Layout/LineLength:
5
27
  Max: 120
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source "https://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in rubocop-changes.gemspec
4
4
  gemspec
data/Gemfile.lock CHANGED
@@ -1,23 +1,24 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rubocop-changes (0.2.1)
4
+ rubocop-changes (0.4.0)
5
5
  git_diff_parser (~> 3.2)
6
- rubocop (~> 0.59)
6
+ rubocop (~> 1.25)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- ast (2.4.0)
11
+ ast (2.4.2)
12
12
  byebug (10.0.2)
13
13
  diff-lcs (1.3)
14
14
  git_diff_parser (3.2.0)
15
- jaro_winkler (1.5.4)
16
- parallel (1.19.1)
17
- parser (2.6.5.0)
18
- ast (~> 2.4.0)
19
- rainbow (3.0.0)
20
- rake (10.5.0)
15
+ parallel (1.21.0)
16
+ parser (3.1.0.0)
17
+ ast (~> 2.4.1)
18
+ rainbow (3.1.1)
19
+ rake (13.0.3)
20
+ regexp_parser (2.2.0)
21
+ rexml (3.2.5)
21
22
  rspec (3.9.0)
22
23
  rspec-core (~> 3.9.0)
23
24
  rspec-expectations (~> 3.9.0)
@@ -31,15 +32,19 @@ GEM
31
32
  diff-lcs (>= 1.2.0, < 2.0)
32
33
  rspec-support (~> 3.9.0)
33
34
  rspec-support (3.9.0)
34
- rubocop (0.76.0)
35
- jaro_winkler (~> 1.5.1)
35
+ rubocop (1.25.0)
36
36
  parallel (~> 1.10)
37
- parser (>= 2.6)
37
+ parser (>= 3.1.0.0)
38
38
  rainbow (>= 2.2.2, < 4.0)
39
+ regexp_parser (>= 1.8, < 3.0)
40
+ rexml
41
+ rubocop-ast (>= 1.15.1, < 2.0)
39
42
  ruby-progressbar (~> 1.7)
40
- unicode-display_width (>= 1.4.0, < 1.7)
41
- ruby-progressbar (1.10.1)
42
- unicode-display_width (1.6.0)
43
+ unicode-display_width (>= 1.4.0, < 3.0)
44
+ rubocop-ast (1.15.1)
45
+ parser (>= 3.0.1.1)
46
+ ruby-progressbar (1.11.0)
47
+ unicode-display_width (2.1.0)
43
48
 
44
49
  PLATFORMS
45
50
  ruby
@@ -47,9 +52,9 @@ PLATFORMS
47
52
  DEPENDENCIES
48
53
  bundler (~> 2.0)
49
54
  byebug (~> 10.0)
50
- rake (~> 10.0)
55
+ rake (~> 13.0)
51
56
  rspec (~> 3.0)
52
57
  rubocop-changes!
53
58
 
54
59
  BUNDLED WITH
55
- 2.0.2
60
+ 2.1.4
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task :default => :spec
6
+ task default: :spec
data/bin/console CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "bundler/setup"
4
- require "rubocop/changes"
3
+ require 'bundler/setup'
4
+ require 'rubocop/changes'
5
5
 
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
@@ -10,5 +10,5 @@ require "rubocop/changes"
10
10
  # require "pry"
11
11
  # Pry.start
12
12
 
13
- require "irb"
13
+ require 'irb'
14
14
  IRB.start(__FILE__)
data/exe/rubocop-changes CHANGED
@@ -11,7 +11,8 @@ args = Rubocop::Changes::Options.new.parse!
11
11
  offenses = Rubocop::Changes::Checker.new(
12
12
  format: args.format,
13
13
  quiet: args.quiet,
14
- commit: args.commit
14
+ commit: args.commit,
15
+ auto_correct: args.auto_correct
15
16
  ).run
16
17
 
17
18
  exit offenses.count.positive? ? 1 : 0
@@ -13,10 +13,11 @@ module Rubocop
13
13
  class UnknownForkPointError < StandardError; end
14
14
 
15
15
  class Checker
16
- def initialize(format:, quiet:, commit:)
16
+ def initialize(format:, quiet:, commit:, auto_correct:)
17
17
  @format = format
18
18
  @quiet = quiet
19
19
  @commit = commit
20
+ @auto_correct = auto_correct
20
21
  end
21
22
 
22
23
  def run
@@ -30,7 +31,7 @@ module Rubocop
30
31
 
31
32
  private
32
33
 
33
- attr_reader :format, :quiet, :commit
34
+ attr_reader :format, :quiet, :commit, :auto_correct
34
35
 
35
36
  def fork_point
36
37
  @fork_point ||= Shell.run(command)
@@ -59,7 +60,26 @@ module Rubocop
59
60
  end
60
61
 
61
62
  def rubocop
62
- Shell.run("rubocop -f j #{ruby_changed_files.join(' ')}")
63
+ shell_command = [
64
+ 'rubocop',
65
+ exclussion_modifier,
66
+ formatter_modifier,
67
+ auto_correct_modifier
68
+ ].compact.join(' ')
69
+
70
+ Shell.run(shell_command)
71
+ end
72
+
73
+ def exclussion_modifier
74
+ '--force-exclusion'
75
+ end
76
+
77
+ def formatter_modifier
78
+ "-f j #{ruby_changed_files.join(' ')}"
79
+ end
80
+
81
+ def auto_correct_modifier
82
+ '-a' if @auto_correct
63
83
  end
64
84
 
65
85
  def rubocop_json
@@ -5,10 +5,10 @@ require 'optparse'
5
5
  module Rubocop
6
6
  module Changes
7
7
  class Options
8
- Options = Struct.new(:format, :quiet, :commit)
8
+ Options = Struct.new(:format, :quiet, :commit, :auto_correct)
9
9
 
10
10
  def initialize
11
- @args = Options.new(:simple, false, nil) # Defaults
11
+ @args = Options.new(:simple, false, nil, false) # Defaults
12
12
  end
13
13
 
14
14
  def parse!
@@ -18,6 +18,7 @@ module Rubocop
18
18
  parse_formatter!(opts)
19
19
  parse_commit!(opts)
20
20
  parse_quiet!(opts)
21
+ parse_auto_correct!(opts)
21
22
  parse_help!(opts)
22
23
  parse_version!(opts)
23
24
  end.parse!
@@ -64,6 +65,12 @@ module Rubocop
64
65
  end
65
66
  end
66
67
 
68
+ def parse_auto_correct!(opts)
69
+ opts.on('-a', '--auto-correct', 'Auto correct errors') do |v|
70
+ args.auto_correct = v
71
+ end
72
+ end
73
+
67
74
  def parse_help!(opts)
68
75
  opts.on('-h', '--help', 'Prints this help') do
69
76
  puts opts
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Rubocop
4
4
  module Changes
5
- VERSION = '0.2.1'
5
+ VERSION = '0.5.0'
6
6
  end
7
7
  end
@@ -6,7 +6,7 @@ Gem::Specification.new do |spec|
6
6
  spec.name = 'rubocop-changes'
7
7
  spec.version = Rubocop::Changes::VERSION
8
8
  spec.platform = Gem::Platform::RUBY
9
- spec.required_ruby_version = '>= 2.3.0'
9
+ spec.required_ruby_version = '>= 2.5.0'
10
10
  spec.authors = ['Ferran Basora']
11
11
  spec.email = ['fcsonline@gmail.com']
12
12
 
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
28
28
  # Specify which files should be added to the gem when it is released.
29
29
  # The `git ls-files -z` loads the files in the RubyGem that have been added
30
30
  # into git.
31
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
31
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
32
32
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
33
33
  end
34
34
  spec.bindir = 'exe'
@@ -37,10 +37,10 @@ Gem::Specification.new do |spec|
37
37
  spec.require_paths = ['lib']
38
38
 
39
39
  spec.add_runtime_dependency 'git_diff_parser', '~> 3.2'
40
- spec.add_runtime_dependency 'rubocop', '~> 0.59'
40
+ spec.add_runtime_dependency 'rubocop', '~> 1.25'
41
41
 
42
42
  spec.add_development_dependency 'bundler', '~> 2.0'
43
43
  spec.add_development_dependency 'byebug', '~> 10.0'
44
- spec.add_development_dependency 'rake', '~> 10.0'
44
+ spec.add_development_dependency 'rake', '~> 13.0'
45
45
  spec.add_development_dependency 'rspec', '~> 3.0'
46
46
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-changes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ferran Basora
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-01-17 00:00:00.000000000 Z
11
+ date: 2022-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: git_diff_parser
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.59'
33
+ version: '1.25'
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: '0.59'
40
+ version: '1.25'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '10.0'
75
+ version: '13.0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '10.0'
82
+ version: '13.0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rspec
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -141,15 +141,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
141
141
  requirements:
142
142
  - - ">="
143
143
  - !ruby/object:Gem::Version
144
- version: 2.3.0
144
+ version: 2.5.0
145
145
  required_rubygems_version: !ruby/object:Gem::Requirement
146
146
  requirements:
147
147
  - - ">="
148
148
  - !ruby/object:Gem::Version
149
149
  version: '0'
150
150
  requirements: []
151
- rubyforge_project:
152
- rubygems_version: 2.7.6
151
+ rubygems_version: 3.0.1
153
152
  signing_key:
154
153
  specification_version: 4
155
154
  summary: Rubocop on changed lines from git fork point