rubocop_lineup 0.5.0 → 0.5.1

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: 075fdaf5cee60b219ed373e3be7397eade34c3f10cf1eb9a001cba3529fe54cb
4
- data.tar.gz: f79231f5be539e56b0749cb16fb1344d32a0259465d6c01928afb73606da694a
3
+ metadata.gz: ef6cd25bb513449b7e8a8e4393667bcc3f14eb7e368a75a05ec51cbe74a3aeec
4
+ data.tar.gz: 1c8777485957331c3446e24f20c8d8e04e8dfe0f3ac5ec7f1382c9fecb639c56
5
5
  SHA512:
6
- metadata.gz: 818f4841252d4c2fec52f3ae629fc0f232d4975a57e6822615a345f7ec06573ff99bfb9092bfab7aedb3085d1e7f34821af31773abee2ee9cee41d2b7ecbf48b
7
- data.tar.gz: 263d9e6a9c0728c428341afaa5156ef22551e48f8ce7cc5221ac9bfc3bb7d5c059869892a8a283532f7239c928ac8d4de136c20027ef43f9ae55f6dd3d6548b9
6
+ metadata.gz: a5b99a93b516be211e3b1442d2727b46df48b8c6b972b93745983e555e3bacd5a8eb8b2eea034ec420f9a6a29ecdc36fff45fa46e87cdfe1d1379f254ed80302
7
+ data.tar.gz: 5f6bfa3a6808c1d4e95ee1f21f63749a33f3196c266698be650081fbb9ab64b760ed16da397c0e50c927ed0df820faf19a1e65265e1728e8b1f42f4cfc229886
@@ -4,6 +4,7 @@ require "rubocop_lineup/version"
4
4
  require "rubocop_lineup/line_number_calculator"
5
5
  require "rubocop_lineup/diff_liner"
6
6
  require "rubocop_lineup/duck_punch_rubocop"
7
+ require "yaml"
7
8
 
8
9
  module RubocopLineup
9
10
  # This defaults the parent branch to 'master'. This is a reasonable
@@ -12,11 +13,13 @@ module RubocopLineup
12
13
  # parent branch. There are ways to calculate the parent branch name
13
14
  # that cover common cases, but that's more complicated and may be added
14
15
  # in a future version.
15
- def self.line_em_up(directory, parent_branch = "master")
16
+ def self.line_em_up(directory, base_branch = nil)
17
+ base_branch ||= base_branch_from_config || "master"
18
+
16
19
  @line_em_up ||= begin
17
20
  Dir.chdir(directory) do
18
21
  uncommitted = DiffLiner.diff_uncommitted.file_line_changes
19
- committed_on_branch = DiffLiner.diff_branch(parent_branch).file_line_changes
22
+ committed_on_branch = DiffLiner.diff_branch(base_branch).file_line_changes
20
23
 
21
24
  # When a file has committed changes AND uncommitted_changes,
22
25
  # we will only include the lines from the uncommitted changes
@@ -31,4 +34,16 @@ module RubocopLineup
31
34
  def self.reset
32
35
  @line_em_up = nil
33
36
  end
37
+
38
+ def self.rubocop_lineup_config_file
39
+ ".rubocop_lineup.yml"
40
+ end
41
+
42
+ def self.base_branch_from_config
43
+ return unless File.exist?(rubocop_lineup_config_file)
44
+
45
+ settings = YAML.load_file(rubocop_lineup_config_file)
46
+
47
+ settings[:base_branch]
48
+ end
34
49
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubocopLineup
4
- VERSION = "0.5.0"
4
+ VERSION = "0.5.1"
5
5
  end
@@ -28,6 +28,6 @@ Gem::Specification.new do |spec|
28
28
 
29
29
  spec.add_development_dependency "bundler", "> 1.16"
30
30
  spec.add_development_dependency "pry"
31
- spec.add_development_dependency "rake", "~> 10.0"
31
+ spec.add_development_dependency "rake", "~> 12.3"
32
32
  spec.add_development_dependency "rspec", "~> 3.0"
33
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop_lineup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - chrismo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-05-24 00:00:00.000000000 Z
11
+ date: 2020-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: git
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '10.0'
75
+ version: '12.3'
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: '12.3'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rspec
85
85
  requirement: !ruby/object:Gem::Requirement