rubocop_lineup 0.3.0 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3cfd4c59b07533cbb21f073ebaaa194782bc4aae
4
- data.tar.gz: 926b2bc3bd42f6d133bb3d45ab5aeff57dad5b06
3
+ metadata.gz: bb360d66074e33af25088010d9698fd586bc863b
4
+ data.tar.gz: e098e01e27afac41fb76a137e9590773ea868a91
5
5
  SHA512:
6
- metadata.gz: f6224b5c670fed0f153978cafa5e9deb967196a4e00bdf158bf543499480c6d7294490331ddb335b0dec1ef08f19cc2716697d9087800db1c1537b95a512844a
7
- data.tar.gz: 6e6059f40272f01bbfc9555cfd23ba04bf2bda0c3f833c0849d632cd53b45577104127a1bfac2844b3a95fe6976f77f9c27c756a5f9147ebc64fbe2078b9e836
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
- (changed_line_numbers & offending_lines).empty? ? false : super
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
- # TODO: Ruby Golf this - a regex with proper grouping could probably be better.
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubocopLineup
4
- VERSION = "0.3.0".freeze
4
+ VERSION = "0.4.0".freeze
5
5
  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.3.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-17 00:00:00.000000000 Z
11
+ date: 2018-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: git