forked from coala/coala-bears
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
It suggests better formatting in markdown files. Closes coala#1538
- Loading branch information
1 parent
65d6304
commit 1a620ba
Showing
3 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from coalib.bearlib.abstractions.Linter import linter | ||
from dependency_management.requirements.GoRequirement import GoRequirement | ||
|
||
|
||
@linter(executable='markdownfmt', | ||
output_format='corrected', | ||
result_message='Formatting can be improved.', | ||
use_stdin=True) | ||
class MarkdownfmtBear: | ||
""" | ||
Check and correct formatting of Markdown files using ``mardownfmt``. | ||
Basic checks like alignment, indendation are provided. | ||
Note that MarkdownfmtBear works only with pure Markdown files(shouldn't | ||
contain front matter like TOML, JS etc). | ||
""" | ||
LANGUAGES = {'Markdown'} | ||
REQUIREMENTS = {GoRequirement( | ||
package='github.com/shurcooL/markdownfmt')} | ||
AUTHORS = {'The coala developers'} | ||
AUTHORS_EMAILS = {'[email protected]'} | ||
LICENSE = 'AGPL-3.0' | ||
CAN_FIX = {'Formatting'} | ||
ASCIINEMA_URL = 'https://asciinema.org/a/396jhuyw1j0c1l2i9p09wlhye' | ||
SEE_MORE = 'https://github.com/shurcooL/markdownfmt' | ||
|
||
@staticmethod | ||
def create_arguments(filename, file, config_file): | ||
return list() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from coalib.testing.LocalBearTestHelper import verify_local_bear | ||
|
||
from bears.markdown.MarkdownfmtBear import MarkdownfmtBear | ||
|
||
|
||
header_in_file1 = """ | ||
MarkdownBear | ||
===== | ||
""" | ||
|
||
header_out_file1 = """ | ||
MarkdownBear | ||
============ | ||
""" | ||
|
||
spacing_in_file2 = """ | ||
This is a test file. | ||
""" | ||
|
||
spacing_out_file2 = """ | ||
This is a test file. | ||
""" | ||
|
||
MarkdownfmtBear = verify_local_bear( | ||
MarkdownfmtBear, | ||
valid_files=(header_in_file1, spacing_in_file2,), | ||
invalid_files=(header_out_file1, spacing_out_file2,)) |