Skip to content
This repository was archived by the owner on Jun 27, 2023. It is now read-only.

Commit 981fb32

Browse files
author
Thiago C. D'Ávila
authored
Merge pull request #45 from staticdev/Flake8-and-fixes
Flake8 and fixes
2 parents 13da3c9 + 2796bc5 commit 981fb32

File tree

14 files changed

+558
-175
lines changed

14 files changed

+558
-175
lines changed

.darglint

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[darglint]
2+
strictness = short

.flake8

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[flake8]
2-
select = ANN,B,B9,BLK,C,D,DAR,E,F,S,W
3-
ignore = E203,E501,W503,C901,S308
2+
select = B,B9,C,E,F,N,S,W
3+
ignore = E203,E501,W503,C901,B950
44
max-line-length = 80
55
max-complexity = 10
66
docstring-convention = google

.pre-commit-config.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@ repos:
1515
rev: 19.10b0
1616
hooks:
1717
- id: black
18-
# - repo: https://gitlab.com/pycqa/flake8
19-
# rev: 3.7.9
20-
# hooks:
21-
# - id: flake8
22-
# additional_dependencies:
23-
# - flake8-bandit==2.1.2
24-
# - flake8-bugbear==20.1.4
25-
# - flake8-docstrings==1.5.0
26-
# - pep8-naming==0.10.0
27-
# - darglint==1.2.3
18+
- repo: https://gitlab.com/pycqa/flake8
19+
rev: 3.8.1
20+
hooks:
21+
- id: flake8
22+
additional_dependencies:
23+
- flake8-bandit==2.1.2
24+
- flake8-bugbear==20.1.4
25+
- flake8-docstrings==1.5.0
26+
- pep8-naming==0.10.0
27+
- darglint==1.3.0
2828
- repo: https://github.com/asottile/reorder_python_imports
2929
rev: v2.3.0
3030
hooks:

.travis.yml

Lines changed: 6 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,20 @@
11
language: python
22

33
python:
4-
- "2.7"
5-
- "3.3"
6-
- "3.4"
7-
- "3.5"
84
- "3.6"
5+
- "3.7"
6+
- "3.8"
97

108
env:
11-
- DJANGO="Django>=1.7.0,<1.8.0"
12-
- DJANGO="Django>=1.8.0,<1.9.0"
13-
- DJANGO="Django>=1.9.0,<1.10.0"
14-
- DJANGO="Django>=1.10.0,<1.11.0"
15-
- DJANGO="Django>=1.11.0,<2.0.0"
169
- DJANGO="Django>=2.0.0,<2.1.0"
1710
- DJANGO="Django>=2.1.0,<2.2.0"
1811

12+
before_install:
13+
- pip install poetry nox
14+
1915
install:
2016
- pip install -q $DJANGO
21-
- pip install coveralls
17+
- poetry install
2218

2319
script:
2420
- coverage run runtests.py
25-
26-
after_success:
27-
- coveralls
28-
29-
matrix:
30-
exclude:
31-
- python: "3.5"
32-
env: DJANGO="Django>=1.7.0,<1.8.0"
33-
- python: "3.6"
34-
env: DJANGO="Django>=1.7.0,<1.8.0"
35-
36-
- python: "3.6"
37-
env: DJANGO="Django>=1.8.0,<1.9.0"
38-
39-
- python: "3.3"
40-
env: DJANGO="Django>=1.9.0,<1.10.0"
41-
- python: "3.6"
42-
env: DJANGO="Django>=1.9.0,<1.10.0"
43-
44-
- python: "3.3"
45-
env: DJANGO="Django>=1.10.0,<1.11.0"
46-
- python: "3.6"
47-
env: DJANGO="Django>=1.10.0,<1.11.0"
48-
49-
- python: "3.3"
50-
env: DJANGO="Django>=1.11.0,<2.0.0"
51-
52-
- python: "2.7"
53-
env: DJANGO="Django>=2.0.0,<2.1.0"
54-
- python: "3.3"
55-
env: DJANGO="Django>=2.0.0,<2.1.0"
56-
57-
- python: "2.7"
58-
env: DJANGO="Django>=2.1.0,<2.2.0"
59-
- python: "3.3"
60-
env: DJANGO="Django>=2.1.0,<2.2.0"
61-
- python: "3.4"
62-
env: DJANGO="Django>=2.1.0,<2.2.0"

README.rst

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,23 @@ django-pagination-bootstrap
44

55
.. badges-begin
66
7-
|Travis| |Python Version| |PyPi| |Black|
7+
|Travis| |Python Version| |PyPi| |Black| |pre-commit|
88

99
.. |Travis| image:: https://api.travis-ci.org/staticdev/django-pagination-bootstrap.svg?branch=master
1010
:target: https://travis-ci.org/staticdev/django-pagination-bootstrap
1111

1212
.. |Python Version| image:: https://img.shields.io/pypi/pyversions/django-pagination-bootstrap
1313
:target: https://pypi.org/project/django-pagination-bootstrap
1414
:alt: Python Version
15-
1615
.. |PyPi| image:: https://badge.fury.io/py/django-pagination-bootstrap.svg
1716
:target: https://badge.fury.io/py/django-pagination-bootstrap
18-
17+
:alt: PyPI
1918
.. |Black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
2019
:target: https://github.com/psf/black
2120
:alt: Black
21+
.. |pre-commit| image:: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white
22+
:target: https://github.com/pre-commit/pre-commit
23+
:alt: pre-commit
2224

2325
Django-pagination-bootstrap is an app to easy add pagination in Django_, using `Bootstrap`_'s layout.
2426

@@ -44,7 +46,7 @@ We need to hook ``django-pagination-bootstrap`` into our project.
4446
4547
INSTALLED_APPS = (
4648
# other apps
47-
"django-pagination_bootstrap",
49+
"django_pagination_bootstrap",
4850
)
4951
5052
2. Install the pagination middleware. Your settings file might look something like:
@@ -56,22 +58,18 @@ We need to hook ``django-pagination-bootstrap`` into our project.
5658
"django_pagination_bootstrap.middleware.PaginationMiddleware",
5759
)
5860
59-
3. If it's not already added in your setup, add the request context processor. Note that context processors are set by default implicitly, so to set them explicitly, you need to copy and paste this code into your under the value TEMPLATE_CONTEXT_PROCESSORS.
61+
3. Guarantee you have ``django.template.context_processors.request`` on settings.py:
6062

6163
.. code-block:: python
6264
6365
TEMPLATES = [
6466
{
65-
"BACKEND": "django.template.backends.django.DjangoTemplates",
66-
"DIRS": [],
67-
"APP_DIRS": True,
67+
# ...
6868
"OPTIONS": {
6969
"context_processors": [
70-
"django.template.context_processors.debug",
71-
"django.template.context_processors.request",
72-
"django.contrib.auth.context_processors.auth",
73-
"django.template.context_processors.i18n",
74-
"django.template.context_processors.media",
70+
# ...
71+
"django.template.context_processors.request"
72+
# ...
7573
],
7674
},
7775
},
@@ -111,7 +109,7 @@ That's it! You have now paginated object_list and given users of the site a way
111109
Side effects
112110
============
113111

114-
A django-paginator_ instance will be injected in the template context as ``paginator``. You can access it as usual::
112+
A django-paginator_ instance will be injected in the template context as ``paginator``. You can access it as usual:
115113

116114
.. code-block:: python
117115

noxfile.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""Nox sessions."""
22
import contextlib
3-
import shutil
43
import tempfile
54
from pathlib import Path
65
from typing import cast
@@ -12,7 +11,7 @@
1211

1312
package = "django_pagination_bootstrap"
1413
python_versions = ["3.8", "3.7", "3.6"]
15-
nox.options.sessions = "pre-commit", "safety", "mypy", "tests"
14+
nox.options.sessions = "pre-commit", "safety", "mypy" # , "tests"
1615
locations = "src", "tests", "noxfile.py"
1716

1817

@@ -141,8 +140,18 @@ def tests(session: Session) -> None:
141140
"""Run the test suite."""
142141
install_package(session)
143142
install(session, "coverage[toml]", "pytest")
144-
session.run("coverage", "run", "-m", "pytest", *session.posargs)
145-
session.run("coverage", "report")
143+
session.run("coverage", "run", "--parallel", "-m", "pytest", *session.posargs)
144+
session.notify("coverage")
145+
146+
147+
@nox.session
148+
def coverage(session: Session) -> None:
149+
"""Produce the coverage report."""
150+
args = session.posargs or ["report"]
151+
install(session, "coverage[toml]")
152+
if not session.posargs and any(Path().glob(".coverage.*")):
153+
session.run("coverage", "combine")
154+
session.run("coverage", *args)
146155

147156

148157
@nox.session(python=python_versions)

0 commit comments

Comments
 (0)