-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add docformatter which formats Python docstrings to PEP 257
- Loading branch information
Showing
6 changed files
with
71 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
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,10 @@ | ||
#!/bin/sh | ||
|
||
output=$(docformatter "$@") | ||
|
||
# On successful change docformatter gives exit code of 3. | ||
# Raise error for all other positive exit codes | ||
ret=$? | ||
[ $ret -gt 0 ] && [ $ret -ne 3 ] && exit $ret | ||
|
||
echo "${output}" | patch --quiet --output=- |
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,2 @@ | ||
apt-get install -y python3-pip | ||
pip3 install docformatter |
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,26 @@ | ||
def single_line_doc(): | ||
""" | ||
Line break not necessary | ||
""" | ||
|
||
|
||
def extend_first_line(): | ||
"""First line | ||
first line continuation | ||
""" | ||
|
||
|
||
def add_line_break(): | ||
"""First line. | ||
Second line. | ||
""" | ||
|
||
|
||
def long_lines(): | ||
""" | ||
Nullam eu ante vel est convallis dignissim. Fusce suscipit, wisi nec facilisis facilisis, est dui fermentum leo, quis tempor ligula erat quis odio. Nunc porta vulputate tellus. Nunc rutrum turpis sed pede. Sed bibendum. Aliquam posuere. Nunc aliquet, augue nec adipiscing interdum, lacus tellus malesuada massa, quis varius mi purus non odio. Pellentesque condimentum, magna ut suscipit hendrerit, ipsum augue ornare nulla, non luctus diam neque sit amet urna. Curabitur vulputate vestibulum lorem. Fusce sagittis, libero non molestie mollis, magna orci ultrices dolor, at vulputate neque nulla lacinia eros. Sed id ligula quis est convallis tempor. Curabitur lacinia pulvinar nibh. Nam a sapien. | ||
""" |
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,30 @@ | ||
def single_line_doc(): | ||
"""Line break not necessary.""" | ||
|
||
|
||
def extend_first_line(): | ||
"""First line first line continuation.""" | ||
|
||
|
||
def add_line_break(): | ||
"""First line. | ||
Second line. | ||
""" | ||
|
||
|
||
def long_lines(): | ||
"""Nullam eu ante vel est convallis dignissim. | ||
Fusce suscipit, wisi nec facilisis facilisis, est dui fermentum leo, | ||
quis tempor ligula erat quis odio. Nunc porta vulputate tellus. | ||
Nunc rutrum turpis sed pede. Sed bibendum. Aliquam posuere. Nunc | ||
aliquet, augue nec adipiscing interdum, lacus tellus malesuada | ||
massa, quis varius mi purus non odio. Pellentesque condimentum, | ||
magna ut suscipit hendrerit, ipsum augue ornare nulla, non luctus | ||
diam neque sit amet urna. Curabitur vulputate vestibulum lorem. | ||
Fusce sagittis, libero non molestie mollis, magna orci ultrices | ||
dolor, at vulputate neque nulla lacinia eros. Sed id ligula quis | ||
est convallis tempor. Curabitur lacinia pulvinar nibh. Nam a | ||
sapien. | ||
""" |