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 +4 -4
- data/lib/rubocop_lineup.rb +17 -2
- data/lib/rubocop_lineup/version.rb +1 -1
- data/rubocop_lineup.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef6cd25bb513449b7e8a8e4393667bcc3f14eb7e368a75a05ec51cbe74a3aeec
|
4
|
+
data.tar.gz: 1c8777485957331c3446e24f20c8d8e04e8dfe0f3ac5ec7f1382c9fecb639c56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5b99a93b516be211e3b1442d2727b46df48b8c6b972b93745983e555e3bacd5a8eb8b2eea034ec420f9a6a29ecdc36fff45fa46e87cdfe1d1379f254ed80302
|
7
|
+
data.tar.gz: 5f6bfa3a6808c1d4e95ee1f21f63749a33f3196c266698be650081fbb9ab64b760ed16da397c0e50c927ed0df820faf19a1e65265e1728e8b1f42f4cfc229886
|
data/lib/rubocop_lineup.rb
CHANGED
@@ -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,
|
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(
|
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
|
data/rubocop_lineup.gemspec
CHANGED
@@ -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", "~>
|
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.
|
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:
|
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: '
|
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: '
|
82
|
+
version: '12.3'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rspec
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|