rubocop-changes 0.5.0 → 0.6.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 +4 -4
- data/.github/workflows/ci.yml +23 -0
- data/.gitignore +1 -0
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/exe/rubocop-changes +2 -1
- data/lib/rubocop/changes/checker.rb +3 -2
- data/lib/rubocop/changes/options.rb +9 -2
- data/lib/rubocop/changes/version.rb +1 -1
- metadata +4 -4
- data/.travis.yml +0 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ee87c885eb2498625bb6f9fc0a59719cbd1c59d71419fd32e1fc3128aa201ce0
|
|
4
|
+
data.tar.gz: 947199d33a4427840836b901f780661b98f32428ac6aaaae8012c5cf449e4a48
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6eb29fc5b10fcdcbbb9966d5d287459def271a9ac1d593e81d227c7c1e78fb15e1a74018e93c6fd6251d24d4037da6df7b6a5c1b7e862fabaf56a7cfd70368e6
|
|
7
|
+
data.tar.gz: e43732b83c2f830f69fa795ac96d6c80bce7c1f48e0e54c9a4e076fc1614056b264268241dd9deee99a1520b99f97219c005cb6a60ec90c09bbb8be1b4423d01
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on: [push, pull_request]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
test:
|
|
7
|
+
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
|
|
10
|
+
strategy:
|
|
11
|
+
fail-fast: false
|
|
12
|
+
matrix:
|
|
13
|
+
ruby: ["2.5", "2.6", "2.7", "3.0", "3.1", ruby-head]
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v2
|
|
17
|
+
- name: Set up Ruby
|
|
18
|
+
uses: ruby/setup-ruby@v1
|
|
19
|
+
with:
|
|
20
|
+
bundler-cache: true # 'bundle install' and cache gems
|
|
21
|
+
ruby-version: ${{ matrix.ruby }}
|
|
22
|
+
- name: Run tests
|
|
23
|
+
run: bundle exec rake
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Rubocop::Changes
|
|
2
2
|
|
|
3
3
|
[](https://rubygems.org/gems/rubocop-changes)
|
|
4
|
-
[](https://github.com/fcsonline/rubocop-changes/actions/workflows/ci.yml)
|
|
5
5
|
|
|
6
6
|
`rubocop-changes` runs rubocop and shows only the offenses you introduced since
|
|
7
7
|
the fork point of your git branch. Will not complain about existing offenses in
|
data/exe/rubocop-changes
CHANGED
|
@@ -12,7 +12,8 @@ offenses = Rubocop::Changes::Checker.new(
|
|
|
12
12
|
format: args.format,
|
|
13
13
|
quiet: args.quiet,
|
|
14
14
|
commit: args.commit,
|
|
15
|
-
auto_correct: args.auto_correct
|
|
15
|
+
auto_correct: args.auto_correct,
|
|
16
|
+
base_branch: args.base_branch
|
|
16
17
|
).run
|
|
17
18
|
|
|
18
19
|
exit offenses.count.positive? ? 1 : 0
|
|
@@ -13,11 +13,12 @@ module Rubocop
|
|
|
13
13
|
class UnknownForkPointError < StandardError; end
|
|
14
14
|
|
|
15
15
|
class Checker
|
|
16
|
-
def initialize(format:, quiet:, commit:, auto_correct:)
|
|
16
|
+
def initialize(format:, quiet:, commit:, auto_correct:, base_branch:)
|
|
17
17
|
@format = format
|
|
18
18
|
@quiet = quiet
|
|
19
19
|
@commit = commit
|
|
20
20
|
@auto_correct = auto_correct
|
|
21
|
+
@base_branch = base_branch
|
|
21
22
|
end
|
|
22
23
|
|
|
23
24
|
def run
|
|
@@ -38,7 +39,7 @@ module Rubocop
|
|
|
38
39
|
end
|
|
39
40
|
|
|
40
41
|
def command
|
|
41
|
-
return
|
|
42
|
+
return "git merge-base HEAD origin/#{@base_branch}" unless commit
|
|
42
43
|
|
|
43
44
|
"git log -n 1 --pretty=format:\"%h\" #{commit}"
|
|
44
45
|
end
|
|
@@ -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, :auto_correct)
|
|
8
|
+
Options = Struct.new(:format, :quiet, :commit, :auto_correct, :base_branch)
|
|
9
9
|
|
|
10
10
|
def initialize
|
|
11
|
-
@args = Options.new(:simple, false, nil, false) # Defaults
|
|
11
|
+
@args = Options.new(:simple, false, nil, false, 'main') # Defaults
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
def parse!
|
|
@@ -21,6 +21,7 @@ module Rubocop
|
|
|
21
21
|
parse_auto_correct!(opts)
|
|
22
22
|
parse_help!(opts)
|
|
23
23
|
parse_version!(opts)
|
|
24
|
+
parse_base_branch!(opts)
|
|
24
25
|
end.parse!
|
|
25
26
|
|
|
26
27
|
args
|
|
@@ -71,6 +72,12 @@ module Rubocop
|
|
|
71
72
|
end
|
|
72
73
|
end
|
|
73
74
|
|
|
75
|
+
def parse_base_branch!(opts)
|
|
76
|
+
opts.on('-b', '--base_branch [BRANCH]', 'Base branch to compare') do |v|
|
|
77
|
+
args.base_branch = v
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
74
81
|
def parse_help!(opts)
|
|
75
82
|
opts.on('-h', '--help', 'Prints this help') do
|
|
76
83
|
puts opts
|
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.
|
|
4
|
+
version: 0.6.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: 2022-01
|
|
11
|
+
date: 2022-04-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: git_diff_parser
|
|
@@ -107,10 +107,10 @@ extra_rdoc_files:
|
|
|
107
107
|
- LICENSE.txt
|
|
108
108
|
- README.md
|
|
109
109
|
files:
|
|
110
|
+
- ".github/workflows/ci.yml"
|
|
110
111
|
- ".gitignore"
|
|
111
112
|
- ".rspec"
|
|
112
113
|
- ".rubocop.yml"
|
|
113
|
-
- ".travis.yml"
|
|
114
114
|
- CODE_OF_CONDUCT.md
|
|
115
115
|
- Gemfile
|
|
116
116
|
- Gemfile.lock
|
|
@@ -148,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
148
148
|
- !ruby/object:Gem::Version
|
|
149
149
|
version: '0'
|
|
150
150
|
requirements: []
|
|
151
|
-
rubygems_version: 3.
|
|
151
|
+
rubygems_version: 3.1.2
|
|
152
152
|
signing_key:
|
|
153
153
|
specification_version: 4
|
|
154
154
|
summary: Rubocop on changed lines from git fork point
|