Skip to content

Commit c09830d

Browse files
authored
Merge pull request #3077 from pydanny/fix/linting-gh-actions
2 parents 3f3148f + 675cef0 commit c09830d

43 files changed

Lines changed: 106 additions & 101 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ black==20.8b1
88
isort==5.8.0
99
flake8==3.9.0
1010
flake8-isort==4.0.0
11+
pre-commit==2.10.1
1112

1213
# Testing
1314
# ------------------------------------------------------------------------------

tests/test_bare.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,11 @@ sudo utility/install_os_dependencies.sh install
2727
# Install Python deps
2828
pip install -r requirements/local.txt
2929

30+
# Lint by running pre-commit on all files
31+
# Needs a git repo to find the project root
32+
git init
33+
git add .
34+
pre-commit run --show-diff-on-failure -a
35+
3036
# run the project's tests
3137
pytest

tests/test_docker.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,16 @@ cd .cache/docker
1717
cookiecutter ../../ --no-input --overwrite-if-exists use_docker=y $@
1818
cd my_awesome_project
1919

20+
# Lint by running pre-commit on all files
21+
# Needs a git repo to find the project root
22+
# We don't have git inside Docker, so run it outside
23+
git init
24+
git add .
25+
pre-commit run --show-diff-on-failure -a
26+
2027
# run the project's type checks
2128
docker-compose -f local.yml run django mypy my_awesome_project
2229

23-
# Run black with --check option
24-
docker-compose -f local.yml run django black --check --diff --exclude 'migrations' ./
25-
2630
# run the project's tests
2731
docker-compose -f local.yml run django pytest
2832

{{cookiecutter.project_slug}}/.envs/.local/.django

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ REDIS_URL=redis://redis:6379/0
1414
# Flower
1515
CELERY_FLOWER_USER=!!!SET CELERY_FLOWER_USER!!!
1616
CELERY_FLOWER_PASSWORD=!!!SET CELERY_FLOWER_PASSWORD!!!
17-
{% endif %}
17+
{%- endif %}

{{cookiecutter.project_slug}}/.pre-commit-config.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,3 @@ repos:
2626
- id: flake8
2727
args: ['--config=setup.cfg']
2828
additional_dependencies: [flake8-isort]
29-

{{cookiecutter.project_slug}}/.pylintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[MASTER]
2-
load-plugins=pylint_django{% if cookiecutter.use_celery == "y" %}, pylint_celery {% endif %}
2+
load-plugins=pylint_django{% if cookiecutter.use_celery == "y" %}, pylint_celery{% endif %}
33

44
[FORMAT]
55
max-line-length=120

{{cookiecutter.project_slug}}/LICENSE

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
77
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
88

99
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
10-
{% elif cookiecutter.open_source_license == 'BSD' %}
10+
{%- elif cookiecutter.open_source_license == 'BSD' %}
1111
Copyright (c) {% now 'utc', '%Y' %}, {{ cookiecutter.author_name }}
1212
All rights reserved.
1313

@@ -35,7 +35,7 @@ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
3535
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
3636
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
3737
OF THE POSSIBILITY OF SUCH DAMAGE.
38-
{% elif cookiecutter.open_source_license == 'GPLv3' %}
38+
{%- elif cookiecutter.open_source_license == 'GPLv3' %}
3939
Copyright (c) {% now 'utc', '%Y' %}, {{ cookiecutter.author_name }}
4040

4141
This program is free software: you can redistribute it and/or modify
@@ -50,7 +50,7 @@ GNU General Public License for more details.
5050

5151
You should have received a copy of the GNU General Public License
5252
along with this program. If not, see <http://www.gnu.org/licenses/>.
53-
{% elif cookiecutter.open_source_license == 'Apache Software License 2.0' %}
53+
{%- elif cookiecutter.open_source_license == 'Apache Software License 2.0' %}
5454

5555
Apache License
5656
Version 2.0, January 2004
@@ -242,4 +242,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
242242
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
243243
See the License for the specific language governing permissions and
244244
limitations under the License.
245-
{% endif %}
245+
{%- endif %}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
release: python manage.py migrate
2-
{% if cookiecutter.use_async == "y" -%}
2+
{%- if cookiecutter.use_async == "y" -%}
33
web: gunicorn config.asgi:application -k uvicorn.workers.UvicornWorker
44
{%- else %}
55
web: gunicorn config.wsgi:application
66
{%- endif %}
7-
{% if cookiecutter.use_celery == "y" -%}
7+
{%- if cookiecutter.use_celery == "y" -%}
88
worker: celery worker --app=config.celery_app --loglevel=info
99
beat: celery beat --app=config.celery_app --loglevel=info
1010
{%- endif %}

{{cookiecutter.project_slug}}/README.rst

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
1010
:target: https://github.com/ambv/black
1111
:alt: Black code style
12-
{% if cookiecutter.open_source_license != "Not open source" %}
12+
{%- if cookiecutter.open_source_license != "Not open source" %}
1313

1414
:License: {{cookiecutter.open_source_license}}
15-
{% endif %}
15+
{%- endif %}
1616

1717
Settings
1818
--------
@@ -67,7 +67,7 @@ Moved to `Live reloading and SASS compilation`_.
6767

6868
.. _`Live reloading and SASS compilation`: http://cookiecutter-django.readthedocs.io/en/latest/live-reloading-and-sass-compilation.html
6969

70-
{% if cookiecutter.use_celery == "y" %}
70+
{%- if cookiecutter.use_celery == "y" %}
7171

7272
Celery
7373
^^^^^^
@@ -83,19 +83,21 @@ To run a celery worker:
8383
8484
Please note: For Celery's import magic to work, it is important *where* the celery commands are run. If you are in the same folder with *manage.py*, you should be right.
8585

86-
{% endif %}
87-
{% if cookiecutter.use_mailhog == "y" %}
86+
{%- endif %}
87+
{%- if cookiecutter.use_mailhog == "y" %}
8888

8989
Email Server
9090
^^^^^^^^^^^^
91-
{% if cookiecutter.use_docker == 'y' %}
91+
{%- if cookiecutter.use_docker == 'y' %}
92+
9293
In development, it is often nice to be able to see emails that are being sent from your application. For that reason local SMTP server `MailHog`_ with a web interface is available as docker container.
9394

9495
Container mailhog will start automatically when you will run all docker containers.
9596
Please check `cookiecutter-django Docker documentation`_ for more details how to start all containers.
9697

9798
With MailHog running, to view messages that are sent by your application, open your browser and go to ``http://127.0.0.1:8025``
98-
{% else %}
99+
{%- else %}
100+
99101
In development, it is often nice to be able to see emails that are being sent from your application. If you choose to use `MailHog`_ when generating the project a local SMTP server with a web interface will be available.
100102

101103
#. `Download the latest MailHog release`_ for your OS.
@@ -117,10 +119,10 @@ In development, it is often nice to be able to see emails that are being sent fr
117119
Now you have your own mail server running locally, ready to receive whatever you send it.
118120

119121
.. _`Download the latest MailHog release`: https://github.com/mailhog/MailHog/releases
120-
{% endif %}
122+
{%- endif %}
121123
.. _mailhog: https://github.com/mailhog/MailHog
122-
{% endif %}
123-
{% if cookiecutter.use_sentry == "y" %}
124+
{%- endif %}
125+
{%- if cookiecutter.use_sentry == "y" %}
124126

125127
Sentry
126128
^^^^^^
@@ -129,32 +131,31 @@ Sentry is an error logging aggregator service. You can sign up for a free accoun
129131
The system is setup with reasonable defaults, including 404 logging and integration with the WSGI application.
130132

131133
You must set the DSN url in production.
132-
{% endif %}
134+
{%- endif %}
133135

134136
Deployment
135137
----------
136138

137139
The following details how to deploy this application.
138-
{% if cookiecutter.use_heroku.lower() == "y" %}
140+
{%- if cookiecutter.use_heroku.lower() == "y" %}
139141

140142
Heroku
141143
^^^^^^
142144

143145
See detailed `cookiecutter-django Heroku documentation`_.
144146

145147
.. _`cookiecutter-django Heroku documentation`: http://cookiecutter-django.readthedocs.io/en/latest/deployment-on-heroku.html
146-
{% endif %}
147-
{% if cookiecutter.use_docker.lower() == "y" %}
148+
{%- endif %}
149+
{%- if cookiecutter.use_docker.lower() == "y" %}
148150

149151
Docker
150152
^^^^^^
151153

152154
See detailed `cookiecutter-django Docker documentation`_.
153155

154156
.. _`cookiecutter-django Docker documentation`: http://cookiecutter-django.readthedocs.io/en/latest/deployment-with-docker.html
155-
{% endif %}
156-
157-
{% if cookiecutter.custom_bootstrap_compilation == "y" %}
157+
{%- endif %}
158+
{%- if cookiecutter.custom_bootstrap_compilation == "y" %}
158159
Custom Bootstrap Compilation
159160
^^^^^^
160161

@@ -163,11 +164,11 @@ Bootstrap v4 is installed using npm and customised by tweaking your variables in
163164

164165
You can find a list of available variables `in the bootstrap source`_, or get explanations on them in the `Bootstrap docs`_.
165166

166-
{% if cookiecutter.js_task_runner == 'Gulp' %}
167+
{%- if cookiecutter.js_task_runner == 'Gulp' %}
167168
Bootstrap's javascript as well as its dependencies is concatenated into a single file: ``static/js/vendors.js``.
168-
{% endif %}
169+
{%- endif %}
169170

170171
.. _in the bootstrap source: https://github.com/twbs/bootstrap/blob/v4-dev/scss/_variables.scss
171172
.. _Bootstrap docs: https://getbootstrap.com/docs/4.1/getting-started/theming/
172173

173-
{% endif %}
174+
{%- endif %}

{{cookiecutter.project_slug}}/compose/local/django/start

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ python manage.py migrate
1010
uvicorn config.asgi:application --host 0.0.0.0 --reload
1111
{%- else %}
1212
python manage.py runserver_plus 0.0.0.0:8000
13-
{% endif %}
13+
{%- endif %}

0 commit comments

Comments
 (0)