danger-danger_plugin_lint 0.1.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/danger/danger_plugin_lint.rb +31 -2
- data/lib/danger_plugin_lint/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c29c4b7b7234fdbc40b2679fef9140fbedb0e0feddf11d320f7da3b8f7d2bde7
|
4
|
+
data.tar.gz: c87e1fd76a91ac74baf54680795c586f22b2581a4d144cc73b596d4d7e3581e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2bfd86786b0158cb2443dbb351cde67260723d824b8776920b2d9b38578353dc59027073573b3e619cfb34423b51f075e2f6769dc5f47a597773b2787054a10a
|
7
|
+
data.tar.gz: 017e6825c6ce3b0f83e26091d86637e6b7ec3a204f2e9eb57ea0e526f572029a1c17b63df48cef785c14f1e4ad248f68956908816b6e68a6020aca10a0411933
|
@@ -20,7 +20,8 @@ module Danger
|
|
20
20
|
# @param [Boolean] warnings_as_errors If `true`, treat all warnings as errors.
|
21
21
|
# @return [void]
|
22
22
|
def lint_docs(*refs, warnings_as_errors: false)
|
23
|
-
|
23
|
+
refs = refs.flatten.compact
|
24
|
+
file_resolver = PluginFileResolver.new(refs.empty? ? nil : refs)
|
24
25
|
data = file_resolver.resolve
|
25
26
|
|
26
27
|
parser = PluginParser.new(data[:paths], verbose: true)
|
@@ -37,10 +38,38 @@ module Danger
|
|
37
38
|
|
38
39
|
def display_rules(method, rules)
|
39
40
|
rules.each do |rule|
|
41
|
+
message = format_rule(rule)
|
40
42
|
abs_file, line = rule.metadata[:files][0]
|
41
43
|
file = Pathname.new(abs_file).relative_path_from(Dir.pwd).to_s
|
42
|
-
public_send(method,
|
44
|
+
public_send(method, message, file: file, line: line)
|
43
45
|
end
|
44
46
|
end
|
47
|
+
|
48
|
+
def format_rule(rule)
|
49
|
+
<<~HTML
|
50
|
+
<strong>#{rule.title}</strong> - <strong>#{rule.metadata[:name]}</strong> (#{rule.type}):
|
51
|
+
#{to_html(rule.description)}
|
52
|
+
#{link(rule.ref)}
|
53
|
+
HTML
|
54
|
+
end
|
55
|
+
|
56
|
+
def link(ref)
|
57
|
+
url = case ref
|
58
|
+
when Range
|
59
|
+
"https://github.com/dbgrandi/danger-prose/blob/v2.0.0/lib/danger_plugin.rb#L#{ref.min}-L#{ref.max}"
|
60
|
+
when Integer
|
61
|
+
"https://github.com/dbgrandi/danger-prose/blob/v2.0.0/lib/danger_plugin.rb#L#{ref}"
|
62
|
+
else
|
63
|
+
'https://github.com/dbgrandi/danger-prose/blob/v2.0.0/lib/danger_plugin.rb'
|
64
|
+
end
|
65
|
+
%(See - <a href="#{url}">#{url}</a>)
|
66
|
+
end
|
67
|
+
|
68
|
+
def to_html(markdown)
|
69
|
+
# As the current Danger uses nothing but backquotes in syntax of Markdown,
|
70
|
+
# this method just replaces backquotes to `<code>` tag.
|
71
|
+
# @see https://github.com/danger/danger/blob/v9.0.0/lib/danger/plugin_support/plugin_linter.rb#L93-L128
|
72
|
+
markdown.gsub(/`(.*?)`/, '<code>\1</code>')
|
73
|
+
end
|
45
74
|
end
|
46
75
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: danger-danger_plugin_lint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryosuke Ito
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: danger-plugin-api
|
@@ -40,7 +40,7 @@ licenses:
|
|
40
40
|
metadata:
|
41
41
|
source_code_uri: https://github.com/manicmaniac/danger-danger_plugin_lint
|
42
42
|
rubygems_mfa_required: 'true'
|
43
|
-
post_install_message:
|
43
|
+
post_install_message:
|
44
44
|
rdoc_options: []
|
45
45
|
require_paths:
|
46
46
|
- lib
|
@@ -55,8 +55,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
version: '0'
|
57
57
|
requirements: []
|
58
|
-
rubygems_version: 3.
|
59
|
-
signing_key:
|
58
|
+
rubygems_version: 3.4.6
|
59
|
+
signing_key:
|
60
60
|
specification_version: 4
|
61
61
|
summary: A Danger plugin to lint Danger plugin
|
62
62
|
test_files: []
|