danger-htmllint 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/htmllint/gem_version.rb +1 -1
- data/lib/htmllint/plugin.rb +8 -3
- data/spec/htmllint_spec.rb +32 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b981a0fdd7a0668977a08388105172f3dbcd1de3
|
4
|
+
data.tar.gz: fa2c5a2ee32b355df883abdc99c55e0cde6a7402
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 057a89398e1dd054bb8ae275380815a220162d6c580e9437fea03fb2f340e3710df4c799802826f8d4e06ac8d444ab32c0be13a819b2164e0900fd12a543a0b9
|
7
|
+
data.tar.gz: 4a742d0bd94804a7d351878981d7e94ad3075d1ed272882a883a9065dd7cfd9a4b4fd25be864cea81a836aa9af4aaabd0c71a6cc103bf73d7a1899cedd58e981
|
data/lib/htmllint/gem_version.rb
CHANGED
data/lib/htmllint/plugin.rb
CHANGED
@@ -51,7 +51,12 @@ module Danger
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def target_files
|
54
|
-
((git.modified_files - git.deleted_files) + git.added_files)
|
54
|
+
files = ((git.modified_files - git.deleted_files) + git.added_files)
|
55
|
+
result = []
|
56
|
+
files.each do |file|
|
57
|
+
result << file if file.include?(".html")
|
58
|
+
end
|
59
|
+
result
|
55
60
|
end
|
56
61
|
|
57
62
|
def parse(result)
|
@@ -60,10 +65,10 @@ module Danger
|
|
60
65
|
result.split("\n").each do |item|
|
61
66
|
next if item == ""
|
62
67
|
|
63
|
-
path_and_err = item.split(":")
|
68
|
+
path_and_err = item.split(".html:")
|
64
69
|
next if path_and_err.length < 2
|
65
70
|
|
66
|
-
file_path = path_and_err.first
|
71
|
+
file_path = "#{path_and_err.first}.html"
|
67
72
|
|
68
73
|
line_col_err_msg = path_and_err.last.split(", ")
|
69
74
|
line = line_col_err_msg[0].sub("line ", "").to_i
|
data/spec/htmllint_spec.rb
CHANGED
@@ -98,5 +98,37 @@ module Danger
|
|
98
98
|
end
|
99
99
|
end
|
100
100
|
end
|
101
|
+
|
102
|
+
describe ".target_files" do
|
103
|
+
subject(:targets) do
|
104
|
+
@htmllint.send(:target_files)
|
105
|
+
end
|
106
|
+
|
107
|
+
context "when target_files are empty" do
|
108
|
+
it "is empty" do
|
109
|
+
expect(targets.size).to eq(0)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
context "when target_files have 2 html files" do
|
114
|
+
before do
|
115
|
+
allow(@htmllint.git).to receive(:modified_files).and_return(%w(index.html app/index.html))
|
116
|
+
end
|
117
|
+
|
118
|
+
it "has 2 items" do
|
119
|
+
expect(targets.size).to eq(2)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
context "when target_files have yml file" do
|
124
|
+
before do
|
125
|
+
allow(@htmllint.git).to receive(:modified_files).and_return(%w(index.html config.yml))
|
126
|
+
end
|
127
|
+
|
128
|
+
it "has 1 items" do
|
129
|
+
expect(targets.size).to eq(1)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
101
133
|
end
|
102
134
|
end
|