Skip to content

Commit 63a84b2

Browse files
committed
Fix code format by rubocop
1 parent 0100d71 commit 63a84b2

File tree

6 files changed

+61
-30
lines changed

6 files changed

+61
-30
lines changed

lib/qiita_marker/config.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,6 @@ def process_options(option, type)
5454
rescue KeyError => e
5555
raise TypeError, "option ':#{e.key}' does not exist for #{name}::OPTS[:#{type}]"
5656
end
57-
end
57+
end
5858
end
5959
end

lib/qiita_marker/renderer/html_renderer.rb

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,15 @@ def document(_)
99

1010
def header(node)
1111
block do
12-
out("<h", node.header_level, "#{sourcepos(node)}>", :children,
13-
"</h", node.header_level, ">")
12+
out(
13+
"<h",
14+
node.header_level,
15+
"#{sourcepos(node)}>",
16+
:children,
17+
"</h",
18+
node.header_level,
19+
">",
20+
)
1421
end
1522
end
1623

test/test_commonmark.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
require "test_helper"
44

55
class TestCommonmark < Minitest::Test
6-
HTML_COMMENT = /<!--.*?-->\s?/.freeze
6+
HTML_COMMENT = /<!--.*?-->\s?/
77

88
def setup
99
@markdown = <<~MD
@@ -29,7 +29,7 @@ def render_doc(doc)
2929
def test_to_commonmark
3030
compare = render_doc(@markdown).to_commonmark
3131

32-
assert_equal(\
32+
assert_equal(
3333
render_doc(@markdown).to_html.squeeze(" ").gsub(HTML_COMMENT, ""),
3434
render_doc(compare).to_html.squeeze(" ").gsub(HTML_COMMENT, ""),
3535
)

test/test_extensions.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,10 @@ def test_bad_extension_specifications
7171
end
7272

7373
def test_comments_are_kept_as_expected
74-
assert_equal("<!--hello--> <blah> &lt;xmp>\n",
75-
QiitaMarker.render_html("<!--hello--> <blah> <xmp>\n", :UNSAFE, [:tagfilter]))
74+
assert_equal(
75+
"<!--hello--> <blah> &lt;xmp>\n",
76+
QiitaMarker.render_html("<!--hello--> <blah> <xmp>\n", :UNSAFE, [:tagfilter]),
77+
)
7678
end
7779

7880
def test_table_prefer_style_attributes

test/test_node.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def test_deprecated_each_child
4040
def test_select
4141
nodes = @doc.first_child.select { |node| node.type == :text }
4242

43-
assert_equal(QiitaMarker::Node, nodes.first.class)
43+
assert_instance_of(QiitaMarker::Node, nodes.first)
4444
assert_equal([:text, :text], nodes.map(&:type))
4545
end
4646

test/test_pathological_inputs.rb

Lines changed: 44 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,38 +10,60 @@ def markdown(str)
1010
# list of pairs consisting of input and a regex that must match the output.
1111
pathological = {
1212
"nested strong emph" =>
13-
["#{"*a **a " * 65_000}b#{" a** a*" * 65_000}",
14-
Regexp.compile("(<em>a <strong>a ){65_000}b( a</strong> a</em>){65_000}"),],
13+
[
14+
"#{"*a **a " * 65_000}b#{" a** a*" * 65_000}",
15+
Regexp.compile("(<em>a <strong>a ){65_000}b( a</strong> a</em>){65_000}"),
16+
],
1517
"many emph closers with no openers" =>
16-
[("a_ " * 65_000),
17-
Regexp.compile("(a[_] ){64999}a_"),],
18+
[
19+
("a_ " * 65_000),
20+
Regexp.compile("(a[_] ){64999}a_"),
21+
],
1822
"many emph openers with no closers" =>
19-
[("_a " * 65_000),
20-
Regexp.compile("(_a ){64999}_a"),],
23+
[
24+
("_a " * 65_000),
25+
Regexp.compile("(_a ){64999}_a"),
26+
],
2127
"many link closers with no openers" =>
22-
[("a]" * 65_000),
23-
Regexp.compile('(a\]){65_000}'),],
28+
[
29+
("a]" * 65_000),
30+
Regexp.compile('(a\]){65_000}'),
31+
],
2432
"many link openers with no closers" =>
25-
[("[a" * 65_000),
26-
Regexp.compile('(\[a){65_000}'),],
33+
[
34+
("[a" * 65_000),
35+
Regexp.compile('(\[a){65_000}'),
36+
],
2737
"mismatched openers and closers" =>
28-
[("*a_ " * 50_000),
29-
Regexp.compile("([*]a[_] ){49999}[*]a_"),],
38+
[
39+
("*a_ " * 50_000),
40+
Regexp.compile("([*]a[_] ){49999}[*]a_"),
41+
],
3042
"link openers and emph closers" =>
31-
[("[ a_" * 50_000),
32-
Regexp.compile('(\[ a_){50000}'),],
43+
[
44+
("[ a_" * 50_000),
45+
Regexp.compile('(\[ a_){50000}'),
46+
],
3347
"hard link/emph case" =>
34-
["**x [a*b**c*](d)",
35-
Regexp.compile('\\*\\*x <a href=\'d\'>a<em>b</em><em>c</em></a>'),],
48+
[
49+
"**x [a*b**c*](d)",
50+
Regexp.compile('\\*\\*x <a href=\'d\'>a<em>b</em><em>c</em></a>'),
51+
],
3652
"nested brackets" =>
37-
["#{"[" * 50_000}a#{"]" * 50_000}",
38-
Regexp.compile('\[{50000}a\]{50000}'),],
53+
[
54+
"#{"[" * 50_000}a#{"]" * 50_000}",
55+
Regexp.compile('\[{50000}a\]{50000}'),
56+
],
3957
"nested block quotes" =>
40-
["#{"> " * 50_000}a",
41-
Regexp.compile('(<blockquote>\n){50000}'),],
58+
[
59+
"#{"> " * 50_000}a",
60+
Regexp.compile('(<blockquote>\n){50000}'),
61+
],
4262
"U+0000 in input" =>
43-
['abc\u0000de\u0000',
44-
Regexp.compile('abc\ufffd?de\ufffd?'),],
63+
[
64+
'abc\u0000de\u0000',
65+
Regexp.compile('abc\ufffd?de\ufffd?'),
66+
],
4567
}
4668

4769
pathological.each_pair do |name, description|

0 commit comments

Comments
 (0)