mdl 0.6.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (152) hide show
  1. checksums.yaml +4 -4
  2. data/bin/mdl +2 -2
  3. data/lib/mdl.rb +49 -40
  4. data/lib/mdl/cli.rb +92 -90
  5. data/lib/mdl/config.rb +2 -1
  6. data/lib/mdl/doc.rb +51 -58
  7. data/lib/mdl/kramdown_parser.rb +1 -1
  8. data/lib/mdl/rules.rb +222 -168
  9. data/lib/mdl/ruleset.rb +11 -10
  10. data/lib/mdl/style.rb +28 -12
  11. data/lib/mdl/styles/cirosantilli.rb +2 -2
  12. data/lib/mdl/styles/default.rb +1 -1
  13. data/lib/mdl/version.rb +1 -1
  14. data/mdl.gemspec +21 -18
  15. metadata +75 -289
  16. data/.gitignore +0 -13
  17. data/.pre-commit-hooks.yaml +0 -6
  18. data/.travis.yml +0 -12
  19. data/CHANGELOG.md +0 -208
  20. data/CONTRIBUTING.md +0 -7
  21. data/MAINTAINERS.md +0 -21
  22. data/README.md +0 -87
  23. data/Rakefile +0 -8
  24. data/docs/RULES.md +0 -1089
  25. data/docs/configuration.md +0 -99
  26. data/docs/creating_rules.md +0 -90
  27. data/docs/creating_styles.md +0 -47
  28. data/docs/rolling_a_release.md +0 -49
  29. data/example/markdown_spec.md +0 -897
  30. data/test/fixtures/default_mdlrc +0 -1
  31. data/test/fixtures/dir_with_md_and_markdown/bar.markdown +0 -1
  32. data/test/fixtures/dir_with_md_and_markdown/foo.md +0 -1
  33. data/test/fixtures/front_matter/jekyll_post.md +0 -16
  34. data/test/fixtures/mdlrc_disable_rules +0 -1
  35. data/test/fixtures/mdlrc_disable_tags +0 -1
  36. data/test/fixtures/mdlrc_enable_rules +0 -1
  37. data/test/fixtures/mdlrc_enable_tags +0 -1
  38. data/test/fixtures/my_ruleset.rb +0 -6
  39. data/test/rule_tests/alternate_top_level_header.md +0 -3
  40. data/test/rule_tests/alternate_top_level_header_style.rb +0 -4
  41. data/test/rule_tests/atx_closed_header_spacing.md +0 -17
  42. data/test/rule_tests/atx_header_spacing.md +0 -5
  43. data/test/rule_tests/blockquote_blank_lines.md +0 -31
  44. data/test/rule_tests/blockquote_spaces.md +0 -23
  45. data/test/rule_tests/bulleted_list_2_space_indent.md +0 -6
  46. data/test/rule_tests/bulleted_list_2_space_indent_style.rb +0 -3
  47. data/test/rule_tests/bulleted_list_4_space_indent.md +0 -3
  48. data/test/rule_tests/bulleted_list_not_at_beginning_of_line.md +0 -14
  49. data/test/rule_tests/code_block_consistency.md +0 -11
  50. data/test/rule_tests/code_block_consistency_style.rb +0 -1
  51. data/test/rule_tests/code_block_dollar.md +0 -33
  52. data/test/rule_tests/code_block_dollar_fence.md +0 -29
  53. data/test/rule_tests/code_block_fenced.md +0 -17
  54. data/test/rule_tests/code_block_fenced_style.rb +0 -1
  55. data/test/rule_tests/code_block_indented.md +0 -17
  56. data/test/rule_tests/code_block_indented_style.rb +0 -1
  57. data/test/rule_tests/consecutive_blank_lines.md +0 -11
  58. data/test/rule_tests/consistent_bullet_styles_asterisk.md +0 -3
  59. data/test/rule_tests/consistent_bullet_styles_dash.md +0 -3
  60. data/test/rule_tests/consistent_bullet_styles_plus.md +0 -3
  61. data/test/rule_tests/default_test_style.rb +0 -5
  62. data/test/rule_tests/emphasis_instead_of_headers.md +0 -42
  63. data/test/rule_tests/empty_doc.md +0 -0
  64. data/test/rule_tests/fenced_code_blocks.md +0 -27
  65. data/test/rule_tests/fenced_code_with_nesting.md +0 -73
  66. data/test/rule_tests/fenced_code_without_blank_lines.md +0 -42
  67. data/test/rule_tests/fenced_code_without_blank_lines_style.rb +0 -3
  68. data/test/rule_tests/first_header_bad_atx.md +0 -1
  69. data/test/rule_tests/first_header_bad_setext.md +0 -2
  70. data/test/rule_tests/first_header_good_atx.md +0 -1
  71. data/test/rule_tests/first_header_good_setext.md +0 -2
  72. data/test/rule_tests/first_line_top_level_header_atx.md +0 -3
  73. data/test/rule_tests/first_line_top_level_header_atx_style.rb +0 -2
  74. data/test/rule_tests/first_line_top_level_header_setext.md +0 -4
  75. data/test/rule_tests/first_line_top_level_header_setext_style.rb +0 -2
  76. data/test/rule_tests/fix_102_extra_nodes_in_link_text.md +0 -8
  77. data/test/rule_tests/header_duplicate_content.md +0 -11
  78. data/test/rule_tests/header_duplicate_content_different_nesting.md +0 -11
  79. data/test/rule_tests/header_duplicate_content_different_nesting_style.rb +0 -1
  80. data/test/rule_tests/header_duplicate_content_no_different_nesting.md +0 -13
  81. data/test/rule_tests/header_multiple_toplevel.md +0 -3
  82. data/test/rule_tests/header_mutliple_h1_no_toplevel.md +0 -5
  83. data/test/rule_tests/header_trailing_punctuation.md +0 -11
  84. data/test/rule_tests/header_trailing_punctuation_customized.md +0 -14
  85. data/test/rule_tests/header_trailing_punctuation_customized_style.rb +0 -2
  86. data/test/rule_tests/headers_bad.md +0 -7
  87. data/test/rule_tests/headers_good.md +0 -5
  88. data/test/rule_tests/headers_good_setext_with_atx.md +0 -7
  89. data/test/rule_tests/headers_good_setext_with_atx_style.rb +0 -2
  90. data/test/rule_tests/headers_good_with_issue_numbers.md +0 -12
  91. data/test/rule_tests/headers_surrounding_space_atx.md +0 -12
  92. data/test/rule_tests/headers_surrounding_space_setext.md +0 -15
  93. data/test/rule_tests/headers_with_spaces_at_the_beginning.md +0 -20
  94. data/test/rule_tests/hr_style_dashes.md +0 -22
  95. data/test/rule_tests/hr_style_dashes_style.rb +0 -3
  96. data/test/rule_tests/hr_style_inconsistent.md +0 -22
  97. data/test/rule_tests/hr_style_long.md +0 -22
  98. data/test/rule_tests/hr_style_long_style.rb +0 -3
  99. data/test/rule_tests/hr_style_stars.md +0 -22
  100. data/test/rule_tests/hr_style_stars_style.rb +0 -3
  101. data/test/rule_tests/inconsistent_bullet_indent_same_level.md +0 -4
  102. data/test/rule_tests/inconsistent_bullet_styles_asterisk.md +0 -3
  103. data/test/rule_tests/inconsistent_bullet_styles_dash.md +0 -3
  104. data/test/rule_tests/inconsistent_bullet_styles_plus.md +0 -3
  105. data/test/rule_tests/incorrect_bullet_style_asterisk.md +0 -3
  106. data/test/rule_tests/incorrect_bullet_style_asterisk_style.rb +0 -3
  107. data/test/rule_tests/incorrect_bullet_style_dash.md +0 -3
  108. data/test/rule_tests/incorrect_bullet_style_dash_style.rb +0 -3
  109. data/test/rule_tests/incorrect_bullet_style_plus.md +0 -3
  110. data/test/rule_tests/incorrect_bullet_style_plus_style.rb +0 -3
  111. data/test/rule_tests/incorrect_header_atx.md +0 -6
  112. data/test/rule_tests/incorrect_header_atx_closed.md +0 -6
  113. data/test/rule_tests/incorrect_header_atx_closed_style.rb +0 -2
  114. data/test/rule_tests/incorrect_header_atx_style.rb +0 -2
  115. data/test/rule_tests/incorrect_header_setext.md +0 -6
  116. data/test/rule_tests/incorrect_header_setext_style.rb +0 -2
  117. data/test/rule_tests/inline_html.md +0 -13
  118. data/test/rule_tests/links.md +0 -9
  119. data/test/rule_tests/lists_without_blank_lines.md +0 -75
  120. data/test/rule_tests/long_lines.md +0 -3
  121. data/test/rule_tests/long_lines_100.md +0 -7
  122. data/test/rule_tests/long_lines_100_style.rb +0 -3
  123. data/test/rule_tests/long_lines_code.md +0 -45
  124. data/test/rule_tests/long_lines_code_style.rb +0 -3
  125. data/test/rule_tests/mixed_header_types_atx.md +0 -6
  126. data/test/rule_tests/mixed_header_types_atx_closed.md +0 -6
  127. data/test/rule_tests/mixed_header_types_setext.md +0 -6
  128. data/test/rule_tests/no_first_line_header.md +0 -1
  129. data/test/rule_tests/no_first_line_header_style.rb +0 -1
  130. data/test/rule_tests/no_first_line_top_level_header.md +0 -1
  131. data/test/rule_tests/no_first_line_top_level_header_style.rb +0 -1
  132. data/test/rule_tests/ordered_list_item_prefix.md +0 -13
  133. data/test/rule_tests/ordered_list_item_prefix_ordered.md +0 -13
  134. data/test/rule_tests/ordered_list_item_prefix_ordered_style.rb +0 -3
  135. data/test/rule_tests/reversed_link.md +0 -7
  136. data/test/rule_tests/spaces_after_list_marker.md +0 -74
  137. data/test/rule_tests/spaces_after_list_marker_style.rb +0 -5
  138. data/test/rule_tests/spaces_inside_codespan_elements.md +0 -7
  139. data/test/rule_tests/spaces_inside_emphasis_markers.md +0 -35
  140. data/test/rule_tests/spaces_inside_link_text.md +0 -28
  141. data/test/rule_tests/trailing_spaces_br.md +0 -4
  142. data/test/rule_tests/trailing_spaces_br_style.rb +0 -3
  143. data/test/rule_tests/whitespace_issues.md +0 -3
  144. data/test/setup_tests.rb +0 -5
  145. data/test/test_cli.rb +0 -300
  146. data/test/test_ruledocs.rb +0 -52
  147. data/test/test_rules.rb +0 -58
  148. data/tools/README.md +0 -3
  149. data/tools/docker/Dockerfile +0 -13
  150. data/tools/docker/README.md +0 -19
  151. data/tools/test_location.rb +0 -20
  152. data/tools/view_markdown.rb +0 -11
@@ -1 +0,0 @@
1
- # Blank .mdlrc
@@ -1 +0,0 @@
1
- ## Second Header First
@@ -1 +0,0 @@
1
- ## Second Header First
@@ -1,16 +0,0 @@
1
- ---
2
- layout: post
3
- title: Hello World!
4
- category: Meta
5
- tags:
6
- - tag
7
- - another tag
8
- - one more tag
9
- url: http://example.com
10
- excerpt: Hello World! Vestibulum imperdiet adipiscing arcu, quis aliquam dolor condimentum dapibus. Aliquam fermentum leo aliquet quam volutpat et molestie mauris mattis. Suspendisse semper consequat velit in suscipit.
11
- ---
12
- # header1
13
-
14
- This is just a sample post.
15
-
16
- ### offending header3
@@ -1 +0,0 @@
1
- rules "~MD001", "~MD002"
@@ -1 +0,0 @@
1
- tags "ul", "~indentation"
@@ -1 +0,0 @@
1
- rules "MD001", "MD002"
@@ -1 +0,0 @@
1
- tags "headers", "whitespace"
@@ -1,6 +0,0 @@
1
- rule "MY001", "Documents must start with Hello World" do
2
- tags :opinionated
3
- check do |doc|
4
- [1] if doc.lines[0] != "Hello World"
5
- end
6
- end
@@ -1,3 +0,0 @@
1
- ## A level 2 top level header
2
-
3
- ## Another one {MD025}
@@ -1,4 +0,0 @@
1
- all
2
- rule 'MD002', :level => 2
3
- rule 'MD025', :level => 2
4
- rule 'MD041', :level => 2
@@ -1,17 +0,0 @@
1
- #Header 1 {MD020} #
2
-
3
- ## Header 2 {MD020}##
4
-
5
- ##Header 3 {MD020}##
6
-
7
- ## Header 4 {MD021} ##
8
-
9
- ## Header 5 {MD021} ##
10
-
11
- ## Header 6 {MD021} ##
12
-
13
- ## Header 7 {MD021} ##
14
-
15
- ## Header 8 \#
16
-
17
- ## Header 9 \#
@@ -1,5 +0,0 @@
1
- #Header 1 {MD018}
2
-
3
- ## Header 2 {MD019}
4
-
5
- ## Header 3 {MD019}
@@ -1,31 +0,0 @@
1
- Some text
2
-
3
- > a quote
4
- > same quote
5
-
6
- > blank line above me
7
-
8
-
9
- > two blank lines above me
10
-
11
- > space above me
12
-
13
- * List with embedded blockquote
14
-
15
- > Test
16
- > Test
17
-
18
- > Test
19
-
20
- * Item 2
21
-
22
- > Test. The blank line below should _not_ trigger MD028 as one blockquote is
23
- > inside the list, and the other is outside it.
24
-
25
- > Test
26
-
27
- Expected errors:
28
-
29
- {MD028:5} {MD028:8} {MD028:10} {MD028:17}
30
- {MD009:10} (trailing space is intentional)
31
- {MD012:8} (multiple blank lines are intentional)
@@ -1,23 +0,0 @@
1
- Some text
2
-
3
- > Hello world
4
- > Foo {MD027}
5
- > Bar {MD027}
6
-
7
- This tests other things embedded in the blockquote:
8
-
9
- > *Hello world*
10
- > *foo* {MD027}
11
- > **bar** {MD027}
12
- > "Baz" {MD027}
13
- > `qux` {MD027}
14
- > *foo* more text
15
- > **bar** more text
16
- > 'baz' more text
17
- > `qux` more text
18
-
19
- Test the first line being indented too much:
20
-
21
- > Foo {MD027}
22
- > Bar {MD027}
23
- > Baz
@@ -1,6 +0,0 @@
1
- This is a document where the lists are indented by 2 spaces, but the style is
2
- set to 4 space indents for lists:
3
-
4
- * Test X
5
- * Test Y {MD007}
6
- * Test Z {MD007}
@@ -1,3 +0,0 @@
1
- all
2
- rule 'MD007', :indent => 4
3
- exclude_rule "MD041"
@@ -1,3 +0,0 @@
1
- * Test X
2
- * Test Y {MD007}
3
- * Test Z {MD007}
@@ -1,14 +0,0 @@
1
- Some text
2
-
3
- * Item {MD006}
4
- * Item
5
- * Item
6
- * Item
7
- * Item
8
- * Item
9
- * Item
10
-
11
- Some more text
12
-
13
- * Item {MD006}
14
- * Item
@@ -1,11 +0,0 @@
1
- This is text.
2
-
3
- This is a
4
- code block.
5
-
6
- And here is more text
7
-
8
- ```
9
- and here is a different {MD046:8}
10
- code block
11
- ```
@@ -1 +0,0 @@
1
- rule 'MD046', :style => :consistent
@@ -1,33 +0,0 @@
1
- The following code block shouldn't have $ before the commands:
2
-
3
- $ ls {MD014}
4
- $ less foo
5
-
6
- $ cat bar
7
-
8
- However the following code block shows output, and $ can be used to
9
- distinguish between command and output:
10
-
11
- $ ls
12
- foo bar
13
- $ less foo
14
- Hello world
15
-
16
- $ cat bar
17
- baz
18
-
19
- The following code block uses variable names, and likewise shouldn't fire:
20
-
21
- $foo = 'bar';
22
- $baz = 'qux';
23
-
24
- The following code block doesn't have any dollar signs, and shouldn't fire:
25
-
26
- ls foo
27
- cat bar
28
-
29
- The following (fenced) code block doesn't have any content at all, and
30
- shouldn't fire:
31
-
32
- ```bash
33
- ```
@@ -1,29 +0,0 @@
1
- # header
2
-
3
- ```fence
4
- $ code
5
- ```
6
-
7
- text
8
-
9
- ```fence
10
- $ code
11
- ```
12
-
13
- text
14
-
15
- ```fence
16
- $ code
17
- $ code
18
- ```
19
-
20
- text
21
-
22
- ```fence
23
- $ code
24
- $ code
25
- ```
26
-
27
- text
28
-
29
- {MD014:3} {MD014:9} {MD014:15} {MD014:22}
@@ -1,17 +0,0 @@
1
- This is text.
2
-
3
- This is a {MD046}
4
- code block.
5
-
6
- And here is more text
7
-
8
- ```
9
- This is a code block that won't trigger.
10
- ```
11
-
12
- But we'll do another:
13
-
14
- And this {MD046}
15
- will.
16
-
17
- Final text is here
@@ -1 +0,0 @@
1
- rule 'MD046', :style => :fenced
@@ -1,17 +0,0 @@
1
- This is text.
2
-
3
- This is a
4
- code block.
5
-
6
- And here is more text
7
-
8
- ```
9
- This is {MD046:8} also a code block.
10
- ```
11
-
12
- But we'll do another:
13
-
14
- And this
15
- will.
16
-
17
- Final text is here
@@ -1 +0,0 @@
1
- rule 'MD046', :style => :indented
@@ -1,11 +0,0 @@
1
- Some text
2
-
3
-
4
- Some text {MD012:3}
5
-
6
- This is a code block
7
-
8
-
9
- with two blank lines in it
10
-
11
- Some more text
@@ -1,3 +0,0 @@
1
- * Item
2
- * Item
3
- * Item
@@ -1,3 +0,0 @@
1
- - Item
2
- - Item
3
- - Item
@@ -1,3 +0,0 @@
1
- + Item
2
- + Item
3
- + Item
@@ -1,5 +0,0 @@
1
- # Default style file for rule tests
2
- all
3
-
4
- exclude_rule "MD041"
5
- exclude_rule "MD046"
@@ -1,42 +0,0 @@
1
- **Section 1: the first section {MD036}**
2
-
3
- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
4
- incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
5
- nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
6
- Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
7
- eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt
8
- in culpa qui officia deserunt mollit anim id est laborum.
9
-
10
- __Section 1.1: another section {MD036}__
11
-
12
- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
13
- incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
14
- nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
15
- Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
16
- eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt
17
- in culpa qui officia deserunt mollit anim id est laborum.
18
-
19
- *Section 2: yet more sections {MD036}*
20
-
21
- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
22
- incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
23
- nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
24
- Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
25
- eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt
26
- in culpa qui officia deserunt mollit anim id est laborum.
27
-
28
- _Section 3: oh no more sections {MD036}_
29
-
30
- This is a normal paragraph
31
- **that just happens to have emphasized text in**
32
- even though the emphasized text is on its own line.
33
-
34
- This is another **normal** paragraph with some text in it. This also should
35
- not trigger the rule.
36
-
37
- **This is an entire paragraph that has been emphasized, and shouldn't be
38
- detected as a header because it's on multiple lines**
39
-
40
- **This also shouldn't be detected as a header as it ends in punctuation.**
41
-
42
- **[This as well since it is a link](https://example.com)**
File without changes
@@ -1,27 +0,0 @@
1
- This is a GFM-style fenced code block:
2
-
3
- ``` bash
4
- #!/bin/bash
5
-
6
- # Print something to stdout:
7
- echo "Hello"
8
- echo "World"
9
- ```
10
-
11
- This is a kramdown-style fenced code block:
12
-
13
- ~~~ bash
14
- #!/bin/bash
15
-
16
- # Print something to stdout:
17
- echo "Hello"
18
- echo "World"
19
- ~~~
20
-
21
- None of the above should trigger any heading related rules.
22
-
23
- ```
24
- Code block without a language specifier
25
- ```
26
-
27
- {MD040:23}
@@ -1,73 +0,0 @@
1
- # header
2
-
3
- text
4
- ```fence {MD031}
5
- code
6
- ``` {MD031}
7
- text
8
- ~~~fence {MD031}
9
- code
10
- ~~~ {MD031}
11
- text
12
- ```fence {MD031}
13
- ~~~fence
14
- code
15
- ~~~
16
- ``` {MD031}
17
- text
18
- ~~~fence {MD031}
19
- ```fence
20
- code
21
- ```
22
- ~~~ {MD031}
23
- text
24
- ```fence {MD031}
25
-
26
- ~~~fence
27
- code
28
- ~~~
29
-
30
- ``` {MD031}
31
- text
32
- ~~~fence {MD031}
33
-
34
- ```fence
35
- code
36
- ```
37
-
38
- ~~~ {MD031}
39
- text
40
- ```fence {MD031}
41
- code
42
- ~~~
43
- ``` {MD031}
44
- text
45
- ~~~fence {MD031}
46
- code
47
- ```
48
- ~~~ {MD031}
49
- text
50
- ````fence {MD031}
51
- ```fence
52
- code
53
- ```
54
- ```` {MD031}
55
- text
56
- ~~~~fence {MD031}
57
- ~~~fence
58
- code
59
- ~~~
60
- ~~~~ {MD031}
61
- text
62
- ````fence {MD031}
63
- ```fence
64
- code
65
- ```
66
- ````` {MD031}
67
- text
68
- ~~~~fence {MD031}
69
- ~~~fence
70
- code
71
- ~~~
72
- ~~~~~ {MD031}
73
- text