rubocop-changes 0.5.0 → 0.6.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: 06a4d924f28228a2e5514caeb0f2c2f6879522e2e1fe4ca718424706ce8559ad
4
- data.tar.gz: a4422055a7c6caffef88d1abc1bdb5e13cef6e64c077c5df5f45c72359ca1cda
3
+ metadata.gz: ee87c885eb2498625bb6f9fc0a59719cbd1c59d71419fd32e1fc3128aa201ce0
4
+ data.tar.gz: 947199d33a4427840836b901f780661b98f32428ac6aaaae8012c5cf449e4a48
5
5
  SHA512:
6
- metadata.gz: f70ab20c2eb40ba114735c1dfa4d24d2823b681ccc64b21c9e5f81497311438bb14afd050e5c4c9a387355d2fa1522004e34a7ddda46afdba979289ec7e1cf88
7
- data.tar.gz: c2548a708550197c75f9e83b85f1c975ab55e81a6eecee9b552901724f1297fe0d1f5225b25e0f91693ea26b5c7b7a3f35d2f37b582edcef79ee63a0dc904429
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
@@ -12,3 +12,4 @@
12
12
  .byebug_history
13
13
 
14
14
  *.gem
15
+ .idea
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rubocop-changes (0.4.0)
4
+ rubocop-changes (0.5.0)
5
5
  git_diff_parser (~> 3.2)
6
6
  rubocop (~> 1.25)
7
7
 
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Rubocop::Changes
2
2
 
3
3
  [![Gem Version](https://img.shields.io/gem/v/rubocop-changes)](https://rubygems.org/gems/rubocop-changes)
4
- [![Build Status](https://img.shields.io/travis/com/fcsonline/rubocop-changes/master)](https://travis-ci.com/fcsonline/rubocop-changes)
4
+ [![Build Status](https://github.com/fcsonline/rubocop-changes/actions/workflows/ci.yml/badge.svg)](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 'git merge-base HEAD origin/master' unless commit
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Rubocop
4
4
  module Changes
5
- VERSION = '0.5.0'
5
+ VERSION = '0.6.0'
6
6
  end
7
7
  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.5.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-24 00:00:00.000000000 Z
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.0.1
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
data/.travis.yml DELETED
@@ -1,10 +0,0 @@
1
- language: ruby
2
- sudo: false
3
- rvm:
4
- - 2.3.3
5
- - 2.4.0
6
- before_install:
7
- - gem update bundler
8
- notifications:
9
- email:
10
- - fcsonline@gmail.com