Skip to content

Commit 12b48a5

Browse files
authored
chore: improve linting (#303)
1 parent 4c8f6ce commit 12b48a5

File tree

12 files changed

+115
-124
lines changed

12 files changed

+115
-124
lines changed

.github/workflows/serverless-service.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ jobs:
1919
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
2020
- name: Check out repository code
2121
uses: actions/checkout@v3
22-
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
23-
- uses: actions/checkout@v3
2422
- name: Set up Python 3.9
2523
uses: actions/setup-python@v4
2624
with:

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ dev:
88

99
lint:
1010
@echo "Running flake8"
11-
flake8 service/* tests/* docs/examples/*
11+
flake8 service/* cdk/* tests/* docs/examples/* --exclude patterns='build,cdk.json,cdk.context.json,.yaml'
1212

1313
complex:
1414
@echo "Running Radon"

Pipfile.lock

Lines changed: 85 additions & 85 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cdk/my_service/app.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from service_stack.constants import get_stack_name
77
from service_stack.service_stack import ServiceStack
88

9-
# pylint: disable=invalid-name
109
account = client('sts').get_caller_identity()['Account']
1110
region = session.Session().region_name
1211
app = App()

cdk/my_service/service_stack/configuration/configuration_construct.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import json
21
from pathlib import Path
3-
from typing import Any, Dict, Optional
2+
from typing import Optional
43

54
import aws_cdk.aws_appconfig as appconfig
65
from constructs import Construct
@@ -21,12 +20,14 @@ def __init__(self, scope: Construct, id_: str, environment: str, service_name: s
2120
2221
Args:
2322
scope (Construct): The scope in which to define this construct.
24-
id_ (str): The scoped construct ID. Must be unique amongst siblings. If the ID includes a path separator (``/``), then it will be replaced by double dash ``--``.
25-
environment (str): environment name. Used for loading the corresponding JSON file to upload under 'configuration/json/{environment}_configuration.json'
23+
id_ (str): The scoped construct ID. Must be unique amongst siblings. If the ID includes a path separator (``/``), then it will be
24+
replaced by double dash ``--``.
25+
environment (str): environment name. Used for loading the corresponding JSON file to upload under
26+
'configuration/json/{environment}_configuration.json'
2627
service_name (str): application name.
2728
configuration_name (str): configuration name
2829
deployment_strategy_id (str, optional): AWS AppConfig deployment strategy.
29-
See https://docs.aws.amazon.com/appconfig/latest/userguide/appconfig-creating-deployment-strategy.html
30+
See https://docs.aws.amazon.com/appconfig/latest/userguide/appconfig-creating-deployment-strategy.html
3031
Defaults to DEFAULT_DEPLOYMENT_STRATEGY.
3132
"""
3233
super().__init__(scope, id_)
@@ -86,5 +87,5 @@ def _get_and_validate_configuration(self, environment: str) -> str:
8687
conf_filepath = current / (f'json/{environment}_configuration.json')
8788
configuration_str = conf_filepath.read_text()
8889
# validate configuration (check feature flags schema structure if exists)
89-
parsed_configuration = FeatureFlagsConfiguration.parse_raw(configuration_str)
90+
FeatureFlagsConfiguration.parse_raw(configuration_str)
9091
return configuration_str

cdk/my_service/service_stack/service_construct.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
import os
2-
from pathlib import Path
3-
4-
import boto3
51
import my_service.service_stack.constants as constants
62
from aws_cdk import CfnOutput, Duration, RemovalPolicy, aws_apigateway
73
from aws_cdk import aws_iam as iam
@@ -13,7 +9,6 @@
139

1410
class ApiConstruct(Construct):
1511

16-
# pylint: disable=invalid-name, no-value-for-parameter
1712
def __init__(self, scope: Construct, id_: str) -> None:
1813
super().__init__(scope, id_)
1914

cdk/my_service/service_stack/service_stack.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77

88
class ServiceStack(Stack):
99

10-
# pylint: disable=redefined-builtin
1110
def __init__(self, scope: Construct, id: str, **kwargs) -> None:
1211
super().__init__(scope, id, **kwargs)
1312

14-
# This construct should be deployed in a different repo and have its own pipeline so updates can be decoupled from running the service pipeline and without
15-
# redeploying the service lambdas. For the sake of this template example, it is deployed as part of the service stack
13+
# This construct should be deployed in a different repo and have its own pipeline so updates can be decoupled
14+
# from running the service pipeline and without redeploying the service lambdas. For the sake of this template
15+
# example, it is deployed as part of the service stack
1616
self.dynamic_configuration = ConfigurationStore(self, 'dynamic_conf', ENVIRONMENT, SERVICE_NAME, CONFIGURATION_NAME)
1717

1818
self.lambdas = ApiConstruct(self, 'Service')

cdk/setup.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
#!/usr/bin/env python
2-
from os import getenv, path
2+
from os import path
33

44
from setuptools import find_packages, setup
55

6-
# pylint: disable=invalid-name
76
here = path.abspath(path.dirname(__file__))
87

98
setup(
@@ -26,6 +25,6 @@
2625
'aws-cdk-lib>=2.0.0',
2726
'constructs>=10.0.0',
2827
'cdk-nag>2.0.0',
29-
'aws-cdk.aws-lambda-python-alpha==2.39.1-alpha.0',
28+
'aws-cdk.aws-lambda-python-alpha==2.44.0-alpha.0',
3029
],
3130
)

dev_requirements.txt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
-i https://pypi.org/simple
22
attrs==22.1.0; python_version >= '3.5'
33
aws-cdk-lib==2.44.0; python_version ~= '3.7'
4-
aws-cdk.aws-lambda-python-alpha==2.39.1a0; python_version ~= '3.7'
4+
aws-cdk.aws-lambda-python-alpha==2.44.0a0; python_version ~= '3.7'
5+
boto3==1.24.83; python_version >= '3.7'
6+
botocore==1.27.83; python_version >= '3.7'
7+
cattrs==22.1.0; python_version >= '3.7' and python_version < '4.0'
58
-e ./cdk
6-
boto3==1.24.82; python_version >= '3.7'
7-
botocore==1.27.82; python_version >= '3.7'
8-
cattrs==22.1.0; python_version >= '3.7' and python_version < '4'
9-
cdk-nag==2.18.23; python_version ~= '3.7'
9+
cdk-nag==2.18.24; python_version ~= '3.7'
1010
certifi==2022.9.24; python_version >= '3.6'
1111
cfgv==3.3.1; python_full_version >= '3.6.1'
1212
charset-normalizer==2.1.1; python_version >= '3.6'
1313
click==8.1.3; python_version >= '3.7'
1414
colorama==0.4.5; python_version >= '3.5'
15-
constructs==10.1.116; python_version ~= '3.7'
16-
coverage[toml]==6.4.4; python_version >= '3.7'
15+
constructs==10.1.117; python_version ~= '3.7'
16+
coverage[toml]==6.5.0; python_version >= '3.7'
1717
distlib==0.3.6
1818
exceptiongroup==1.0.0rc9; python_version < '3.11'
1919
filelock==3.8.0; python_version >= '3.7'
@@ -54,32 +54,32 @@ pyparsing==3.0.9; python_full_version >= '3.6.8'
5454
pytest==7.1.3
5555
pytest-cov==4.0.0
5656
pytest-html==3.1.1
57-
pytest-metadata==2.0.2; python_version >= '3.7' and python_version < '4'
57+
pytest-metadata==2.0.2; python_version >= '3.7' and python_version < '4.0'
5858
pytest-mock==3.9.0
5959
python-dateutil==2.8.2; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
6060
python-dotenv==0.21.0
6161
pyyaml==6.0; python_version >= '3.6'
6262
pyyaml-env-tag==0.1; python_version >= '3.6'
6363
radon==5.1.0
64-
requests==2.28.1; python_version >= '3.7' and python_version < '4'
64+
requests==2.28.1; python_version >= '3.7' and python_version < '4.0'
6565
s3transfer==0.6.0; python_version >= '3.7'
6666
-e ./cdk
67-
setuptools==65.4.0; python_version >= '3.7'
67+
setuptools==65.4.1; python_version >= '3.7'
6868
six==1.16.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
6969
smmap==5.0.0; python_version >= '3.6'
7070
toml==0.10.2; python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'
7171
tomli==2.0.1; python_version >= '3.7'
7272
typeguard==2.13.3; python_full_version >= '3.5.3'
7373
typing-extensions==4.3.0; python_version >= '3.7'
74-
urllib3==1.26.12; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5' and python_full_version < '4.0.0'
74+
urllib3==1.26.12; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5' and python_version < '4'
7575
virtualenv==20.16.5; python_version >= '3.6'
7676
watchdog==2.1.9; python_version >= '3.6'
7777
xenon==0.9.0
7878
yapf==0.32.0
7979
zipp==3.8.1; python_version >= '3.7'
8080
aws-lambda-powertools==1.29.2
8181
aws-xray-sdk==2.10.0
82-
dnspython==2.2.1; python_version >= '3.6' and python_full_version < '4.0.0'
82+
dnspython==2.2.1; python_version >= '3.6' and python_version < '4'
8383
email-validator==1.3.0
8484
fastjsonschema==2.16.2
8585
pydantic[email]==1.10.2

docs/examples/best_practices/dynamic_configuration/cdk_appconfig.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
class DynamicConfigurationStack(Stack):
88

9-
# pylint: disable=redefined-builtin
109
def __init__(self, scope: Construct, id: str, **kwargs) -> None:
1110
super().__init__(scope, id, **kwargs)
1211

0 commit comments

Comments
 (0)