diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d880a7103..53c328a0a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -56,7 +56,8 @@ Use the "Webhook secret" value as your `GITHUB_HOOK_SECRET` environment variable in Metecho. Use the app's "App ID" as `GITHUB_APP_ID`, "Client ID" as `GITHUB_CLIENT_ID`, -and "Client secret" as `GITHUB_CLIENT_SECRET`. These are stored in a shared lastpass note. +and "Client secret" as `GITHUB_CLIENT_SECRET`. These are stored in a shared +lastpass note. Finally, generate a new private key for the app and set it as the `GITHUB_APP_KEY` environment variable (the entire key, not a path to one). If diff --git a/README.md b/README.md index 5c997fe0e..c6ead5fa0 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,8 @@ ## Development and Deployment -See [documentation](https://metecho.readthedocs.io/en/latest/heroku-setup.html) on how to set up Metecho on Heroku. +See [documentation](https://metecho.readthedocs.io/en/latest/heroku-setup.html) +on how to set up Metecho on Heroku. See [CONTRIBUTING.md](CONTRIBUTING.md). diff --git a/metecho/api/gh.py b/metecho/api/gh.py index f80d7de5d..d401c4d14 100644 --- a/metecho/api/gh.py +++ b/metecho/api/gh.py @@ -9,9 +9,9 @@ import os import pathlib import shutil -from typing import Generator import zipfile from glob import glob +from typing import Generator from cumulusci.utils import temporary_dir from django.conf import settings diff --git a/metecho/api/jobs.py b/metecho/api/jobs.py index a79103d06..40b1243a3 100644 --- a/metecho/api/jobs.py +++ b/metecho/api/jobs.py @@ -273,8 +273,9 @@ def create_repository( else: repo = org.create_repository( - project.repo_name, description=project.description, - private=settings.ENABLE_CREATE_PRIVATE_REPO + project.repo_name, + description=project.description, + private=settings.ENABLE_CREATE_PRIVATE_REPO, ) team.add_repository(repo.full_name, permission="push") project.repo_id = repo.id diff --git a/metecho/api/migrations/0118_project_deleted_at.py b/metecho/api/migrations/0118_project_deleted_at.py index 81ff4e92e..15cac9ae6 100644 --- a/metecho/api/migrations/0118_project_deleted_at.py +++ b/metecho/api/migrations/0118_project_deleted_at.py @@ -6,13 +6,13 @@ class Migration(migrations.Migration): dependencies = [ - ('api', '0117_scratchorg_installed_packages'), + ("api", "0117_scratchorg_installed_packages"), ] operations = [ migrations.AddField( - model_name='project', - name='deleted_at', + model_name="project", + name="deleted_at", field=models.DateTimeField(blank=True, null=True), ), ] diff --git a/metecho/api/models.py b/metecho/api/models.py index 90c944413..5df70fcb1 100644 --- a/metecho/api/models.py +++ b/metecho/api/models.py @@ -11,7 +11,7 @@ from django.contrib.auth.models import AbstractUser from django.contrib.auth.models import UserManager as BaseUserManager from django.contrib.sites.models import Site -from django.core.exceptions import ValidationError, MultipleObjectsReturned +from django.core.exceptions import MultipleObjectsReturned, ValidationError from django.core.mail import send_mail from django.core.serializers.json import DjangoJSONEncoder from django.db import models, transaction @@ -241,10 +241,9 @@ def avatar_url(self) -> Optional[str]: except (AttributeError, KeyError, TypeError): return None # if social app exists in both db and settings retrun sample url - except (MultipleObjectsReturned): + except MultipleObjectsReturned: return "https://example.com/avatar/" - @property def org_id(self) -> Optional[str]: try: diff --git a/metecho/api/push.py b/metecho/api/push.py index ad8c56c05..dccbfe55c 100644 --- a/metecho/api/push.py +++ b/metecho/api/push.py @@ -63,6 +63,7 @@ scratchorg.list SCRATCH_ORG_RECREATE """ + from copy import deepcopy from typing import TYPE_CHECKING, Optional diff --git a/metecho/api/tests/serializers.py b/metecho/api/tests/serializers.py index 5bc874d18..59c7ecbf3 100644 --- a/metecho/api/tests/serializers.py +++ b/metecho/api/tests/serializers.py @@ -880,9 +880,9 @@ def test_assign__scratch_org_transfer( _ = user_factory( socialaccount_set__provider="github", socialaccount_set__uid=GH_WITH_METECHO_ID, - devhub_username=FIRST_DEVHUB_USER - if target_has_same_dev_hub - else SECOND_DEVHUB_USER, + devhub_username=( + FIRST_DEVHUB_USER if target_has_same_dev_hub else SECOND_DEVHUB_USER + ), ) target_gh_with_user = git_hub_user_factory(id=GH_WITH_METECHO_ID) diff --git a/metecho/oauth2/github/tests/views.py b/metecho/oauth2/github/tests/views.py index 9b975f905..14b6636f1 100644 --- a/metecho/oauth2/github/tests/views.py +++ b/metecho/oauth2/github/tests/views.py @@ -1,7 +1,6 @@ from unittest import mock import pytest -from allauth.socialaccount.models import SocialApp from ..views import CustomGitHubOAuth2Adapter diff --git a/metecho/oauth2/github/views.py b/metecho/oauth2/github/views.py index dd4f569a6..b1456fc2b 100644 --- a/metecho/oauth2/github/views.py +++ b/metecho/oauth2/github/views.py @@ -1,9 +1,6 @@ from allauth.socialaccount.providers.github.views import GitHubOAuth2Adapter -from ..views import ( - LoggingOAuth2CallbackView, - LoggingOAuth2LoginView, -) +from ..views import LoggingOAuth2CallbackView, LoggingOAuth2LoginView class CustomGitHubOAuth2Adapter(GitHubOAuth2Adapter): diff --git a/metecho/oauth2/salesforce/tests/provider.py b/metecho/oauth2/salesforce/tests/provider.py index 2f92bd5dd..b1bd65454 100644 --- a/metecho/oauth2/salesforce/tests/provider.py +++ b/metecho/oauth2/salesforce/tests/provider.py @@ -1,4 +1,5 @@ import pytest + from ..provider import CustomSalesforceProvider diff --git a/metecho/oauth2/salesforce/views.py b/metecho/oauth2/salesforce/views.py index 9a391854b..3de1eca39 100644 --- a/metecho/oauth2/salesforce/views.py +++ b/metecho/oauth2/salesforce/views.py @@ -10,10 +10,7 @@ from metecho.api.constants import ORGANIZATION_DETAILS -from ..views import ( - LoggingOAuth2CallbackView, - LoggingOAuth2LoginView, -) +from ..views import LoggingOAuth2CallbackView, LoggingOAuth2LoginView logger = logging.getLogger(__name__) ORGID_RE = re.compile(r"^00D[a-zA-Z0-9]{15}$") diff --git a/metecho/urls.py b/metecho/urls.py index ccea1f15f..e61584c8f 100644 --- a/metecho/urls.py +++ b/metecho/urls.py @@ -13,6 +13,7 @@ 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 urllib.parse import urljoin from django.conf import settings