use flake8 on deployment (#1286)

All of the rest of the python codebases within the repo use flake8 as
part of the lint process.  This aligns the deployment code with the
practice.

Co-authored-by: Brian Caswell <bmc@shmoo.com>
This commit is contained in:
bmc-msft
2021-09-27 13:41:19 -04:00
committed by GitHub
parent d3bcbea980
commit 47bb2ce187
3 changed files with 16 additions and 8 deletions

View File

@ -309,10 +309,11 @@ jobs:
set -ex set -ex
cd src/deployment cd src/deployment
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install mypy isort black types-requests pip install mypy isort black types-requests flake8
mypy . mypy .
isort --profile black . --check isort --profile black . --check
black . --check black . --check
flake8 *.py
- name: Package Onefuzz - name: Package Onefuzz
run: | run: |
set -ex set -ex

5
src/deployment/.flake8 Normal file
View File

@ -0,0 +1,5 @@
[flake8]
ignore = E203, E266, E501, W503
max-line-length = 80
max-complexity = 18
select = B,C,E,F,W,T4,B9

View File

@ -252,8 +252,9 @@ class Client:
return add_application_password(object_id, self.get_subscription_id()) return add_application_password(object_id, self.get_subscription_id())
def get_instance_url(self) -> str: def get_instance_url(self) -> str:
## The url to access the instance # The url to access the instance
## This also represents the legacy identifier_uris of the application registration # This also represents the legacy identifier_uris of the application
# registration
if self.multi_tenant_domain: if self.multi_tenant_domain:
return "https://%s/%s" % ( return "https://%s/%s" % (
self.multi_tenant_domain, self.multi_tenant_domain,
@ -263,10 +264,11 @@ class Client:
return "https://%s.azurewebsites.net" % self.application_name return "https://%s.azurewebsites.net" % self.application_name
def get_identifier_url(self) -> str: def get_identifier_url(self) -> str:
## The used to identify the application registration via the identifier_uris field # This is used to identify the application registration via the
## Depending on the environment this value needs to be from an approved domain # identifier_uris field. Depending on the environment this value needs
## The format of this value is derived from the default value proposed by azure when creating # to be from an approved domain The format of this value is derived
## an application registration api://{guid}/... # from the default value proposed by azure when creating an application
# registration api://{guid}/...
if self.multi_tenant_domain: if self.multi_tenant_domain:
return "api://%s/%s" % ( return "api://%s/%s" % (
self.multi_tenant_domain, self.multi_tenant_domain,
@ -275,7 +277,7 @@ class Client:
else: else:
return "api://%s.azurewebsites.net" % self.application_name return "api://%s.azurewebsites.net" % self.application_name
def setup_rbac(self) -> None: def setup_rbac(self) -> None: # noqa: C901
""" """
Setup the client application for the OneFuzz instance. Setup the client application for the OneFuzz instance.
By default, Service Principals do not have access to create By default, Service Principals do not have access to create