From 732d2975384088648eb9bd4603b055c7016572d4 Mon Sep 17 00:00:00 2001 From: Levi <141682181+levisingularity@users.noreply.github.com> Date: Mon, 19 Aug 2024 08:42:13 -0300 Subject: [PATCH] [das#75] Make sure all repos are using the same lint config (#136) * ci: Make sure all repos are using the same lint config * ci: set lint config * fix: lint path * ci: fix lint --- .black.cfg | 4 ++++ .flake8.cfg | 3 +++ .github/workflows/testing.yml | 16 ++++++++++++++++ .isort.cfg | 5 +++++ Makefile | 8 ++++---- 5 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 .black.cfg create mode 100644 .flake8.cfg create mode 100644 .isort.cfg diff --git a/.black.cfg b/.black.cfg new file mode 100644 index 0000000..9cd06b0 --- /dev/null +++ b/.black.cfg @@ -0,0 +1,4 @@ +[black] +line-length = 100 +target-version = ['py37'] +skip-string-normalization = true \ No newline at end of file diff --git a/.flake8.cfg b/.flake8.cfg new file mode 100644 index 0000000..15ab771 --- /dev/null +++ b/.flake8.cfg @@ -0,0 +1,3 @@ +[flake8] +show-source = true +extend-ignore = E501 \ No newline at end of file diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index b53b996..c407006 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -27,6 +27,22 @@ jobs: - name: Install dependencies run: pip3 install -r requirements.txt + - name: Check if the lint configuration matches the one in the DAS repository. + run: |- + config_files=(".black.cfg" ".flake8.cfg" ".isort.cfg") + + for config_file in "${config_files[@]}"; do + master_lint=$(curl -s https://raw.githubusercontent.com/singnet/das/master/.lint/${config_file} | shasum -a 256 | cut -d ' ' -f 1) + local_lint=$(shasum -a 256 ${config_file} | cut -d ' ' -f 1) + + if [ "$master_lint" != "$local_lint" ]; then + echo "The local lint configuration differs from the one in the DAS repository." + exit 1 + fi + done + + echo "All lint configurations match the ones in the DAS repository." + - name: Perform Code Linting run: make lint diff --git a/.isort.cfg b/.isort.cfg new file mode 100644 index 0000000..4d6be9e --- /dev/null +++ b/.isort.cfg @@ -0,0 +1,5 @@ +[isort] +multi_line_output=3 +force_grid_wrap=0 +use_parentheses=True +line_length=100 \ No newline at end of file diff --git a/Makefile b/Makefile index 3ba1dc3..03a12a9 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,11 @@ isort: - @isort ./das-query-engine ./das-query-engine/tests --multi-line=3 --trailing-comma --force-grid-wrap=0 --use-parentheses --line-width=100 + @isort --settings-path .isort.cfg ./das-query-engine/tests black: - @black ./das-query-engine ./das-query-engine/tests --line-length 100 -t py37 --skip-string-normalization + @black --config .black.cfg ./das-query-engine/tests flake8: - @flake8 ./das-query-engine ./das-query-engine/tests --show-source --extend-ignore E501 + @flake8 --config .flake8.cfg ./das-query-engine/tests/ lint: isort black flake8 @@ -18,7 +18,7 @@ unit-tests-coverage: integration-tests: ./scripts/run-tests.sh integration -build: +build: docker compose build --no-cache pre-commit: lint unit-tests-coverage unit-tests integration-tests