From d793d0607b016a593419402507315f01fd084e00 Mon Sep 17 00:00:00 2001 From: levisingularity Date: Thu, 15 Aug 2024 15:37:05 -0300 Subject: [PATCH 1/4] ci: Make sure all repos are using the same lint config --- .github/workflows/testing.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index b53b996..3aefbd2 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -27,6 +27,16 @@ jobs: - name: Install dependencies run: pip3 install -r requirements.txt + - name: Check if the lint configuration matches the one in the DAS repository. + run: |- + master_lint=$(curl -s https://raw.githubusercontent.com/singnet/das/master/python/.pylintrc | shasum -a 256 | cut -d ' ' -f 1) + local_lint=$(shasum -a 256 .pylintrc | 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 + - name: Perform Code Linting run: make lint From 6c9e2c71fd966398989a0946faa3309e6c3233e7 Mon Sep 17 00:00:00 2001 From: levisingularity Date: Fri, 16 Aug 2024 15:54:19 -0300 Subject: [PATCH 2/4] ci: set lint config --- .black.cfg | 4 ++++ .flake8.cfg | 3 +++ .isort.cfg | 5 +++++ Makefile | 8 ++++---- 4 files changed, 16 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/.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..6ef6a9b 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 ./hyperon_das ./tests black: - @black ./das-query-engine ./das-query-engine/tests --line-length 100 -t py37 --skip-string-normalization + @black --config .black.cfg ./hyperon_das ./tests flake8: - @flake8 ./das-query-engine ./das-query-engine/tests --show-source --extend-ignore E501 + @flake8 --config .flake8.cfg ./hyperon_das ./tests --exclude ./hyperon_das/grpc/ 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 From a4a6da8a960fb7f838e619b8cd1458aaa01f449a Mon Sep 17 00:00:00 2001 From: levisingularity Date: Fri, 16 Aug 2024 15:57:32 -0300 Subject: [PATCH 3/4] fix: lint path --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 6ef6a9b..03a12a9 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,11 @@ isort: - @isort --settings-path .isort.cfg ./hyperon_das ./tests + @isort --settings-path .isort.cfg ./das-query-engine/tests black: - @black --config .black.cfg ./hyperon_das ./tests + @black --config .black.cfg ./das-query-engine/tests flake8: - @flake8 --config .flake8.cfg ./hyperon_das ./tests --exclude ./hyperon_das/grpc/ + @flake8 --config .flake8.cfg ./das-query-engine/tests/ lint: isort black flake8 From 0ad4cce90c75017bed2562239633718083f725ac Mon Sep 17 00:00:00 2001 From: levisingularity Date: Fri, 16 Aug 2024 16:36:22 -0300 Subject: [PATCH 4/4] ci: fix lint --- .github/workflows/testing.yml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 3aefbd2..c407006 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -29,13 +29,19 @@ jobs: - name: Check if the lint configuration matches the one in the DAS repository. run: |- - master_lint=$(curl -s https://raw.githubusercontent.com/singnet/das/master/python/.pylintrc | shasum -a 256 | cut -d ' ' -f 1) - local_lint=$(shasum -a 256 .pylintrc | cut -d ' ' -f 1) + config_files=(".black.cfg" ".flake8.cfg" ".isort.cfg") - if [ "$master_lint" != "$local_lint" ]; then - echo "The local lint configuration differs from the one in the DAS repository." - exit 1 - fi + 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