From 061f35fdfadde12b07431c7d5aa9c8103610c275 Mon Sep 17 00:00:00 2001 From: Andrew Player Date: Mon, 16 Dec 2024 14:21:29 -0500 Subject: [PATCH] switch to ruff from flake8 --- .github/workflows/static-analysis.yml | 15 +++------------ Makefile | 6 +++--- requirements-all.txt | 5 +---- ruff.toml | 4 ++++ 4 files changed, 11 insertions(+), 19 deletions(-) create mode 100644 ruff.toml diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index aa5180bca..2ed4887b4 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -3,18 +3,9 @@ name: Static code analysis on: push jobs: - flake8: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4.2.2 - - uses: actions/setup-python@v5 - with: - python-version: 3.9 - - run: | - python -m pip install --upgrade pip - make install - - - run: make flake8 + call-ruff-workflow: + # Docs: https://github.com/ASFHyP3/actions + uses: ASFHyP3/actions/.github/workflows/reusable-ruff.yml@v0.12.0 cfn-lint: runs-on: ubuntu-latest diff --git a/Makefile b/Makefile index 81d462c22..0a5a5c605 100644 --- a/Makefile +++ b/Makefile @@ -44,10 +44,10 @@ cost_profile ?= DEFAULT render: @echo rendering $(files) for API $(api_name) and security environment $(security_environment); python apps/render_cf.py -j $(files) -e $(compute_env_file) -s $(security_environment) -n $(api_name) -c $(cost_profile) -static: flake8 openapi-validate cfn-lint +static: ruff openapi-validate cfn-lint -flake8: - flake8 --ignore=E731 --max-line-length=120 --import-order-style=pycharm --statistics --application-import-names hyp3_api,get_files,handle_batch_event,set_batch_overrides,check_processing_time,start_execution_manager,start_execution_worker,disable_private_dns,update_db,upload_log,dynamo,lambda_logging,scale_cluster apps tests lib +ruff: + ruff check openapi-validate: render openapi-spec-validator apps/api/src/hyp3_api/api-spec/openapi-spec.yml diff --git a/requirements-all.txt b/requirements-all.txt index 36b01eb44..285c0a70c 100644 --- a/requirements-all.txt +++ b/requirements-all.txt @@ -11,10 +11,7 @@ moto[dynamodb]==5.0.22 pytest==8.3.4 PyYAML==6.0.2 responses==0.25.3 -flake8==7.1.1 -flake8-import-order==0.18.2 -flake8-blind-except==0.2.1 -flake8-builtins==2.5.0 +ruff==0.8.3 setuptools==75.6.0 openapi-spec-validator==0.7.1 cfn-lint==1.21.0 diff --git a/ruff.toml b/ruff.toml new file mode 100644 index 000000000..61f91605f --- /dev/null +++ b/ruff.toml @@ -0,0 +1,4 @@ +line-length = 120 + +[format] +quote-style = "single"