gnurr 0.2.3 → 0.2.4

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
  SHA1:
3
- metadata.gz: f014991bd857985d010c0f65bd97ad5adbd8cb85
4
- data.tar.gz: d2166bfeb7b6a73d91c796c69ca0abb4d56cbe97
3
+ metadata.gz: aa78b2d78a3b56e2bf1769f11659a8969684fd43
4
+ data.tar.gz: 4b5fac6dd1d3f958deacb31b3446a7eb5adb4485
5
5
  SHA512:
6
- metadata.gz: aa234f3f589d9c6e27302b4e9d06af7f2237dafe171dfb4dd31e204b0979e5b18f45ab7c10a569a2f419af5774fbfc370935fb3919c1278bf5762142791771ae
7
- data.tar.gz: 2cb0fb5fd2dd42d0ad22ba5ff50a4a7182b4ebf351e3561dab21ab3587fd49d64e1bf4fe4e3cfad40a02a2da592f6ca56df5bda6c13c984725d506e6ef2572a4
6
+ metadata.gz: 1163d4af02b52af01491d6178d3b4582396119a2cfdb66577c73972b5eb9bd60a1a3e7e483442df44629606c310e10ef6b5c69f11bf4ab56c9fda14c18540f33
7
+ data.tar.gz: 5b6720082446eca030b705ec9b6cb7897c2ae2894e8394114b7f4d9767b59365ff6a466d6de669662d76f34a990a180df7d1cb8cac6e5e4fac8e8ac99895fe77
data/bin/gnurr CHANGED
@@ -12,8 +12,8 @@ options = {
12
12
  option_parser = OptionParser.new do |opts|
13
13
  opts.banner = 'Usage: gnurr [options]'
14
14
 
15
- opts.on('-b', '--branch NAME',
16
- 'Base branch: branch to diff against (default: master)') do |v|
15
+ opts.on('-b', '--base NAME',
16
+ 'Base reference: branch, SHA, etc for diff (default: master)') do |v|
17
17
  options[:branch] = v
18
18
  end
19
19
 
@@ -29,6 +29,10 @@ module Gnurr
29
29
  file['messages']
30
30
  end
31
31
 
32
+ def relative_filename(filename)
33
+ filename.sub(%r{^#{pwd}/}, '')
34
+ end
35
+
32
36
  def requirements_met?
33
37
  !`eslint -v`.nil?
34
38
  rescue
data/lib/gnurr/linter.rb CHANGED
@@ -37,7 +37,9 @@ module Gnurr
37
37
 
38
38
  def filter_messages(messages)
39
39
  messages.map do |filename, msgs|
40
- msgs.reject! { |msg| !files[filename].include?(msg[:line]) }
40
+ msgs.reject! do |msg|
41
+ !files[relative_filename(filename)].include?(msg[:line])
42
+ end
41
43
  msgs.empty? ? nil : [filename, msgs]
42
44
  end.reject(&:nil?)
43
45
  end
@@ -83,10 +85,13 @@ module Gnurr
83
85
  end
84
86
 
85
87
  def messages
86
- return @messages = {} if files.empty?
87
88
  @messages ||= parse_messages(relevant_messages)
88
89
  end
89
90
 
91
+ def relative_filename(filename)
92
+ filename
93
+ end
94
+
90
95
  def requirements_met?
91
96
  true # Set by subclasses
92
97
  end
data/lib/gnurr/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Gnurr
2
- VERSION = '0.2.3'.freeze
2
+ VERSION = '0.2.4'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gnurr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Saufley