Large code refactoring

* Add tests
* Remove git dependency (only needed when a git identifier is specified)
This commit is contained in:
David Wobrock authored and David-Wobrock committed 2017-11-29 23:57:23 +01:00
1 parent b8ca768a15
commit 50ce4f4cad
256 files changed
+1263 -477

No files matched your search

@@ -0,0 +1,3 @@
*.pyc
__pycache__/
*sqlite3
@@ -0,0 +1,22 @@
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_project.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
# issue is really that Django is missing to avoid masking other
# exceptions on Python 2.
try:
import django
except ImportError:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
)
raise
execute_from_command_line(sys.argv)
Whitespace-only changes.
@@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.
@@ -0,0 +1,5 @@
from django.apps import AppConfig
class TestApp1Config(AppConfig):
name = 'test_app1'
@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-11-27 15:49
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='A',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('null_field', models.IntegerField(null=True)),
],
),
]
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-11-27 15:49
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('test_app1', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='a',
name='new_null_field',
field=models.IntegerField(null=True),
),
]
@@ -0,0 +1,5 @@
from django.db import models
class A(models.Model):
null_field = models.IntegerField(null=True)
new_null_field = models.IntegerField(null=True)
@@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.
@@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.
Whitespace-only changes.
@@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.
@@ -0,0 +1,5 @@
from django.apps import AppConfig
class TestApp2Config(AppConfig):
name = 'test_app2'
@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-11-29 21:08
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='B',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('null_field', models.IntegerField(null=True)),
],
),
]
@@ -0,0 +1,4 @@
from django.db import models
class B(models.Model):
null_field = models.IntegerField(null=True)
@@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.
@@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.
Whitespace-only changes.
@@ -0,0 +1,121 @@
"""
Django settings for test_project project.
Generated by 'django-admin startproject' using Django 1.11.6.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'gtb+mohs%gf0+#fr89vw7e&#edmv=q8!iv+n&j_soawk$tkj3^'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'test_app1',
'test_app2'
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'test_project.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'test_project.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django_fake_database_backends.backends.mysql'
}
}
# Password validation
# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/1.11/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.11/howto/static-files/
STATIC_URL = '/static/'
@@ -0,0 +1,21 @@
"""linter_test_project URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url
from django.contrib import admin
urlpatterns = [
url(r'^admin/', admin.site.urls),
]
@@ -0,0 +1,16 @@
"""
WSGI config for linter_test_project project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_project.settings")
application = get_wsgi_application()
@@ -1,22 +0,0 @@
All files
# Veuillez saisir le message de validation pour vos modifications. Les lignes
# commençant par '#' seront ignorées, et un message vide abandonne la validation.
# Sur la branche master
# Modifications qui seront validées :
# nouveau fichier: .gitignore
# nouveau fichier: manage.py
# nouveau fichier: test_app/__init__.py
# nouveau fichier: test_app/admin.py
# nouveau fichier: test_app/apps.py
# nouveau fichier: test_app/migrations/0001_create_table.py
# nouveau fichier: test_app/migrations/0002_add_new_not_null_field.py
# nouveau fichier: test_app/migrations/__init__.py
# nouveau fichier: test_app/models.py
# nouveau fichier: test_app/tests.py
# nouveau fichier: test_app/views.py
# nouveau fichier: test_project_add_not_null_column/__init__.py
# nouveau fichier: test_project_add_not_null_column/settings.py
# nouveau fichier: test_project_add_not_null_column/urls.py
# nouveau fichier: test_project_add_not_null_column/wsgi.py
#
@@ -1 +0,0 @@
ref: refs/heads/master
@@ -1,5 +0,0 @@
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
@@ -1 +0,0 @@
Unnamed repository; edit this file 'description' to name the repository.
@@ -1,6 +0,0 @@
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
@@ -1,3 +0,0 @@
0000000000000000000000000000000000000000 13850658e796761657478d38eacd426e208b05b0 David-Wobrock <david.wobrock@gmail.com> 1509046620 +0200 commit (initial): Init
13850658e796761657478d38eacd426e208b05b0 0c78bfd0462272a51e3515731a6e6776bea72f72 David-Wobrock <david.wobrock@gmail.com> 1509046634 +0200 commit: All files
0c78bfd0462272a51e3515731a6e6776bea72f72 13ddff99f80afca39dc64eaa65928244584a88d3 David-Wobrock <david.wobrock@gmail.com> 1509046854 +0200 commit (amend): All files
@@ -1,3 +0,0 @@
0000000000000000000000000000000000000000 13850658e796761657478d38eacd426e208b05b0 David-Wobrock <david.wobrock@gmail.com> 1509046620 +0200 commit (initial): Init
13850658e796761657478d38eacd426e208b05b0 0c78bfd0462272a51e3515731a6e6776bea72f72 David-Wobrock <david.wobrock@gmail.com> 1509046634 +0200 commit: All files
0c78bfd0462272a51e3515731a6e6776bea72f72 13ddff99f80afca39dc64eaa65928244584a88d3 David-Wobrock <david.wobrock@gmail.com> 1509046854 +0200 commit (amend): All files
@@ -1,3 +0,0 @@
x]PËjÃ0ìÙ_±�ƒ�;Ôm øRrÈ­·„m­�ZY2zÒ¯¯dåY„˜™�™UÃee™?Ì }L¡•”‰~Öté«G¢¼£@U¤ÐaóU‹^B‘Eö RÀ2/^Ò"O—%O«¼Œ:% ¤³Æ*$Ø0JeÀ
æÌ‘pfœ×QÒÉ/£ÍY7°Þ…1)ô7à•QËk­a¦’«(»€óU�;L0Ãj|(‹£8¢ (Z†ÚŸ“ð89úí|à…ñ67o
Ýú{_&™&=ï�¨¬âu¼¸C;†œê*„a¸“˜Ñø¼U¶¶Fn½4©Ý‹´S­|錊␍µ:’o<ž�ÊmÅ~±Úºßs’T�ÔHB‰Ý&žÏï{øÐ$–s2UºFï„ÁUH÷‚)ãÿüájwr>Dqá£&
@@ -1,2 +0,0 @@
x¥�Á
B!E[û³�óL…ˆmú‚ÖŽÎ+)Äê÷3ú„–ç¹'ÖRr‡ÙmW½‰€a§mŠdtdö Å^\"¯�[XÄx4*<ûµ68†WN›såVã␍vé‹Óû‡‡K ù>ÅZö0[‘FX£FTcá.\¨Ó#wõ"";ã
@@ -1,3 +0,0 @@
x•ŽA
Â0E]çÙ‹ešf&SQð®ÓɨÅÖH�z}+âü»÷�'yûb]C‹2©ZñÞÍKNñ-A”V# 0
×,€ ÄÜâ¤×bë†YCK�jÂ৆5JòŽÔw€˜ø(ç<Ù}|öiuÈÝ”åb×éƒÕë‹ÛÓû¡’<nl�Ђ'j¼]‚0ó;‡ý[ÁøS˜Ý0Øc?èݼî¦Ib
@@ -1 +0,0 @@
xm�OOA Å=ϧhö‰îãE& Á(ÀxœvºË�Ît3S@¿½Ëžš¦¯ï÷Ú5ñîoŠ¢P_Ëé jŽ�o¡áä£`2‚YL—x‹µÀ¥–JÍð»ãŒdƒp^¶DvM6ƒ…ÀnGxG¸G‚½Mþ4Š6 ƒª²]G¾¶â9VUï÷Ú'{x8␍€coî34žð2¢ÚˆtùIkÇu.ÝÖÆ–ÿ2Õ4F=*G#½áƒ°vØÿŒ¢¹õZÏT>tœ8+Õ$pv)ë^ep´(æØ›«¨Jq.1î}âXf‡�Ý‘ ŠñÛË|º0ËÉj5›O—æc1þ|Ÿ·P\ÿÏXçLd1qGdj¦]8Ùˆ�m.†J]¡àþK0ª_òCš€
@@ -1 +0,0 @@
13ddff99f80afca39dc64eaa65928244584a88d3
@@ -1,23 +0,0 @@
All files
# Veuillez saisir le message de validation pour vos modifications. Les lignes
# commençant par '#' seront ignorées, et un message vide abandonne la validation.
# Sur la branche master
# Modifications qui seront validées :
# nouveau fichier: .gitignore
# nouveau fichier: manage.py
# nouveau fichier: test_app/__init__.py
# nouveau fichier: test_app/admin.py
# nouveau fichier: test_app/apps.py
# nouveau fichier: test_app/migrations/0001_create_table.py
# nouveau fichier: test_app/migrations/0002_add_new_not_null_field.py
# nouveau fichier: test_app/migrations/__init__.py
# nouveau fichier: test_app/migrations_utils.py
# nouveau fichier: test_app/models.py
# nouveau fichier: test_app/tests.py
# nouveau fichier: test_app/views.py
# nouveau fichier: test_project_add_not_null_column_followed_by_default/__init__.py
# nouveau fichier: test_project_add_not_null_column_followed_by_default/settings.py
# nouveau fichier: test_project_add_not_null_column_followed_by_default/urls.py
# nouveau fichier: test_project_add_not_null_column_followed_by_default/wsgi.py
#
@@ -1 +0,0 @@
ref: refs/heads/master
@@ -1,5 +0,0 @@
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
@@ -1 +0,0 @@
Unnamed repository; edit this file 'description' to name the repository.
@@ -1,6 +0,0 @@
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
@@ -1,4 +0,0 @@
0000000000000000000000000000000000000000 188d1e847da762e20ec43db374ffba8c5ee40581 David-Wobrock <david.wobrock@gmail.com> 1509048870 +0200 commit (initial): Init
188d1e847da762e20ec43db374ffba8c5ee40581 1ed2db048937886ab77c892d7ffa4bb3da6ae8a9 David-Wobrock <david.wobrock@gmail.com> 1509048882 +0200 commit: All files
1ed2db048937886ab77c892d7ffa4bb3da6ae8a9 4c2edb394b46664ac61f0b6fb29e57fe807ce21e David-Wobrock <david.wobrock@gmail.com> 1509049863 +0200 commit (amend): All files
4c2edb394b46664ac61f0b6fb29e57fe807ce21e 16fd55a08b9ad1af4282cafccf5c14adf1f2a1dc David-Wobrock <david.wobrock@gmail.com> 1509381987 +0100 commit (amend): All files
@@ -1,4 +0,0 @@
0000000000000000000000000000000000000000 188d1e847da762e20ec43db374ffba8c5ee40581 David-Wobrock <david.wobrock@gmail.com> 1509048870 +0200 commit (initial): Init
188d1e847da762e20ec43db374ffba8c5ee40581 1ed2db048937886ab77c892d7ffa4bb3da6ae8a9 David-Wobrock <david.wobrock@gmail.com> 1509048882 +0200 commit: All files
1ed2db048937886ab77c892d7ffa4bb3da6ae8a9 4c2edb394b46664ac61f0b6fb29e57fe807ce21e David-Wobrock <david.wobrock@gmail.com> 1509049863 +0200 commit (amend): All files
4c2edb394b46664ac61f0b6fb29e57fe807ce21e 16fd55a08b9ad1af4282cafccf5c14adf1f2a1dc David-Wobrock <david.wobrock@gmail.com> 1509381987 +0100 commit (amend): All files
@@ -1,3 +0,0 @@
x]PËjÃ0ìÙ_±�ƒ�;Ôm øRrÈ­·„m­�ZY2zÒ¯¯dåY„˜™�™UÃee™?Ì }L¡•”‰~Öté«G¢¼£@U¤ÐaóU‹^B‘Eö RÀ2/^Ò"O—%O«¼Œ:% ¤³Æ*$Ø0JeÀ
æÌ‘pfœ×QÒÉ/£ÍY7°Þ…1)ô7à•QËk­a¦’«(»€óU�;L0Ãj|(‹£8¢ (Z†ÚŸ“ð89úí|à…ñ67o
Ýú{_&™&=ï�¨¬âu¼¸C;†œê*„a¸“˜Ñø¼U¶¶Fn½4©Ý‹´S­|錊␍µ:’o<ž�ÊmÅ~±Úºßs’T�ÔHB‰Ý&žÏï{øÐ$–s2UºFï„ÁUH÷‚)ãÿüájwr>Dqá£&
@@ -1,3 +0,0 @@
x•ÎM
Â0†a×9Eöb™üOADÁ;¸N2S-¶FjÔëñ.ßoñðå2Ïc•ÚøU]˜%š”}Šˆ �í!xta }*iŸ ™,îqá[•
‘£␍ƒ×¬�³5”L°ÃИì˜-8T">ë¥,ò_#mN%-%_å–¾Ù½¹?Ïqœº\æ�Tz°ˆ¨å4€hk;Zù? ê14B5B¦IãÄñøK&
@@ -1 +0,0 @@
xm�OOA Å=ϧhö‰îãE& Á(ÀxœvºË�Ît3S@¿½Ëžš¦¯ï÷Ú5ñîoŠ¢P_Ëé jŽ�o¡áä£`2‚YL—x‹µÀ¥–JÍð»ãŒdƒp^¶DvM6ƒ…ÀnGxG¸G‚½Mþ4Š6 ƒª²]G¾¶â9VUï÷Ú'{x8␍€coî34žð2¢ÚˆtùIkÇu.ÝÖÆ–ÿ2Õ4F=*G#½áƒ°vØÿŒ¢¹õZÏT>tœ8+Õ$pv)ë^ep´(æØ›«¨Jq.1î}âXf‡�Ý‘ ŠñÛË|º0ËÉj5›O—æc1þ|Ÿ·P\ÿÏXçLd1qGdj¦]8Ùˆ�m.†J]¡àþK0ª_òCš€
@@ -1,2 +0,0 @@
x­‘1OÃ0…™ó+Nê�5Q\A@•2 UE ¬,YN|‰Œ;rì"þ=vÜ´…®x|~þÞ½s-u␍eYÞ, »Í Ñ\¨n ζÙcP’<£BÃ,r¨¿a÷ÉT§�ä„ä%h›‚<d¤È6÷@î¶E™´F÷@ië¬3H)ˆ~ÐÆ‚SÂÑJa=MŽI4ò‰—ózöõ¢óaB«q␍½prZ-eÃpm¤ÎŠ`k$Gx�Ë3*?‰«m’€?TU#p„
Þ'1\,Ó9(]CZ¡�A_ŸZVKLWëÉú1z« Óþ‚\$?q¾(ùò”R¦fT±«”¥ôp¢ªð‹*m©rRÒ6þØ&­Š+Ê_”ÅMLâØ2'mE޳F,À`pDs@:öþð~a?ˆËÍ}�]ľ1éðßÛµJÉEÉÕqÑ?8…ÆJ
@@ -1 +0,0 @@
16fd55a08b9ad1af4282cafccf5c14adf1f2a1dc
@@ -1 +0,0 @@
ref: refs/heads/master
@@ -1,5 +0,0 @@
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
@@ -1 +0,0 @@
Unnamed repository; edit this file 'description' to name the repository.
Loaded 100 of 256 files, more files were not shown because too many files have changed in this diff. Show more