Skip to content

Commit

Permalink
Add MarkdownfmtBear
Browse files Browse the repository at this point in the history
It suggests better formatting in markdown files.

Closes #1538
  • Loading branch information
naveentata committed Jul 6, 2017
1 parent 012b7d1 commit 571e169
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions .ci/deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ go get -u sourcegraph.com/sqs/goreturns
go get -u golang.org/x/tools/cmd/gotype
go get -u github.com/kisielk/errcheck
go get -u github.com/BurntSushi/toml/cmd/tomlv
go get -u github.com/shurcooL/markdownfmt

# Ruby commands
bundle install --path=vendor/bundle --binstubs=vendor/bin --jobs=8 --retry=3
Expand Down
31 changes: 31 additions & 0 deletions bears/markdown/MarkdownfmtBear.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
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,
use_stdout=True,
use_stderr=True)
class MarkdownfmtBear:
"""
Suggests better formatting in Markdown files. Basic checks
like alignment, indendation are provided.
For more information visit
<https://github.com/shurcooL/markdownfmt>
Note that MarkdownfmtBear works with pure Markdown files
"""
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'

@staticmethod
def create_arguments(filename, file, config_file):
return()
7 changes: 7 additions & 0 deletions tests/markdown/MarkdownfmtBearTest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from bears.markdown.MarkdownfmtBear import MarkdownfmtBear
from coalib.testing.LocalBearTestHelper import verify_local_bear

MarkdownfmtBear = verify_local_bear(
MarkdownfmtBear,
('package main\n\nfunc main() {\n\treturn 1\n}',),
('package main\nfunc main() {\n\treturn 1\n}',))

0 comments on commit 571e169

Please sign in to comment.