Skip to content
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

Adding black and pydocstyle #61

Merged
merged 1 commit into from Jul 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions bootstrap.py
Expand Up @@ -155,6 +155,16 @@ def main():
Exclude collection of coverage and reporting to coveralls.io
pulp.plan.io.

'''))
parser.add_argument('--exclude-black', action='store_true',
help=textwrap.dedent('''\
Exclude black code style check in Travis CI

'''))
parser.add_argument('--exclude-pydocstyle', action='store_true',
help=textwrap.dedent('''\
Exclude pydocstyle check in Travis CI

'''))
args = parser.parse_args()

Expand Down
19 changes: 18 additions & 1 deletion templates/boostrap/pyproject.toml.j2
Expand Up @@ -4,4 +4,21 @@ filename = "CHANGES.rst"
directory = "CHANGES/"
title_format = "{version} ({project_date})"
template = "CHANGES/.TEMPLATE.rst"
issue_format = "`#{issue} <https://pulp.plan.io/issues/{issue}>`_"
issue_format = "`#{issue} <https://pulp.plan.io/issues/{issue}>`_"

{% if not exclude_black %}
[tool.black]
line-length = 100
target-version = ["py36", "py37"]
exclude = '''
/(
\.eggs
| \.git
| \.venv
| _build
| build
| dist
| migrations
)/
'''
{% endif %}
6 changes: 6 additions & 0 deletions templates/test/test_requirements.txt.j2
@@ -1,8 +1,14 @@
{% if not exclude_black %}
black
{% endif %}
coverage
flake8
flake8-docstrings
flake8-tuple
flake8-quotes
mock
git+https://github.com/PulpQE/pulp-smash.git#egg=pulp-smash
{% if not exclude_pydocstyle %}
pydocstyle
{% endif %}
pytest
3 changes: 3 additions & 0 deletions templates/travis/.travis/before_install.sh.j2
Expand Up @@ -29,6 +29,9 @@ pip install -r test_requirements.txt
# Lint code.
flake8 --config flake8.cfg || exit 1

{% if not exclude_black %}# check the code style with black
black --check --diff . || exit 1{% endif %}

cd ..
git clone https://github.com/pulp/ansible-pulp.git
if [ -n "$PULP_ROLES_PR_NUMBER" ]; then
Expand Down