-
Notifications
You must be signed in to change notification settings - Fork 579
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add MarkdownfmtBear #1896
base: master
Are you sure you want to change the base?
Add MarkdownfmtBear #1896
Conversation
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for working on this. I think this is a great addition to coala.
Since your Bear can suggest patches for the issues it identifies, I'd ask you to add tests for that too. You can check out the tests for other Bears, e.g. PyImportSortBearTests to find out how that's done.
If you need help feel free to ask here or on Gitter.
bears/markdown/MarkdownfmtBear.py
Outdated
|
||
For more information visit | ||
<https://github.com/shurcooL/markdownfmt> | ||
Note that MarkdownfmtBear works with pure Markdown files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does that mean "only with pure Markdown files"? If so, please add the word "only" for more clarity.
valid_files=(spacing_in_file2,), | ||
invalid_files=(spacing_out_file2,), | ||
settings={'checks_for_spacing' : 'true'}) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
W391 blank line at end of file'
PycodestyleBear (W391), severity NORMAL, section autopep8
.
MarkdownfmtBear, | ||
valid_files=(spacing_in_file2,), | ||
invalid_files=(spacing_out_file2,), | ||
settings={'checks_for_spacing' : 'true'}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E203 whitespace before ':''
PycodestyleBear (E203), severity NORMAL, section autopep8
.
MarkdownfmtBear, | ||
valid_files=(header_in_file1,), | ||
invalid_files=(header_out_file1,), | ||
settings={'checks_for_headers' : 'true'}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E203 whitespace before ':''
PycodestyleBear (E203), severity NORMAL, section autopep8
.
|
||
""" | ||
|
||
spacing_out_file2=""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E225 missing whitespace around operator'
PycodestyleBear (E225), severity NORMAL, section autopep8
.
|
||
""" | ||
|
||
spacing_in_file2=""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E225 missing whitespace around operator'
PycodestyleBear (E225), severity NORMAL, section autopep8
.
|
||
""" | ||
|
||
header_out_file1=""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E225 missing whitespace around operator'
PycodestyleBear (E225), severity NORMAL, section autopep8
.
from coalib.testing.LocalBearTestHelper import verify_local_bear | ||
|
||
|
||
header_in_file1=""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E225 missing whitespace around operator'
PycodestyleBear (E225), severity NORMAL, section autopep8
.
MarkdownfmtBear, | ||
valid_files=(spacing_in_file2,), | ||
invalid_files=(spacing_out_file2,), | ||
settings={'checks_for_spacing' : 'true'}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code does not comply to PEP8.
PEP8Bear, severity NORMAL, section autopep8
.
The issue can be fixed by applying the following patch:
--- a/tests/markdown/MarkdownfmtBearTest.py
+++ b/tests/markdown/MarkdownfmtBearTest.py
@@ -37,5 +37,4 @@
MarkdownfmtBear,
valid_files=(spacing_in_file2,),
invalid_files=(spacing_out_file2,),
- settings={'checks_for_spacing' : 'true'})
-
+ settings={'checks_for_spacing': 'true'})
MarkdownfmtBear, | ||
valid_files=(header_in_file1,), | ||
invalid_files=(header_out_file1,), | ||
settings={'checks_for_headers' : 'true'}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code does not comply to PEP8.
PEP8Bear, severity NORMAL, section autopep8
.
The issue can be fixed by applying the following patch:
--- a/tests/markdown/MarkdownfmtBearTest.py
+++ b/tests/markdown/MarkdownfmtBearTest.py
@@ -30,7 +30,7 @@
MarkdownfmtBear,
valid_files=(header_in_file1,),
invalid_files=(header_out_file1,),
- settings={'checks_for_headers' : 'true'})
+ settings={'checks_for_headers': 'true'})
MarkdownfmtBear = verify_local_bear(
|
||
""" | ||
|
||
spacing_out_file2=""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code does not comply to PEP8.
PEP8Bear, severity NORMAL, section autopep8
.
The issue can be fixed by applying the following patch:
--- a/tests/markdown/MarkdownfmtBearTest.py
+++ b/tests/markdown/MarkdownfmtBearTest.py
@@ -20,7 +20,7 @@
"""
-spacing_out_file2="""
+spacing_out_file2 = """
This is a test file.
|
||
""" | ||
|
||
spacing_in_file2=""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code does not comply to PEP8.
PEP8Bear, severity NORMAL, section autopep8
.
The issue can be fixed by applying the following patch:
--- a/tests/markdown/MarkdownfmtBearTest.py
+++ b/tests/markdown/MarkdownfmtBearTest.py
@@ -14,7 +14,7 @@
"""
-spacing_in_file2="""
+spacing_in_file2 = """
This is a test file.
|
||
""" | ||
|
||
header_out_file1=""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code does not comply to PEP8.
PEP8Bear, severity NORMAL, section autopep8
.
The issue can be fixed by applying the following patch:
--- a/tests/markdown/MarkdownfmtBearTest.py
+++ b/tests/markdown/MarkdownfmtBearTest.py
@@ -8,7 +8,7 @@
"""
-header_out_file1="""
+header_out_file1 = """
MarkdownBear
============
from coalib.testing.LocalBearTestHelper import verify_local_bear | ||
|
||
|
||
header_in_file1=""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code does not comply to PEP8.
PEP8Bear, severity NORMAL, section autopep8
.
The issue can be fixed by applying the following patch:
--- a/tests/markdown/MarkdownfmtBearTest.py
+++ b/tests/markdown/MarkdownfmtBearTest.py
@@ -2,7 +2,7 @@
from coalib.testing.LocalBearTestHelper import verify_local_bear
-header_in_file1="""
+header_in_file1 = """
MarkdownBear
=====
87d1646
to
e23d751
Compare
bears/markdown/MarkdownfmtBear.py
Outdated
like alignment, indendation are provided. | ||
|
||
For more information visit | ||
<https://github.com/shurcooL/markdownfmt> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add this in the SEE_MORE
attribute.
bears/markdown/MarkdownfmtBear.py
Outdated
|
||
@staticmethod | ||
def create_arguments(filename, file, config_file): | ||
return() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we use stdin
for the input and not the filename ?
@@ -0,0 +1,37 @@ | |||
from bears.markdown.MarkdownfmtBear import MarkdownfmtBear | |||
from coalib.testing.LocalBearTestHelper import verify_local_bear | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Imports should be in the following order: (Note that I've left a line)
from coalib.testing.LocalBearTestHelper import verify_local_bear
from bears.markdown.MarkdownfmtBear import MarkdownfmtBear
bears/markdown/MarkdownfmtBear.py
Outdated
like alignment, indendation are provided. | ||
|
||
For more information visit | ||
<https://github.com/shurcooL/markdownfmt> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move this to SEE_MORE
bears/markdown/MarkdownfmtBear.py
Outdated
|
||
@staticmethod | ||
def create_arguments(filename, file, config_file): | ||
return() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return list()
just a preference though 😅
bears/markdown/MarkdownfmtBear.py
Outdated
|
||
For more information visit | ||
<https://github.com/shurcooL/markdownfmt> | ||
Note that MarkdownfmtBear works only with pure Markdown files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clearly explain what you mean by "pure Markdown files"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing period.
bears/markdown/MarkdownfmtBear.py
Outdated
use_stderr=True) | ||
class MarkdownfmtBear: | ||
""" | ||
Suggests better formatting in Markdown files. Basic checks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about:
Check and correct formatting of Markdown files using ``mardownfmt``.
MarkdownfmtBear = verify_local_bear( | ||
MarkdownfmtBear, | ||
valid_files=(spacing_in_file2,), | ||
invalid_files=(spacing_out_file2,)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to improve your tests 😉 . You can refer to any bear with code correcting capabilities. (e.g. MarkdownBear
)
bears/markdown/MarkdownfmtBear.py
Outdated
LICENSE = 'AGPL-3.0' | ||
CAN_FIX = {'Formatting'} | ||
ASCIINEMA_URL = 'https://asciinema.org/a/396jhuyw1j0c1l2i9p09wlhye' | ||
SEE_MORE = 'https://github.com/shurcooL/markdownfmt' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line contains following spacing inconsistencies:
- Trailing whitespaces.
SpaceConsistencyBear, severity NORMAL, section python
.
The issue can be fixed by applying the following patch:
--- a/bears/markdown/MarkdownfmtBear.py
+++ b/bears/markdown/MarkdownfmtBear.py
@@ -21,7 +21,7 @@
LICENSE = 'AGPL-3.0'
CAN_FIX = {'Formatting'}
ASCIINEMA_URL = 'https://asciinema.org/a/396jhuyw1j0c1l2i9p09wlhye'
- SEE_MORE = 'https://github.com/shurcooL/markdownfmt'
+ SEE_MORE = 'https://github.com/shurcooL/markdownfmt'
@staticmethod
def create_arguments(filename, file, config_file):
bears/markdown/MarkdownfmtBear.py
Outdated
""" | ||
Check and correct formatting of Markdown files using ``mardownfmt``. | ||
Basic checks like alignment, indendation are provided. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line contains following spacing inconsistencies:
- Trailing whitespaces.
SpaceConsistencyBear, severity NORMAL, section python
.
The issue can be fixed by applying the following patch:
--- a/bears/markdown/MarkdownfmtBear.py
+++ b/bears/markdown/MarkdownfmtBear.py
@@ -10,7 +10,7 @@
"""
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.
"""
LANGUAGES = {'Markdown'}
bears/markdown/MarkdownfmtBear.py
Outdated
LICENSE = 'AGPL-3.0' | ||
CAN_FIX = {'Formatting'} | ||
ASCIINEMA_URL = 'https://asciinema.org/a/396jhuyw1j0c1l2i9p09wlhye' | ||
SEE_MORE = 'https://github.com/shurcooL/markdownfmt' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
W291 trailing whitespace'
PycodestyleBear (W291), severity NORMAL, section autopep8
.
bears/markdown/MarkdownfmtBear.py
Outdated
""" | ||
Check and correct formatting of Markdown files using ``mardownfmt``. | ||
Basic checks like alignment, indendation are provided. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
W293 blank line contains whitespace'
PycodestyleBear (W293), severity NORMAL, section autopep8
.
bears/markdown/MarkdownfmtBear.py
Outdated
LICENSE = 'AGPL-3.0' | ||
CAN_FIX = {'Formatting'} | ||
ASCIINEMA_URL = 'https://asciinema.org/a/396jhuyw1j0c1l2i9p09wlhye' | ||
SEE_MORE = 'https://github.com/shurcooL/markdownfmt' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code does not comply to PEP8.
PEP8Bear, severity NORMAL, section autopep8
.
The issue can be fixed by applying the following patch:
--- a/bears/markdown/MarkdownfmtBear.py
+++ b/bears/markdown/MarkdownfmtBear.py
@@ -21,7 +21,7 @@
LICENSE = 'AGPL-3.0'
CAN_FIX = {'Formatting'}
ASCIINEMA_URL = 'https://asciinema.org/a/396jhuyw1j0c1l2i9p09wlhye'
- SEE_MORE = 'https://github.com/shurcooL/markdownfmt'
+ SEE_MORE = 'https://github.com/shurcooL/markdownfmt'
@staticmethod
def create_arguments(filename, file, config_file):
bears/markdown/MarkdownfmtBear.py
Outdated
""" | ||
Check and correct formatting of Markdown files using ``mardownfmt``. | ||
Basic checks like alignment, indendation are provided. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code does not comply to PEP8.
PEP8Bear, severity NORMAL, section autopep8
.
The issue can be fixed by applying the following patch:
--- a/bears/markdown/MarkdownfmtBear.py
+++ b/bears/markdown/MarkdownfmtBear.py
@@ -10,7 +10,7 @@
"""
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.
"""
LANGUAGES = {'Markdown'}
bears/markdown/MarkdownfmtBear.py
Outdated
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it still not clear what you mean by pure Markdown files
you should fix gitmate issues |
from coalib.testing.LocalBearTestHelper import verify_local_bear | ||
|
||
from bears.markdown.MarkdownfmtBear import MarkdownfmtBear | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We leave 2 lines before the code begins.
Your tests seem to be failing. Can you fix and improve them if possible ? |
It suggests better formatting in markdown files. Closes coala#1538
@naveentata please fix your tests |
@meetmangukiya I am not able to figure out what is wrong in the test, can you please help me? 😟 |
It suggests better formatting in markdown files.
Closes #1538
For short term contributors: we understand that getting your commits well
defined like we require is a hard task and takes some learning. If you
look to help without wanting to contribute long term there's no need
for you to learn this. Just drop us a message and we'll take care of brushing
up your stuff for merge!
Checklist
them.
individually. It is not sufficient to have "fixup commits" on your PR,
our bot will still report the issues for the previous commit.) You will
likely receive a lot of bot comments and build failures if coala does not
pass on every single commit!
After you submit your pull request, DO NOT click the 'Update Branch' button.
When asked for a rebase, consult coala.io/rebase
instead.
Please consider helping us by reviewing other peoples pull requests as well:
cobot mark wip <URL>
to get it outof the review queue.
The more you review, the more your score will grow at coala.io and we will
review your PRs faster!