gnurr 0.2.5 → 0.3.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 +4 -4
- data/README.md +9 -4
- data/bin/gnurr +1 -1
- data/gnurr.gemspec +1 -1
- data/lib/gnurr.rb +0 -6
- data/lib/gnurr/cli.rb +5 -0
- data/lib/gnurr/git.rb +6 -2
- data/lib/gnurr/helper.rb +6 -0
- data/lib/gnurr/linter.rb +10 -3
- data/lib/gnurr/linters/es_linter.rb +58 -0
- data/lib/gnurr/linters/haml_linter.rb +32 -0
- data/lib/gnurr/linters/ruby_based_linters.rb +33 -0
- data/lib/gnurr/linters/ruby_linter.rb +36 -0
- data/lib/gnurr/linters/scss_linter.rb +48 -0
- data/lib/gnurr/processor.rb +23 -18
- data/lib/gnurr/version.rb +1 -1
- metadata +8 -8
- data/lib/gnurr/es_linter.rb +0 -56
- data/lib/gnurr/haml_linter.rb +0 -28
- data/lib/gnurr/ruby_base_linter.rb +0 -31
- data/lib/gnurr/ruby_linter.rb +0 -32
- data/lib/gnurr/scss_linter.rb +0 -46
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec8dc0ae5118bc1e00b8ac8831c5a48e133fa857
|
4
|
+
data.tar.gz: c1b3154f7600edcc0073cf1bc94bac6a067caf30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a441515d7b3fd646d64ebae22d92f22ec0044d32219cf866560b3deaa6349671712a7752adc1d449801866a27e3a7bbe4155d8836e53c2b40b37979323880c21
|
7
|
+
data.tar.gz: cbef0d8c7e1a8c0f411aad2820b6580029aa133dc7ed1057f1472fef2d19d5850af5ce7240b0b0183c8953139c9ddd7cbaa8192ba73c4639481279c369649ac6
|
data/README.md
CHANGED
@@ -41,8 +41,10 @@ In Ruby:
|
|
41
41
|
```rb
|
42
42
|
gnurr = Gnurr::Processor.new(options)
|
43
43
|
# Options:
|
44
|
-
#
|
45
|
-
#
|
44
|
+
# base: Base reference: branch, SHA, etc for diff (default: master)
|
45
|
+
# expanded: Show lints for all changed files, not just changed lines
|
46
|
+
# (false unless specified)
|
47
|
+
# linters: Linters to use (default: es,haml,ruby,scss (all))
|
46
48
|
# verbose: turn on verbose mode
|
47
49
|
gnurr.execute
|
48
50
|
```
|
@@ -52,9 +54,12 @@ In your shell:
|
|
52
54
|
```sh
|
53
55
|
$ gnurr --help
|
54
56
|
Usage: gnurr [options]
|
55
|
-
-b, --
|
57
|
+
-b, --base NAME Base reference: branch, SHA, etc for diff (default: master)
|
58
|
+
-e, --expanded Show lints for all changed files, not just changed lines (false
|
59
|
+
unless specified)
|
56
60
|
-l, --linters LIST Linters to use (default: es,haml,ruby,scss (all))
|
57
|
-
-v, --verbose
|
61
|
+
-v, --[no-]verbose Run verbosely
|
62
|
+
--version Show version
|
58
63
|
-h, --help Prints this help
|
59
64
|
```
|
60
65
|
|
data/bin/gnurr
CHANGED
data/gnurr.gemspec
CHANGED
data/lib/gnurr.rb
CHANGED
data/lib/gnurr/cli.rb
CHANGED
data/lib/gnurr/git.rb
CHANGED
@@ -1,6 +1,10 @@
|
|
1
|
+
require 'gnurr/helper'
|
2
|
+
|
1
3
|
module Gnurr
|
2
4
|
# For handling/reading Git output
|
3
5
|
module Git
|
6
|
+
include Gnurr::Helper
|
7
|
+
|
4
8
|
private
|
5
9
|
|
6
10
|
def extract_lines(diffs)
|
@@ -12,14 +16,14 @@ module Gnurr
|
|
12
16
|
|
13
17
|
def full_file_diff
|
14
18
|
return @diff if @diff
|
15
|
-
diff = `git diff #{@options[:
|
19
|
+
diff = `git diff #{@options[:base]} --name-only --diff-filter=ACMRTUXB`
|
16
20
|
.split("\n")
|
17
21
|
.map { |file| [file, file_diffs(file)] }
|
18
22
|
@diff = Hash[diff.select { |_k, v| v && v.any? }]
|
19
23
|
end
|
20
24
|
|
21
25
|
def file_diffs(file)
|
22
|
-
diffs = `git diff --unified=0 #{@options[:
|
26
|
+
diffs = `git diff --unified=0 #{@options[:base]} #{escaped_filename(file)} \
|
23
27
|
| egrep '\\+[0-9]+(,[1-9][0-9]*)? '`
|
24
28
|
extract_lines(diffs.split("\n"))
|
25
29
|
end
|
data/lib/gnurr/helper.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'colorize'
|
2
|
+
|
1
3
|
module Gnurr
|
2
4
|
# Miscellaneous helper methods for the gem
|
3
5
|
module Helper
|
@@ -17,6 +19,10 @@ module Gnurr
|
|
17
19
|
ranges + [Range.new(left, right)]
|
18
20
|
end
|
19
21
|
|
22
|
+
def escaped_filename(filename)
|
23
|
+
filename.sub(/(\s)/,'\\\\\1')
|
24
|
+
end
|
25
|
+
|
20
26
|
def left_bump(indent = 1)
|
21
27
|
'▎'.ljust(indent * 2).colorize(color: color)
|
22
28
|
end
|
data/lib/gnurr/linter.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
1
3
|
require 'gnurr/helper'
|
2
4
|
require 'gnurr/cli'
|
3
5
|
require 'gnurr/git'
|
@@ -10,7 +12,12 @@ module Gnurr
|
|
10
12
|
include Gnurr::Git
|
11
13
|
|
12
14
|
def initialize(options)
|
13
|
-
@options =
|
15
|
+
@options = {
|
16
|
+
base: 'master',
|
17
|
+
expanded: false,
|
18
|
+
stdout: false,
|
19
|
+
verbose: false
|
20
|
+
}.merge(options)
|
14
21
|
raise "Dependency not available for #{type}" unless requirements_met?
|
15
22
|
rescue => e
|
16
23
|
log_error(e)
|
@@ -71,7 +78,7 @@ module Gnurr
|
|
71
78
|
|
72
79
|
def escaped_files
|
73
80
|
files.map do |file, _lines|
|
74
|
-
file
|
81
|
+
escaped_filename(file)
|
75
82
|
end
|
76
83
|
end
|
77
84
|
|
@@ -96,7 +103,7 @@ module Gnurr
|
|
96
103
|
false # Can't lint from base class
|
97
104
|
end
|
98
105
|
|
99
|
-
def standardize_message(
|
106
|
+
def standardize_message(_message)
|
100
107
|
raise 'Can\'t standardize on base Linter class'
|
101
108
|
end
|
102
109
|
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'gnurr/linter'
|
2
|
+
|
3
|
+
module Gnurr
|
4
|
+
module Linters
|
5
|
+
# ES/JS Linter
|
6
|
+
class EsLinter < Linter
|
7
|
+
def type
|
8
|
+
:es
|
9
|
+
end
|
10
|
+
|
11
|
+
def color
|
12
|
+
:red
|
13
|
+
end
|
14
|
+
|
15
|
+
def command
|
16
|
+
'eslint -f json'
|
17
|
+
end
|
18
|
+
|
19
|
+
def filter(file)
|
20
|
+
File.extname(file) == '.js'
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def file_path(file)
|
26
|
+
file['filePath']
|
27
|
+
end
|
28
|
+
|
29
|
+
def file_messages(file)
|
30
|
+
file['messages']
|
31
|
+
end
|
32
|
+
|
33
|
+
def relative_filename(filename)
|
34
|
+
filename.sub(%r{^#{pwd}/}, '')
|
35
|
+
end
|
36
|
+
|
37
|
+
def requirements_met?
|
38
|
+
!`eslint -v`.nil?
|
39
|
+
rescue
|
40
|
+
false
|
41
|
+
end
|
42
|
+
|
43
|
+
def pwd
|
44
|
+
@pwd ||= `printf $(pwd)`
|
45
|
+
end
|
46
|
+
|
47
|
+
def standardize_message(message)
|
48
|
+
{
|
49
|
+
column: message['column'],
|
50
|
+
line: message['line'],
|
51
|
+
linter: message['ruleId'],
|
52
|
+
message: message['message'],
|
53
|
+
severity: message['severity'] == 2 ? :error : :warning
|
54
|
+
}
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'gnurr/linters/ruby_based_linters'
|
2
|
+
|
3
|
+
module Gnurr
|
4
|
+
module Linters
|
5
|
+
# HAML Linter
|
6
|
+
class HamlLinter
|
7
|
+
include Gnurr::Linters::RubyBasedLinters
|
8
|
+
|
9
|
+
def type
|
10
|
+
:haml
|
11
|
+
end
|
12
|
+
|
13
|
+
def color
|
14
|
+
:magenta
|
15
|
+
end
|
16
|
+
|
17
|
+
def command
|
18
|
+
'haml-lint -r json'
|
19
|
+
end
|
20
|
+
|
21
|
+
def filter(file)
|
22
|
+
File.extname(file) == '.haml'
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def requirements_met?
|
28
|
+
Gem::Specification.find_all_by_name('haml_lint').any?
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'gnurr/linter'
|
2
|
+
|
3
|
+
module Gnurr
|
4
|
+
module Linters
|
5
|
+
# Class from which Haml and Ruby extend
|
6
|
+
module RubyBasedLinters
|
7
|
+
private
|
8
|
+
|
9
|
+
def file_path(file)
|
10
|
+
file['path']
|
11
|
+
end
|
12
|
+
|
13
|
+
def file_messages(file)
|
14
|
+
file['offenses']
|
15
|
+
end
|
16
|
+
|
17
|
+
def messages
|
18
|
+
return @messages = {} if files.empty?
|
19
|
+
@messages ||= parse_messages(relevant_messages['files'])
|
20
|
+
end
|
21
|
+
|
22
|
+
def standardize_message(message)
|
23
|
+
{
|
24
|
+
column: message['location']['column'], # nil in haml-lint
|
25
|
+
line: message['location']['line'],
|
26
|
+
linter: message['cop_name'], # nil in haml-lint
|
27
|
+
message: message['message'],
|
28
|
+
severity: message['severity'] == 'error' ? :error : :warning
|
29
|
+
}
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'gnurr/linters/ruby_based_linters'
|
2
|
+
|
3
|
+
module Gnurr
|
4
|
+
module Linters
|
5
|
+
# Ruby Linter
|
6
|
+
class RubyLinter < Linter
|
7
|
+
include Gnurr::Linters::RubyBasedLinters
|
8
|
+
|
9
|
+
def type
|
10
|
+
:ruby
|
11
|
+
end
|
12
|
+
|
13
|
+
def color
|
14
|
+
:yellow
|
15
|
+
end
|
16
|
+
|
17
|
+
def command
|
18
|
+
'rubocop -f json'
|
19
|
+
end
|
20
|
+
|
21
|
+
def filter(file)
|
22
|
+
eligible_files.include?(file)
|
23
|
+
end
|
24
|
+
|
25
|
+
def eligible_files
|
26
|
+
@eligible_files ||= `rubocop -L`.split("\n")
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def requirements_met?
|
32
|
+
Gem::Specification.find_all_by_name('rubocop').any?
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'gnurr/linter'
|
2
|
+
|
3
|
+
module Gnurr
|
4
|
+
module Linters
|
5
|
+
# SASS Linter
|
6
|
+
class ScssLinter < Linter
|
7
|
+
def type
|
8
|
+
:scss
|
9
|
+
end
|
10
|
+
|
11
|
+
def color
|
12
|
+
:blue
|
13
|
+
end
|
14
|
+
|
15
|
+
def command
|
16
|
+
'scss-lint -f JSON'
|
17
|
+
end
|
18
|
+
|
19
|
+
def filter(file)
|
20
|
+
File.extname(file) == '.scss'
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def file_path(params)
|
26
|
+
params[0]
|
27
|
+
end
|
28
|
+
|
29
|
+
def file_messages(params)
|
30
|
+
params[1]
|
31
|
+
end
|
32
|
+
|
33
|
+
def requirements_met?
|
34
|
+
Gem::Specification.find_all_by_name('scss_lint').any?
|
35
|
+
end
|
36
|
+
|
37
|
+
def standardize_message(message)
|
38
|
+
{
|
39
|
+
column: message['column'],
|
40
|
+
line: message['line'],
|
41
|
+
linter: message['linter'],
|
42
|
+
message: message['reason'],
|
43
|
+
severity: message['severity'] == 'error' ? :error : :warning
|
44
|
+
}
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/lib/gnurr/processor.rb
CHANGED
@@ -1,37 +1,42 @@
|
|
1
|
+
require 'gnurr/linters/es_linter'
|
2
|
+
require 'gnurr/linters/haml_linter'
|
3
|
+
require 'gnurr/linters/ruby_linter'
|
4
|
+
require 'gnurr/linters/scss_linter'
|
5
|
+
|
1
6
|
module Gnurr
|
2
7
|
# Main class for execution
|
3
8
|
class Processor
|
4
9
|
LINTERS = {
|
5
|
-
es: EsLinter,
|
6
|
-
haml: HamlLinter,
|
7
|
-
ruby: RubyLinter,
|
8
|
-
scss: ScssLinter
|
10
|
+
es: Gnurr::Linters::EsLinter,
|
11
|
+
haml: Gnurr::Linters::HamlLinter,
|
12
|
+
ruby: Gnurr::Linters::RubyLinter,
|
13
|
+
scss: Gnurr::Linters::ScssLinter
|
9
14
|
}.freeze
|
10
15
|
|
11
16
|
def initialize(options = {})
|
12
|
-
|
13
|
-
|
17
|
+
@options = options
|
18
|
+
if @options[:linters] && options[:linters].any?
|
19
|
+
@options[:linters] = LINTERS.keys & @options[:linters]
|
20
|
+
else
|
21
|
+
@options[:linters] = LINTERS.keys
|
14
22
|
end
|
15
|
-
@options = {
|
16
|
-
branch: 'master',
|
17
|
-
expanded: false,
|
18
|
-
linters: LINTERS.keys,
|
19
|
-
stdout: false,
|
20
|
-
verbose: false
|
21
|
-
}.merge(options)
|
22
23
|
end
|
23
24
|
|
24
25
|
def execute
|
25
|
-
lints
|
26
|
+
@lints ||= {}
|
26
27
|
@options[:linters].each do |type|
|
27
28
|
begin
|
28
|
-
lints[type] = LINTERS[type].new(@options)
|
29
|
-
lints[type].execute
|
29
|
+
@lints[type] = LINTERS[type].new(@options)
|
30
|
+
@lints[type].execute
|
30
31
|
rescue => e
|
31
|
-
lints[type] = e.inspect
|
32
|
+
@lints[type] = e.inspect
|
32
33
|
end
|
33
34
|
end
|
34
|
-
lints
|
35
|
+
@lints
|
36
|
+
end
|
37
|
+
|
38
|
+
def lints
|
39
|
+
@lints ||= {}
|
35
40
|
end
|
36
41
|
end
|
37
42
|
end
|
data/lib/gnurr/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gnurr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Saufley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -72,15 +72,15 @@ files:
|
|
72
72
|
- gnurr.gemspec
|
73
73
|
- lib/gnurr.rb
|
74
74
|
- lib/gnurr/cli.rb
|
75
|
-
- lib/gnurr/es_linter.rb
|
76
75
|
- lib/gnurr/git.rb
|
77
|
-
- lib/gnurr/haml_linter.rb
|
78
76
|
- lib/gnurr/helper.rb
|
79
77
|
- lib/gnurr/linter.rb
|
78
|
+
- lib/gnurr/linters/es_linter.rb
|
79
|
+
- lib/gnurr/linters/haml_linter.rb
|
80
|
+
- lib/gnurr/linters/ruby_based_linters.rb
|
81
|
+
- lib/gnurr/linters/ruby_linter.rb
|
82
|
+
- lib/gnurr/linters/scss_linter.rb
|
80
83
|
- lib/gnurr/processor.rb
|
81
|
-
- lib/gnurr/ruby_base_linter.rb
|
82
|
-
- lib/gnurr/ruby_linter.rb
|
83
|
-
- lib/gnurr/scss_linter.rb
|
84
84
|
- lib/gnurr/version.rb
|
85
85
|
homepage: http://github.com/bensaufley/gnurr
|
86
86
|
licenses:
|
@@ -103,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
103
|
requirements:
|
104
104
|
- git
|
105
105
|
- npm and eslint for JS linting
|
106
|
-
- haml_lint for
|
106
|
+
- haml_lint for HAML linting
|
107
107
|
- scss_lint for SCSS linting
|
108
108
|
- rubocop for Ruby linting
|
109
109
|
rubyforge_project:
|
data/lib/gnurr/es_linter.rb
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
require 'gnurr/linter'
|
2
|
-
|
3
|
-
module Gnurr
|
4
|
-
# ES/JS Linter
|
5
|
-
class EsLinter < Linter
|
6
|
-
def type
|
7
|
-
:es
|
8
|
-
end
|
9
|
-
|
10
|
-
def color
|
11
|
-
:red
|
12
|
-
end
|
13
|
-
|
14
|
-
def command
|
15
|
-
'eslint -f json'
|
16
|
-
end
|
17
|
-
|
18
|
-
def filter(file)
|
19
|
-
File.extname(file) == '.js'
|
20
|
-
end
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
|
-
def file_path(file)
|
25
|
-
file['filePath']
|
26
|
-
end
|
27
|
-
|
28
|
-
def file_messages(file)
|
29
|
-
file['messages']
|
30
|
-
end
|
31
|
-
|
32
|
-
def relative_filename(filename)
|
33
|
-
filename.sub(%r{^#{pwd}/}, '')
|
34
|
-
end
|
35
|
-
|
36
|
-
def requirements_met?
|
37
|
-
!`eslint -v`.nil?
|
38
|
-
rescue
|
39
|
-
false
|
40
|
-
end
|
41
|
-
|
42
|
-
def pwd
|
43
|
-
@pwd ||= `printf $(pwd)`
|
44
|
-
end
|
45
|
-
|
46
|
-
def standardize_message(message)
|
47
|
-
{
|
48
|
-
column: message['column'],
|
49
|
-
line: message['line'],
|
50
|
-
linter: message['ruleId'],
|
51
|
-
message: message['message'],
|
52
|
-
severity: message['severity'] == 2 ? :error : :warning
|
53
|
-
}
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
data/lib/gnurr/haml_linter.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'gnurr/ruby_base_linter'
|
2
|
-
|
3
|
-
module Gnurr
|
4
|
-
# HAML Linter
|
5
|
-
class HamlLinter < RubyBaseLinter
|
6
|
-
def type
|
7
|
-
:haml
|
8
|
-
end
|
9
|
-
|
10
|
-
def color
|
11
|
-
:magenta
|
12
|
-
end
|
13
|
-
|
14
|
-
def command
|
15
|
-
'haml-lint -r json'
|
16
|
-
end
|
17
|
-
|
18
|
-
def filter(file)
|
19
|
-
File.extname(file) == '.haml'
|
20
|
-
end
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
|
-
def requirements_met?
|
25
|
-
Gem::Specification.find_all_by_name('haml_lint').any?
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
require 'gnurr/linter'
|
2
|
-
|
3
|
-
module Gnurr
|
4
|
-
# Class from which Haml and Ruby extend
|
5
|
-
class RubyBaseLinter < Linter
|
6
|
-
private
|
7
|
-
|
8
|
-
def file_path(file)
|
9
|
-
file['path']
|
10
|
-
end
|
11
|
-
|
12
|
-
def file_messages(file)
|
13
|
-
file['offenses']
|
14
|
-
end
|
15
|
-
|
16
|
-
def messages
|
17
|
-
return @messages = {} if files.empty?
|
18
|
-
@messages ||= parse_messages(relevant_messages['files'])
|
19
|
-
end
|
20
|
-
|
21
|
-
def standardize_message(message)
|
22
|
-
{
|
23
|
-
column: message['location']['column'], # nil in haml-lint
|
24
|
-
line: message['location']['line'],
|
25
|
-
linter: message['cop_name'], # nil in haml-lint
|
26
|
-
message: message['message'],
|
27
|
-
severity: message['severity'] == 'error' ? :error : :warning
|
28
|
-
}
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
data/lib/gnurr/ruby_linter.rb
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
require 'gnurr/ruby_base_linter'
|
2
|
-
|
3
|
-
module Gnurr
|
4
|
-
# Ruby Linter
|
5
|
-
class RubyLinter < RubyBaseLinter
|
6
|
-
def type
|
7
|
-
:ruby
|
8
|
-
end
|
9
|
-
|
10
|
-
def color
|
11
|
-
:yellow
|
12
|
-
end
|
13
|
-
|
14
|
-
def command
|
15
|
-
'rubocop -f json'
|
16
|
-
end
|
17
|
-
|
18
|
-
def filter(file)
|
19
|
-
eligible_files.include?(file)
|
20
|
-
end
|
21
|
-
|
22
|
-
def eligible_files
|
23
|
-
@eligible_files ||= `rubocop -L`.split("\n")
|
24
|
-
end
|
25
|
-
|
26
|
-
private
|
27
|
-
|
28
|
-
def requirements_met?
|
29
|
-
Gem::Specification.find_all_by_name('rubocop').any?
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
data/lib/gnurr/scss_linter.rb
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
require 'gnurr/linter'
|
2
|
-
|
3
|
-
module Gnurr
|
4
|
-
# SASS Linter
|
5
|
-
class ScssLinter < Linter
|
6
|
-
def type
|
7
|
-
:scss
|
8
|
-
end
|
9
|
-
|
10
|
-
def color
|
11
|
-
:blue
|
12
|
-
end
|
13
|
-
|
14
|
-
def command
|
15
|
-
'scss-lint -f JSON'
|
16
|
-
end
|
17
|
-
|
18
|
-
def filter(file)
|
19
|
-
File.extname(file) == '.scss'
|
20
|
-
end
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
|
-
def file_path(params)
|
25
|
-
params[0]
|
26
|
-
end
|
27
|
-
|
28
|
-
def file_messages(params)
|
29
|
-
params[1]
|
30
|
-
end
|
31
|
-
|
32
|
-
def requirements_met?
|
33
|
-
Gem::Specification.find_all_by_name('scss_lint').any?
|
34
|
-
end
|
35
|
-
|
36
|
-
def standardize_message(message)
|
37
|
-
{
|
38
|
-
column: message['column'],
|
39
|
-
line: message['line'],
|
40
|
-
linter: message['linter'],
|
41
|
-
message: message['reason'],
|
42
|
-
severity: message['severity'] == 'error' ? :error : :warning
|
43
|
-
}
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|