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

DocumentationComment.py: Add blankline padding #4549

Merged
merged 1 commit into from Jul 24, 2017

Conversation

6 participants
@damngamerz
Member

damngamerz commented Jul 24, 2017

assemble() now adds a blank line before or after
docstring based on top_padding and bottom_padding.

Closes #4200

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

  • I read the commit guidelines and I've followed
    them.
  • I ran coala over my code locally. (All commits have to pass
    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:

The more you review, the more your score will grow at coala.io and we will
review your PRs faster!

tests/bearlib/languages/documentation/DocumentationCommentTest.py Outdated
@@ -287,4 +289,6 @@ def test_c_assembly(self):
docs = ''.join(data)
for doc in extract_documentation(data, 'c', 'doxygen'):
doc.top_padding = True
doc.assemble.cache_clear()

This comment has been minimized.

@gitmate-bot

gitmate-bot Jul 24, 2017

Collaborator

Line contains following spacing inconsistencies:

  • Trailing whitespaces.

Origin: SpaceConsistencyBear, Section: python.

The issue can be fixed by applying the following patch:

--- a/tests/bearlib/languages/documentation/DocumentationCommentTest.py
+++ b/tests/bearlib/languages/documentation/DocumentationCommentTest.py
@@ -290,5 +290,5 @@
 
         for doc in extract_documentation(data, 'c', 'doxygen'):
             doc.top_padding = True
-            doc.assemble.cache_clear()            
+            doc.assemble.cache_clear()
             self.assertIn(doc.assemble(), docs)
tests/bearlib/languages/documentation/DocumentationCommentTest.py Outdated
@@ -287,4 +289,6 @@ def test_c_assembly(self):
docs = ''.join(data)
for doc in extract_documentation(data, 'c', 'doxygen'):
doc.top_padding = True
doc.assemble.cache_clear()

This comment has been minimized.

@gitmate-bot

gitmate-bot Jul 24, 2017

Collaborator

W291 trailing whitespace

Origin: PycodestyleBear (W291), Section: autopep8.

tests/bearlib/languages/documentation/DocumentationCommentTest.py Outdated
@@ -287,4 +289,6 @@ def test_c_assembly(self):
docs = ''.join(data)
for doc in extract_documentation(data, 'c', 'doxygen'):
doc.top_padding = True
doc.assemble.cache_clear()

This comment has been minimized.

@gitmate-bot

gitmate-bot Jul 24, 2017

Collaborator

The code does not comply to PEP8.

Origin: PEP8Bear, Section: autopep8.

The issue can be fixed by applying the following patch:

--- a/tests/bearlib/languages/documentation/DocumentationCommentTest.py
+++ b/tests/bearlib/languages/documentation/DocumentationCommentTest.py
@@ -290,5 +290,5 @@
 
         for doc in extract_documentation(data, 'c', 'doxygen'):
             doc.top_padding = True
-            doc.assemble.cache_clear()            
+            doc.assemble.cache_clear()
             self.assertIn(doc.assemble(), docs)
coalib/bearlib/languages/documentation/DocumentationComment.py Outdated
assembled = (assembled if self.marker[1] == self.marker[2] else
(assembled +
(self.indent if lines[-1][-1] == '\n' else '') +
self.marker[2]))

This comment has been minimized.

@gitmate-bot

gitmate-bot Jul 24, 2017

Collaborator

E127 continuation line over-indented for visual indent

Origin: PycodestyleBear (E127), Section: autopep8.

coalib/bearlib/languages/documentation/DocumentationComment.py Outdated
assembled = (assembled if self.marker[1] == self.marker[2] else
(assembled +
(self.indent if lines[-1][-1] == '\n' else '') +
self.marker[2]))

This comment has been minimized.

@gitmate-bot

gitmate-bot Jul 24, 2017

Collaborator

The code does not comply to PEP8.

Origin: PEP8Bear, Section: autopep8.

The issue can be fixed by applying the following patch:

--- a/coalib/bearlib/languages/documentation/DocumentationComment.py
+++ b/coalib/bearlib/languages/documentation/DocumentationComment.py
@@ -280,7 +280,7 @@
         assembled = (assembled if self.marker[1] == self.marker[2] else
                      (assembled +
                       (self.indent if lines[-1][-1] == '\n' else '') +
-                       self.marker[2]))
+                      self.marker[2]))
         if self.top_padding:
             assembled = '\n' + assembled
         if self.bottom_padding:
@Nosferatul

This comment has been minimized.

Member

Nosferatul commented Jul 24, 2017

run coala locally and resolve your conflict.

coalib/bearlib/languages/documentation/DocumentationComment.py Outdated
(assembled +
(self.indent if lines[-1][-1] == '\n' else '') +
self.marker[2]))
if self.top_padding:

This comment has been minimized.

@NiklasMM

NiklasMM Jul 24, 2017

Contributor

The if is not needed here

coalib/bearlib/languages/documentation/DocumentationComment.py Outdated
self.marker[2]))
if self.top_padding:
assembled = '\n' * self.top_padding + assembled
if self.bottom_padding:

This comment has been minimized.

@NiklasMM

NiklasMM Jul 24, 2017

Contributor

same

This comment has been minimized.

@NiklasMM

NiklasMM Jul 24, 2017

Contributor

This can all be done in one line

@@ -293,4 +295,6 @@ def test_c_assembly(self):
docs = ''.join(data)
for doc in DocBaseClass.extract(data, 'c', 'doxygen'):
doc.top_padding = 1

This comment has been minimized.

@NiklasMM

NiklasMM Jul 24, 2017

Contributor

Test also with something > 1

This comment has been minimized.

@damngamerz

damngamerz Jul 24, 2017

Member

amended
doc.bottom_padding = 2
Hence Amended the changes in the test file.

DocumentationComment.py: Add blankline padding
`assemble()` now adds a blank line before or after
docstring based on top_padding and bottom_padding.

Closes #4200
@NiklasMM

This comment has been minimized.

Contributor

NiklasMM commented Jul 24, 2017

ack ffba831

@NiklasMM

This comment has been minimized.

Contributor

NiklasMM commented Jul 24, 2017

@rultor merge

@rultor

This comment has been minimized.

Contributor

rultor commented Jul 24, 2017

@rultor merge

@NiklasMM OK, I'll try to merge now. You can check the progress of the merge here

@rultor rultor merged commit ffba831 into coala:master Jul 24, 2017

6 of 9 checks passed

ci/circleci Your tests are queued behind your running builds
Details
continuous-integration/appveyor/branch Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/push The Travis CI build is in progress
Details
codecov/project 100% (target 100%)
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
review/gitmate/commit This commit has no issues. :)
Details
review/gitmate/manual This commit was acknowledged.
Details
review/gitmate/pr This PR has no issues. :)
Details
@rultor

This comment has been minimized.

Contributor

rultor commented Jul 24, 2017

@rultor merge

@NiklasMM Done! FYI, the full log is here (took me 2min)

@damngamerz damngamerz deleted the damngamerz:blankline branch Jul 24, 2017

@jayvdb

Noting corrections that need to be fixed in the next version of this.

def foobar_explosion(radius):
"""
A nice and neat way of documenting code.
:param radius: The explosion radius. """

This comment has been minimized.

@jayvdb

jayvdb Jul 26, 2017

Member

This was wrong.

def get_55():
"""A function that returns 55."""

This comment has been minimized.

@jayvdb

jayvdb Jul 26, 2017

Member

This was wrong.

@@ -36,6 +42,8 @@ def best_docstring(param1, param2):
:return: Long Return Description That Makes No Sense And Will
Cut to the Next Line.
"""

This comment has been minimized.

@jayvdb

jayvdb Jul 26, 2017

Member

This was wrong.

@@ -63,6 +72,8 @@ def foobar_triangle(side_A, side_B, side_C):
:return: returns perimeter
"""

This comment has been minimized.

@jayvdb

jayvdb Jul 26, 2017

Member

This was wrong.

@jayvdb jayvdb referenced this pull request Jul 26, 2017

Merged

DocumentationAPI: Add `padding` #4557

2 of 2 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment