Skip to content

Commit

Permalink
10575: Allow black to format migrations + reformat (#10578)
Browse files Browse the repository at this point in the history
* 10575: Update black configs to stop it skipping migration files

This brings it into line with isort running on all things.

Note: removing the `migrations` dir from the exclusions will broaden the scope of other tools that pre-commit uses, but this makes sense as black and isort will be targetting these, so why not flake8 too?

* 10575: Apply updated Black config to Bedrock migrations

* 10575: Update git-blame history ignoring for previous commit
  • Loading branch information
stevejalim authored Oct 12, 2021
1 parent c0fbb65 commit 5f3865d
Show file tree
Hide file tree
Showing 31 changed files with 224 additions and 246 deletions.
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@

# Migrate Python imports using isort
ab38b080abbff26e6968ced9267f3c576bb9e5fa

# Allow Black to reformat migrations
329890d484ff62fc05d6ca764801f56a6baaf748
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ exclude: >
| assets
| static
| bedrock/externalfiles/files_cache
| ^.*\b(migrations)\b.*$
| git-repos
| lib/fluent_migrations
)
Expand Down
11 changes: 5 additions & 6 deletions bedrock/base/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@

class Migration(migrations.Migration):

dependencies = [
]
dependencies = []

operations = [
migrations.CreateModel(
name='ConfigValue',
name="ConfigValue",
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(unique=True, max_length=100, db_index=True)),
('value', models.CharField(max_length=200)),
("id", models.AutoField(verbose_name="ID", serialize=False, auto_created=True, primary_key=True)),
("name", models.CharField(unique=True, max_length=100, db_index=True)),
("value", models.CharField(max_length=200)),
],
),
]
19 changes: 9 additions & 10 deletions bedrock/contentcards/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,21 @@

class Migration(migrations.Migration):

dependencies = [
]
dependencies = []

operations = [
migrations.CreateModel(
name='ContentCard',
name="ContentCard",
fields=[
('id', models.CharField(max_length=100, serialize=False, primary_key=True)),
('card_name', models.CharField(max_length=100)),
('page_name', models.CharField(max_length=100)),
('locale', models.CharField(max_length=10)),
('content', models.TextField(blank=True)),
('data', django_extensions.db.fields.json.JSONField()),
("id", models.CharField(max_length=100, serialize=False, primary_key=True)),
("card_name", models.CharField(max_length=100)),
("page_name", models.CharField(max_length=100)),
("locale", models.CharField(max_length=10)),
("content", models.TextField(blank=True)),
("data", django_extensions.db.fields.json.JSONField()),
],
options={
'ordering': ('id',),
"ordering": ("id",),
},
),
]
23 changes: 11 additions & 12 deletions bedrock/contentful/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,21 @@ class Migration(migrations.Migration):

initial = True

dependencies = [
]
dependencies = []

operations = [
migrations.CreateModel(
name='ContentfulEntry',
name="ContentfulEntry",
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('contentful_id', models.CharField(max_length=20, unique=True)),
('content_type', models.CharField(max_length=20)),
('language', models.CharField(max_length=5)),
('last_modified', models.DateTimeField(default=django.utils.timezone.now)),
('url_base', models.CharField(blank=True, max_length=255)),
('slug', models.CharField(blank=True, max_length=255)),
('data_hash', models.CharField(max_length=64)),
('data', django_extensions.db.fields.json.JSONField(default=dict)),
("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
("contentful_id", models.CharField(max_length=20, unique=True)),
("content_type", models.CharField(max_length=20)),
("language", models.CharField(max_length=5)),
("last_modified", models.DateTimeField(default=django.utils.timezone.now)),
("url_base", models.CharField(blank=True, max_length=255)),
("slug", models.CharField(blank=True, max_length=255)),
("data_hash", models.CharField(max_length=64)),
("data", django_extensions.db.fields.json.JSONField(default=dict)),
],
),
]
14 changes: 6 additions & 8 deletions bedrock/externalfiles/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,17 @@

class Migration(migrations.Migration):

dependencies = [
]
dependencies = []

operations = [
migrations.CreateModel(
name='ExternalFile',
name="ExternalFile",
fields=[
('name', models.CharField(max_length=50, serialize=False, primary_key=True)),
('content', models.TextField()),
('last_modified', models.DateTimeField(auto_now=True)),
("name", models.CharField(max_length=50, serialize=False, primary_key=True)),
("content", models.TextField()),
("last_modified", models.DateTimeField(auto_now=True)),
],
options={
},
options={},
bases=(models.Model,),
),
]
16 changes: 7 additions & 9 deletions bedrock/firefox/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,18 @@

class Migration(migrations.Migration):

dependencies = [
]
dependencies = []

operations = [
migrations.CreateModel(
name='FirefoxOSFeedLink',
name="FirefoxOSFeedLink",
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('link', models.URLField(max_length=2000)),
('title', models.CharField(max_length=2000)),
('locale', models.CharField(max_length=10, db_index=True)),
("id", models.AutoField(verbose_name="ID", serialize=False, auto_created=True, primary_key=True)),
("link", models.URLField(max_length=2000)),
("title", models.CharField(max_length=2000)),
("locale", models.CharField(max_length=10, db_index=True)),
],
options={
},
options={},
bases=(models.Model,),
),
]
4 changes: 2 additions & 2 deletions bedrock/firefox/migrations/0002_delete_firefoxosfeedlink.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
class Migration(migrations.Migration):

dependencies = [
('firefox', '0001_initial'),
("firefox", "0001_initial"),
]

operations = [
migrations.DeleteModel(
name='FirefoxOSFeedLink',
name="FirefoxOSFeedLink",
),
]
13 changes: 6 additions & 7 deletions bedrock/legal_docs/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,16 @@ class Migration(migrations.Migration):

initial = True

dependencies = [
]
dependencies = []

operations = [
migrations.CreateModel(
name='LegalDoc',
name="LegalDoc",
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=100)),
('locale', models.CharField(max_length=5)),
('content', models.TextField()),
("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
("name", models.CharField(max_length=100)),
("locale", models.CharField(max_length=5)),
("content", models.TextField()),
],
),
]
38 changes: 18 additions & 20 deletions bedrock/mozorg/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,38 @@

class Migration(migrations.Migration):

dependencies = [
]
dependencies = []

operations = [
migrations.CreateModel(
name='ContributorActivity',
name="ContributorActivity",
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('date', models.DateField()),
('source_name', models.CharField(max_length=100)),
('team_name', models.CharField(max_length=100)),
('total', models.IntegerField()),
('new', models.IntegerField()),
("id", models.AutoField(verbose_name="ID", serialize=False, auto_created=True, primary_key=True)),
("date", models.DateField()),
("source_name", models.CharField(max_length=100)),
("team_name", models.CharField(max_length=100)),
("total", models.IntegerField()),
("new", models.IntegerField()),
],
options={
'ordering': ['-date'],
'get_latest_by': 'date',
"ordering": ["-date"],
"get_latest_by": "date",
},
bases=(models.Model,),
),
migrations.CreateModel(
name='TwitterCache',
name="TwitterCache",
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('account', models.CharField(unique=True, max_length=100, db_index=True)),
('tweets', picklefield.fields.PickledObjectField(default=list, editable=False)),
('updated', django_extensions.db.fields.ModificationDateTimeField(default=django.utils.timezone.now, editable=False, blank=True)),
("id", models.AutoField(verbose_name="ID", serialize=False, auto_created=True, primary_key=True)),
("account", models.CharField(unique=True, max_length=100, db_index=True)),
("tweets", picklefield.fields.PickledObjectField(default=list, editable=False)),
("updated", django_extensions.db.fields.ModificationDateTimeField(default=django.utils.timezone.now, editable=False, blank=True)),
],
options={
},
options={},
bases=(models.Model,),
),
migrations.AlterUniqueTogether(
name='contributoractivity',
unique_together=set([('date', 'source_name', 'team_name')]),
name="contributoractivity",
unique_together=set([("date", "source_name", "team_name")]),
),
]
24 changes: 12 additions & 12 deletions bedrock/mozorg/migrations/0002_blogarticle.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@
class Migration(migrations.Migration):

dependencies = [
('mozorg', '0001_initial'),
("mozorg", "0001_initial"),
]

operations = [
migrations.CreateModel(
name='BlogArticle',
name="BlogArticle",
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('blog_slug', models.CharField(max_length=30)),
('blog_name', models.CharField(max_length=50)),
('published', models.DateTimeField()),
('updated', models.DateTimeField()),
('title', models.CharField(max_length=255)),
('summary', models.TextField()),
('link', models.URLField()),
("id", models.AutoField(verbose_name="ID", serialize=False, auto_created=True, primary_key=True)),
("blog_slug", models.CharField(max_length=30)),
("blog_name", models.CharField(max_length=50)),
("published", models.DateTimeField()),
("updated", models.DateTimeField()),
("title", models.CharField(max_length=255)),
("summary", models.TextField()),
("link", models.URLField()),
],
options={
'ordering': ['-published'],
'get_latest_by': 'published',
"ordering": ["-published"],
"get_latest_by": "published",
},
),
]
4 changes: 2 additions & 2 deletions bedrock/mozorg/migrations/0003_delete_blogarticle.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
class Migration(migrations.Migration):

dependencies = [
('mozorg', '0002_blogarticle'),
("mozorg", "0002_blogarticle"),
]

operations = [
migrations.DeleteModel(
name='BlogArticle',
name="BlogArticle",
),
]
6 changes: 3 additions & 3 deletions bedrock/mozorg/migrations/0004_auto_20200122_0957.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
class Migration(migrations.Migration):

dependencies = [
('mozorg', '0003_delete_blogarticle'),
("mozorg", "0003_delete_blogarticle"),
]

operations = [
migrations.DeleteModel(
name='ContributorActivity',
name="ContributorActivity",
),
migrations.DeleteModel(
name='TwitterCache',
name="TwitterCache",
),
]
11 changes: 5 additions & 6 deletions bedrock/newsletter/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@

class Migration(migrations.Migration):

dependencies = [
]
dependencies = []

operations = [
migrations.CreateModel(
name='Newsletter',
name="Newsletter",
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('slug', models.SlugField(help_text=b'The ID for the newsletter that will be used by clients', unique=True)),
('data', django_extensions.db.fields.json.JSONField()),
("id", models.AutoField(verbose_name="ID", serialize=False, auto_created=True, primary_key=True)),
("slug", models.SlugField(help_text=b"The ID for the newsletter that will be used by clients", unique=True)),
("data", django_extensions.db.fields.json.JSONField()),
],
),
]
8 changes: 4 additions & 4 deletions bedrock/newsletter/migrations/0002_auto_20200122_0957.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
class Migration(migrations.Migration):

dependencies = [
('newsletter', '0001_initial'),
("newsletter", "0001_initial"),
]

operations = [
migrations.AlterField(
model_name='newsletter',
name='slug',
field=models.SlugField(help_text='The ID for the newsletter that will be used by clients', unique=True),
model_name="newsletter",
name="slug",
field=models.SlugField(help_text="The ID for the newsletter that will be used by clients", unique=True),
),
]
Loading

0 comments on commit 5f3865d

Please sign in to comment.