mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-15 11:28:09 +00:00
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:
3
.github/workflows/ci.yml
vendored
3
.github/workflows/ci.yml
vendored
@ -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
5
src/deployment/.flake8
Normal 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
|
@ -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
|
||||||
|
Reference in New Issue
Block a user