pronto-erb_lint 0.1.2 → 0.1.3
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/lib/pronto/erb_lint/version.rb +1 -1
- data/lib/pronto/erb_lint.rb +13 -8
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8da196fe5ce4e46d376d138c66d5c97eff2a4a216b2a9fc6f795e78d1c5cff5
|
4
|
+
data.tar.gz: 0b458b7a56c8142621351c44df7800a9de34768de08b51ee314f1d74cc809fa9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ca8f5acf1878f34f56f8f2e6725c7827c94bd544f01ded29fa0a4a65c2a79da4ac6d1497d1d16272b8ef47afbe0f01bbbd7c36751deb180d5e8a14c895dedf1
|
7
|
+
data.tar.gz: f2d35a8d866d8635540a5d469ed8784eee93568c233d84268c2bd530ae2b84626821cf8f02ce48f40fe901161c94bffcc3cd57fbf50f2d686a8ad5da35e3cd57
|
data/lib/pronto/erb_lint.rb
CHANGED
@@ -82,7 +82,17 @@ module Pronto
|
|
82
82
|
def valid_patch?(patch)
|
83
83
|
return false if patch.additions < 1
|
84
84
|
path = patch.new_file_full_path
|
85
|
-
erb_file?(path)
|
85
|
+
erb_file?(path) && !excluded?(path)
|
86
|
+
end
|
87
|
+
|
88
|
+
def erb_file?(path)
|
89
|
+
File.extname(path) == '.erb'
|
90
|
+
end
|
91
|
+
|
92
|
+
def excluded?(filename)
|
93
|
+
@config.global_exclude.any? do |path|
|
94
|
+
File.fnmatch?(path, filename)
|
95
|
+
end
|
86
96
|
end
|
87
97
|
|
88
98
|
def inspect(patch)
|
@@ -91,7 +101,7 @@ module Pronto
|
|
91
101
|
offences = @inspector.offenses
|
92
102
|
offences.map do |offence|
|
93
103
|
patch.added_lines
|
94
|
-
.select { |line| offence.line_range.include? line.new_lineno }
|
104
|
+
.select { |line| offence.line_range.include? line.new_lineno }
|
95
105
|
.map { |line| new_message(offence, line) }
|
96
106
|
end
|
97
107
|
end
|
@@ -99,17 +109,12 @@ module Pronto
|
|
99
109
|
def new_message(offence, line)
|
100
110
|
path = line.patch.delta.new_file[:path]
|
101
111
|
level = :error
|
102
|
-
|
103
112
|
Message.new(path, line, level, offence.message, nil, self.class)
|
104
113
|
end
|
105
114
|
|
106
|
-
def erb_file?(path)
|
107
|
-
File.extname(path) == '.erb'
|
108
|
-
end
|
109
|
-
|
110
115
|
def processed_source_for(patch)
|
111
116
|
path = patch.new_file_full_path.to_s
|
112
|
-
file_content = File.read(path, encoding:
|
117
|
+
file_content = File.read(path, encoding: 'ISO8859-1:utf-8')
|
113
118
|
::ERBLint::ProcessedSource.new(path, file_content)
|
114
119
|
end
|
115
120
|
end
|