accesslint-ci 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/accesslint/ci/cli.rb +50 -50
- data/lib/accesslint/ci/version.rb +1 -1
- 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: fc7d03c6fe140d07adf3557128826ae1b7d34514
|
4
|
+
data.tar.gz: 0f1affafa39da2ef1ab894b318655773c0da97de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 790c001b8800c1b7a840c9cc86e59db3682cfe1de40073446fd5ded4e9cf02b0e6f5a55ebe1d1adfc698fbca784dab45528851245415303c741b8217598705f1
|
7
|
+
data.tar.gz: f8649486cd713d78bc03e5f337e71eabee4424514182c573c7e630c43ace0c0b32df7a1eb57684082210fa796f695f30b48a2dbfc6bbb1faa9af70b0523073e3
|
data/lib/accesslint/ci/cli.rb
CHANGED
@@ -21,71 +21,71 @@ module Accesslint
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
|
25
|
-
attr_reader :host
|
24
|
+
private
|
26
25
|
|
27
|
-
|
28
|
-
options[:"skip-ci"]
|
29
|
-
end
|
26
|
+
attr_reader :host
|
30
27
|
|
31
|
-
|
32
|
-
|
33
|
-
|
28
|
+
def skip_ci?
|
29
|
+
options[:"skip-ci"]
|
30
|
+
end
|
34
31
|
|
35
|
-
|
36
|
-
|
37
|
-
|
32
|
+
def pr?
|
33
|
+
ENV.fetch("CIRCLE_BRANCH") != "master"
|
34
|
+
end
|
38
35
|
|
39
|
-
|
40
|
-
|
41
|
-
|
36
|
+
def changes?
|
37
|
+
new_diff.any?
|
38
|
+
end
|
42
39
|
|
43
|
-
|
44
|
-
|
45
|
-
|
40
|
+
def new_diff
|
41
|
+
new_errors - existing_diff
|
42
|
+
end
|
46
43
|
|
47
|
-
|
48
|
-
|
49
|
-
|
44
|
+
def new_errors
|
45
|
+
current_errors - baseline_errors
|
46
|
+
end
|
50
47
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
else
|
55
|
-
[]
|
56
|
-
end
|
57
|
-
end
|
48
|
+
def current_errors
|
49
|
+
@current_errors ||= Scanner.perform(host: host).split("\n")
|
50
|
+
end
|
58
51
|
|
59
|
-
|
60
|
-
|
52
|
+
def baseline_errors
|
53
|
+
if baseline_file
|
54
|
+
@baseline_errors ||= ReadAccesslintLog.perform(baseline_file)
|
55
|
+
else
|
56
|
+
[]
|
61
57
|
end
|
58
|
+
end
|
62
59
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
else
|
67
|
-
@existing_diff ||= LogManager.get.split("\n")
|
68
|
-
end
|
69
|
-
end
|
60
|
+
def baseline_file
|
61
|
+
options[:base]
|
62
|
+
end
|
70
63
|
|
71
|
-
|
72
|
-
|
64
|
+
def existing_diff
|
65
|
+
if previous_diff_file
|
66
|
+
@existing_diff ||= ReadAccesslintLog.perform(previous_diff_file)
|
67
|
+
else
|
68
|
+
@existing_diff ||= LogManager.get.split("\n")
|
73
69
|
end
|
70
|
+
end
|
74
71
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
contents: new_diff.join("\n"),
|
79
|
-
)
|
80
|
-
end
|
72
|
+
def previous_diff_file
|
73
|
+
options[:compare]
|
74
|
+
end
|
81
75
|
|
82
|
-
|
83
|
-
|
84
|
-
|
76
|
+
def save_diff
|
77
|
+
WriteAccesslintLog.perform(
|
78
|
+
file_name: new_diff_file,
|
79
|
+
contents: new_diff.join("\n"),
|
80
|
+
)
|
81
|
+
end
|
85
82
|
|
86
|
-
|
87
|
-
|
88
|
-
|
83
|
+
def new_diff_file
|
84
|
+
options[:outfile] || previous_diff_file
|
85
|
+
end
|
86
|
+
|
87
|
+
def post_comment
|
88
|
+
Commenter.perform(new_diff)
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|