From 29df9f44bfc4f4e7233734c5e38aa47998f0eba7 Mon Sep 17 00:00:00 2001 From: Victor Villas Date: Sat, 4 Apr 2020 17:14:58 -0300 Subject: [PATCH] Add flake8 to project and lint step --- .flake8 | 2 ++ .github/workflows/push.yaml | 12 +++--------- Makefile | 3 ++- dev-requirements.txt | 3 ++- examples/project/airflow/dags/my_dag.py | 3 +-- functions/load_metric.py | 2 +- 6 files changed, 11 insertions(+), 14 deletions(-) create mode 100644 .flake8 diff --git a/.flake8 b/.flake8 new file mode 100644 index 00000000..2bcd70e3 --- /dev/null +++ b/.flake8 @@ -0,0 +1,2 @@ +[flake8] +max-line-length = 88 diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index 3ba2a5cc..b7e03090 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -14,9 +14,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v1 - name: Install Dev Dependencies - run: | - python -m pip install --upgrade pip - pip install -r dev-requirements.txt + run: pip install -r dev-requirements.txt - name: Lint Templates run: make lint @@ -32,9 +30,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v1 - name: Install Dev Dependencies - run: | - python -m pip install --upgrade pip - pip install -r dev-requirements.txt + run: pip install -r dev-requirements.txt - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v1 with: @@ -56,9 +52,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v1 - name: Install Dev Dependencies - run: | - python -m pip install --upgrade pip - pip install -r dev-requirements.txt + run: pip install -r dev-requirements.txt - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v1 with: diff --git a/Makefile b/Makefile index 702be6f3..f7b68fca 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,8 @@ endif lint: black . --check - pylint test/*.py functions/*.py + flake8 . + pylint **/*.py cfn-lint templates/*.template nuke: diff --git a/dev-requirements.txt b/dev-requirements.txt index a20ad8c3..3bcc69a7 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,8 +1,9 @@ git+git://github.com/PyCQA/astroid.git#egg=astroid awscli black +cfn-flip cfn-lint -cfn-tools +flake8 git+git://github.com/PyCQA/pylint.git#egg=pylint pytest taskcat diff --git a/examples/project/airflow/dags/my_dag.py b/examples/project/airflow/dags/my_dag.py index 0f29b634..f1e2f0f9 100644 --- a/examples/project/airflow/dags/my_dag.py +++ b/examples/project/airflow/dags/my_dag.py @@ -1,7 +1,6 @@ from datetime import datetime -import airflow -from airflow.models import DAG +from airflow import DAG from airflow.operators.bash_operator import BashOperator default_args = { diff --git a/functions/load_metric.py b/functions/load_metric.py index b65fcf9b..84a94d7e 100644 --- a/functions/load_metric.py +++ b/functions/load_metric.py @@ -79,7 +79,7 @@ def get_metrics(timestamp): "Namespace": "AWS/AutoScaling", "MetricName": "GroupInServiceInstances", "Dimensions": [ - {"Name": "AutoScalingGroupName", "Value": f"{group}",} + {"Name": "AutoScalingGroupName", "Value": f"{group}"} ], }, "Period": 300,