danger-textlint 1.1.0 → 1.2.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/.rubocop.yml +3 -0
- data/Gemfile.lock +1 -1
- data/lib/textlint/gem_version.rb +1 -1
- data/lib/textlint/plugin.rb +17 -1
- data/spec/textlint_spec.rb +27 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4390839bd6f828e1785379ba7d06040f8c5029602b20d47f2a4480eae6752d4c
|
4
|
+
data.tar.gz: a353be06a739e47e57d23aa790b7e469b7ac8e5d60005f1e0fef175b8cb6fd62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32b9a7b3606c0b0bda6b3e0edc2f4085d00f915a7d76aa3aaa404a7f90f1ed11d72163f5121332eeafea80f2a6bf5d864aa5c24ffbb6ddcf536d889708084939
|
7
|
+
data.tar.gz: 5a728a6b925e76970694144a4ee8f9037fd2a1904ee2fbdcb6524841a11dbd78327632ddbd2065774e90e8709c7975759c357170ce2333f7081dc76fb91702c7
|
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
data/lib/textlint/gem_version.rb
CHANGED
data/lib/textlint/plugin.rb
CHANGED
@@ -14,6 +14,11 @@ module Danger
|
|
14
14
|
# textlint.max_severity = "warn"
|
15
15
|
# textlint.lint
|
16
16
|
#
|
17
|
+
# @example Max inline comment number. If you want disable this feature, please set nil. Default: nil
|
18
|
+
#
|
19
|
+
# textlint.max_comment_num = 5
|
20
|
+
# textlint.lint
|
21
|
+
#
|
17
22
|
# @see Kesin11/danger-textlint
|
18
23
|
# @tags lint, textlint
|
19
24
|
#
|
@@ -27,6 +32,11 @@ module Danger
|
|
27
32
|
# @return [String]
|
28
33
|
attr_accessor :max_severity
|
29
34
|
|
35
|
+
# Set max danger reporting comment number
|
36
|
+
# choice: nil or integer
|
37
|
+
# @return [String]
|
38
|
+
attr_accessor :max_comment_num
|
39
|
+
|
30
40
|
# Execute textlint and send comment
|
31
41
|
# @return [void]
|
32
42
|
def lint
|
@@ -88,7 +98,13 @@ module Danger
|
|
88
98
|
end
|
89
99
|
|
90
100
|
def send_comment(errors)
|
91
|
-
|
101
|
+
limited_errors = errors
|
102
|
+
if max_comment_num && limited_errors.size > max_comment_num
|
103
|
+
limited_errors = limited_errors.first(max_comment_num)
|
104
|
+
send("warn", "Textlint reported more than #{max_comment_num} problems, but danger-textlint doesn't to display all problems. Please run textlint in your machine and check all problems.")
|
105
|
+
end
|
106
|
+
|
107
|
+
limited_errors.each do |error|
|
92
108
|
send(error[:severity], error[:message], file: error[:file_path], line: error[:line])
|
93
109
|
end
|
94
110
|
end
|
data/spec/textlint_spec.rb
CHANGED
@@ -100,6 +100,33 @@ module Danger
|
|
100
100
|
)
|
101
101
|
end
|
102
102
|
end
|
103
|
+
|
104
|
+
context "with .max_comment_num = 5" do
|
105
|
+
let(:max_comment_num) { 5 }
|
106
|
+
before do
|
107
|
+
@textlint.max_comment_num = max_comment_num
|
108
|
+
@textlint.lint
|
109
|
+
end
|
110
|
+
|
111
|
+
it "status_report" do
|
112
|
+
status_report = @textlint.status_report
|
113
|
+
expect(status_report[:errors].size).to eq(max_comment_num)
|
114
|
+
end
|
115
|
+
|
116
|
+
it "violation_report" do
|
117
|
+
violation_report = @textlint.violation_report
|
118
|
+
expect(violation_report[:errors].size).to eq(max_comment_num)
|
119
|
+
end
|
120
|
+
|
121
|
+
it "danger comment" do
|
122
|
+
# find not inline comment
|
123
|
+
comment = @textlint.violation_report[:warnings].find do |warning|
|
124
|
+
warning.message.match(/Textlint reported more than/)
|
125
|
+
end
|
126
|
+
|
127
|
+
expect(comment).not_to be_nil
|
128
|
+
end
|
129
|
+
end
|
103
130
|
end
|
104
131
|
|
105
132
|
describe ".target_files" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: danger-textlint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kesin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: danger-plugin-api
|