Browse Source

Add pytest and mypy steps to the pre-commit hooks to avoid committing clearly broken code

Danielle McLean 7 months ago
parent
commit
f551a5214a
Signed by: Danielle McLean <dani@00dani.me> GPG Key ID: 8EB789DDF3ABD240
2 changed files with 20 additions and 3 deletions
  1. 14
    0
      .pre-commit-config.yaml
  2. 6
    3
      lemonauth/migrations/0001_initial.py

+ 14
- 0
.pre-commit-config.yaml View File

@@ -15,3 +15,17 @@ repos:
15 15
         args:
16 16
           - --fix=lf
17 17
       - id: trailing-whitespace
18
+  - repo: local
19
+    hooks:
20
+      - id: pytest
21
+        name: Check pytest unit tests pass
22
+        entry: pipenv run pytest
23
+        pass_filenames: false
24
+        language: system
25
+        types: [python]
26
+      - id: mypy
27
+        name: Check mypy static types match
28
+        entry: pipenv run mypy . --ignore-missing-imports
29
+        pass_filenames: false
30
+        language: system
31
+        types: [python]

+ 6
- 3
lemonauth/migrations/0001_initial.py View File

@@ -1,6 +1,7 @@
1 1
 # -*- coding: utf-8 -*-
2 2
 # Generated by Django 1.11.6 on 2017-10-29 05:05
3 3
 from __future__ import unicode_literals
4
+from typing import List, Tuple
4 5
 
5 6
 from django.db import migrations, models
6 7
 
@@ -10,18 +11,20 @@ class Migration(migrations.Migration):
10 11
     initial = True
11 12
 
12 13
     dependencies = [
13
-    ]
14
+    ]  # type: List[Tuple[str, str]]
14 15
 
15 16
     operations = [
16 17
         migrations.CreateModel(
17 18
             name='IndieAuthCode',
18 19
             fields=[
19
-                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
20
+                ('id', models.AutoField(auto_created=True,
21
+                                        primary_key=True, serialize=False, verbose_name='ID')),
20 22
                 ('code', models.CharField(max_length=64, unique=True)),
21 23
                 ('me', models.CharField(max_length=255)),
22 24
                 ('client_id', models.CharField(max_length=255)),
23 25
                 ('redirect_uri', models.CharField(max_length=255)),
24
-                ('response_type', models.CharField(choices=[('id', 'id'), ('code', 'code')], default='id', max_length=4)),
26
+                ('response_type', models.CharField(choices=[
27
+                 ('id', 'id'), ('code', 'code')], default='id', max_length=4)),
25 28
                 ('scope', models.CharField(blank=True, max_length=200)),
26 29
             ],
27 30
         ),

Loading…
Cancel
Save