Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[das#75] Make sure all repos are using the same lint config #136

Merged
merged 4 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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