Skip to content

Commit

Permalink
[das#75] Make sure all repos are using the same lint config (#136)
Browse files Browse the repository at this point in the history
* ci: Make sure all repos are using the same lint config

* ci: set lint config

* fix: lint path

* ci: fix lint
  • Loading branch information
levisingularity authored Aug 19, 2024
1 parent 470c36f commit 732d297
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .black.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[black]
line-length = 100
target-version = ['py37']
skip-string-normalization = true
3 changes: 3 additions & 0 deletions .flake8.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
show-source = true
extend-ignore = E501
16 changes: 16 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 5 additions & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[isort]
multi_line_output=3
force_grid_wrap=0
use_parentheses=True
line_length=100
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
Expand Down

0 comments on commit 732d297

Please sign in to comment.