rubocop_lineup 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/rubocop_lineup/duck_punch_rubocop.rb +9 -2
- data/lib/rubocop_lineup/line_number_calculator.rb +1 -3
- data/lib/rubocop_lineup/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb360d66074e33af25088010d9698fd586bc863b
|
4
|
+
data.tar.gz: e098e01e27afac41fb76a137e9590773ea868a91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19c000e4ab7954c9ec0614e6cd44ae9bb2bc9707e831e5f936cbf9d9c10b9f05cd949cf7103ed35a72d9e8d3500ebe6b1e804cef07cbeb6be09a78fc6533d300
|
7
|
+
data.tar.gz: 98867818f2a5727e06aad87f7ca7e47f05cbbc84dcaf45606070e8827af8f2ba45763e4eb99e57553117d97ac7009f771774984776c4c2fb47268c5964ca40d2
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# RubocopLineup
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.com/mysterysci/rubocop_lineup.svg?branch=master)](https://travis-ci.com/mysterysci/rubocop_lineup)
|
4
|
+
|
3
5
|
![Image of Old-Timey Police Lineup](https://upload.wikimedia.org/wikipedia/commons/0/04/Oppstilling-2.jpg)
|
4
6
|
|
5
7
|
If yer trying to bring in a new sheriff to the wild, wild west of your legacy codebase,
|
@@ -9,9 +9,16 @@ module DuckPunch
|
|
9
9
|
files_hash = RubocopLineup.line_em_up(Dir.pwd)
|
10
10
|
return false unless files_hash.key?(source_file)
|
11
11
|
|
12
|
-
offending_lines = (line_number..(last_line || line_number)).to_a
|
13
12
|
changed_line_numbers = files_hash[source_file]
|
14
|
-
|
13
|
+
changed_line_numbers.include?(line_number) ? super : false
|
14
|
+
|
15
|
+
# Removing support for any line of a block where one or more lines were changed.
|
16
|
+
# It's too unpredictable. Linter cops should probably never do this, but I'm
|
17
|
+
# not sure how to go about that right now.
|
18
|
+
#
|
19
|
+
# offending_lines = (line_number..(last_line || line_number)).to_a
|
20
|
+
# changed_line_numbers = files_hash[source_file]
|
21
|
+
# (changed_line_numbers & offending_lines).empty? ? false : super
|
15
22
|
end
|
16
23
|
|
17
24
|
def last_line
|
@@ -6,9 +6,7 @@ module RubocopLineup
|
|
6
6
|
# presumes the text has been parsed already to just the -/+ bits
|
7
7
|
# e.g. "-1 +1"
|
8
8
|
def self.git_line_summary_to_numbers(text)
|
9
|
-
|
10
|
-
_changed, added = text.split(/ /).reject(&:empty?)
|
11
|
-
start, count = added.sub(/^-/, "").split(/,/).map(&:to_i)
|
9
|
+
start, count = text.scan(/\+(.*)/).join.scan(/\d+/).flatten.map(&:to_i)
|
12
10
|
count ||= 1
|
13
11
|
(start..(start + count - 1)).to_a
|
14
12
|
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.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- chrismo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: git
|