Skip to content

Commit

Permalink
Add more pre-commit hooks (#117)
Browse files Browse the repository at this point in the history
* Generic hooks to fix files. These fixed some line endings, trailing whitespace, etc.
* `check-manifest` to ensure distributed files are as intended. This required some cleanups.
  • Loading branch information
adamchainz committed May 9, 2021
1 parent 79202a7 commit 077abf3
Show file tree
Hide file tree
Showing 13 changed files with 42 additions and 14 deletions.
16 changes: 16 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-json
- id: check-merge-conflict
- id: check-symlinks
- id: check-toml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 21.4b2
hooks:
Expand All @@ -16,3 +27,8 @@ repos:
- flake8-bugbear
- flake8-comprehensions
- flake8-tidy-imports
- repo: https://github.com/mgedmin/check-manifest
rev: "0.46"
hooks:
- id: check-manifest
args: [--no-build-isolation]
13 changes: 13 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
global-exclude *.py[cod]
prune docs
prune example
prune tests
prune __pycache__
include LICENSE
include README.md
exclude .pre-commit-config.yaml
exclude manage.py
exclude mkdocs.py
include pyproject.toml
exclude testsettings.py
exclude tox.ini
4 changes: 2 additions & 2 deletions docs/api/base-views.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ You can customize this method in order to supply additional arguments to the for

def get_form(self, data=None, files=None, **kwargs):
kwargs['user'] = self.request.user
return AccountForm(data, files, **kwargs)
return AccountForm(data, files, **kwargs)

#### get_context_data(self, **kwargs)

Expand All @@ -65,7 +65,7 @@ This method takes a set of keyword arguments supplied by the view and returns a
The default behavior of this method is to return a dictionary populated with the following keys:

* `view` - A reference to the view instance.
* Any additional keyword arguments supplied to the method. In particular, `FormView` includes the `form` context key.
* Any additional keyword arguments supplied to the method. In particular, `FormView` includes the `form` context key.

You can override the method either to add additional context data:

Expand Down
2 changes: 1 addition & 1 deletion docs/css/bootstrap-responsive.css
Original file line number Diff line number Diff line change
Expand Up @@ -1055,4 +1055,4 @@
height: auto !important;
overflow: visible !important;
}
}
}
2 changes: 1 addition & 1 deletion docs/css/bootstrap.css
Original file line number Diff line number Diff line change
Expand Up @@ -5771,4 +5771,4 @@ a.badge:hover {

.affix {
position: fixed;
}
}
4 changes: 2 additions & 2 deletions docs/css/default.css
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ body{
}

.navbar .navbar-inner .nav li, .navbar .navbar-inner .nav li a, .navbar .navbar-inner .brand{
color: white;
color: white;
}

.nav-list > .active > a, .navbar .navbar-inner .nav li a:hover {
Expand All @@ -190,7 +190,7 @@ body{
}

.navbar .navbar-inner .dropdown-menu li a, .navbar .navbar-inner .dropdown-menu li{
color: #A30000;
color: #A30000;
}
.navbar .navbar-inner .dropdown-menu li a:hover{
background: #eeeeee;
Expand Down
2 changes: 1 addition & 1 deletion docs/css/prettify.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ ol.linenums li {
color: #bebec5;
line-height: 20px;
text-shadow: 0 1px 0 #fff;
}
}
2 changes: 1 addition & 1 deletion docs/js/bootstrap-2.1.1-min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/js/jquery-1.8.1-min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion example/statics/css/bootstrap.css
Original file line number Diff line number Diff line change
Expand Up @@ -6802,4 +6802,4 @@ td.visible-print {
td.hidden-print {
display: none !important;
}
}
}
4 changes: 2 additions & 2 deletions example/templates/notes/note_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
<body>
<h1 style="margin: 30px">{% if note %}Edit note{% else %}Create note{% endif%}</h1>
<div style="margin: 30px">
<form method="POST" action=".">
<form method="POST" action=".">
{% csrf_token %}
{{ form }}
<input type="submit" class="btn btn-primary" value="Save">
</form>
</div>
</body>
</html>
</html>
2 changes: 1 addition & 1 deletion example/templates/notes/note_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ <h1 style="margin: 30px">Django Vanilla Views</h1>
<p><a href="{% url 'create_note' %}">Create a new note</a></p>
</div>
</body>
</html>
</html>
1 change: 0 additions & 1 deletion requirements.txt

This file was deleted.

0 comments on commit 077abf3

Please sign in to comment.