Skip to content

Commit

Permalink
[tooling] Apply Python lint & formatting to entire repo (#272)
Browse files Browse the repository at this point in the history
* Apply Python lint & formatting to entire repo

* Remove null monitorlib test

* Remove dependency

* Remove reference to removed target
  • Loading branch information
BenjaminPelletier authored Oct 20, 2023
1 parent 9753ad1 commit 929197c
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 71 deletions.
11 changes: 1 addition & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,6 @@ jobs:
- name: Shell lint
run: make shell-lint

monitorlib-test:
name: monitorlib tests
uses: ./.github/workflows/monitoring-test.yml
with:
name: monitorlib
script: |
cd monitoring/monitorlib
make test
mock_uss-test:
name: mock_uss tests
uses: ./.github/workflows/monitoring-test.yml
Expand Down Expand Up @@ -71,7 +62,7 @@ jobs:
publish-gh-pages:
name: Publish GitHub Pages
needs: [hygiene-tests, monitorlib-test, mock_uss-test, uss_qualifier-test, prober-test]
needs: [hygiene-tests, mock_uss-test, uss_qualifier-test, prober-test]
if: ${{ always() && contains(join(needs.*.result, ','), 'success') }}
runs-on: ubuntu-latest
permissions:
Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ endif

.PHONY: format
format: json-schema
docker run --rm -v "$(CURDIR):/code" -w /code pyfound/black:22.10.0 black --exclude /interfaces .
cd monitoring && make format

.PHONY: lint
lint: shell-lint
lint: shell-lint python-lint
cd monitoring && make lint
cd schemas && make lint

Expand All @@ -23,7 +24,7 @@ check-hygiene: python-lint hygiene validate-uss-qualifier-docs shell-lint

.PHONY: python-lint
python-lint:
cd monitoring && make python-lint
docker run --rm -v "$(CURDIR):/code" -w /code pyfound/black:22.10.0 black --check --exclude /interfaces . || (echo "Linter didn't succeed. You can use the following command to fix python linter issues: make format" && exit 1)

.PHONY: hygiene
hygiene:
Expand Down
14 changes: 0 additions & 14 deletions monitoring/Makefile
Original file line number Diff line number Diff line change
@@ -1,31 +1,17 @@
.PHONY: lint
lint:
cd uss_qualifier && make lint
cd mock_uss && make lint
cd monitorlib && make lint
cd prober && make lint

.PHONY: python-lint
python-lint:
cd uss_qualifier && make python-lint
cd mock_uss && make python-lint
cd monitorlib && make python-lint
cd prober && make python-lint

.PHONY: format
format:
cd uss_qualifier && make format
cd mock_uss && make format
cd monitorlib && make format
cd prober && make format

.PHONY: build
build:
./build.sh

.PHONY: test
test:
cd monitorlib && make test
cd mock_uss && make test
cd uss_qualifier && make test
cd prober && make test
14 changes: 1 addition & 13 deletions monitoring/mock_uss/Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
.PHONY: lint
lint: python-lint
echo "mock_uss lint complete"

.PHONY: python-lint
python-lint:
docker run --rm -v "$(CURDIR):/code" -w /code pyfound/black:22.10.0 black --check . || (echo "Linter didn't succeed. You can use the following command to fix python linter issues: make format" && exit 1)

.PHONY: format
format:
docker run --rm -v "$(CURDIR):/code" -w /code pyfound/black:22.10.0 black .

.PHONY: test
test: lint
test:
./run_locally_test_geoawareness.sh
13 changes: 0 additions & 13 deletions monitoring/monitorlib/Makefile

This file was deleted.

11 changes: 0 additions & 11 deletions monitoring/prober/Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
.PHONY: lint
lint: python-lint

.PHONY: python-lint
python-lint:
docker run --rm -v "$(CURDIR):/code" -w /code pyfound/black:22.10.0 black --check . || (echo "Linter didn't succeed. You can use the following command to fix python linter issues: make format" && exit 1)

.PHONY: format
format:
docker run --rm -v "$(CURDIR):/code" -w /code pyfound/black:22.10.0 black .

.PHONY: test
test:
./scripts/test_docker_fully_mocked.sh
7 changes: 1 addition & 6 deletions monitoring/uss_qualifier/Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
.PHONY: lint
lint: validate-docs python-lint
lint: validate-docs

.PHONY: validate-docs
validate-docs:
./scripts/validate_test_definitions.sh
./scripts/format_test_suite_docs.sh --lint

.PHONY: python-lint
python-lint:
docker run --rm -v "$(CURDIR):/code" -w /code pyfound/black:22.10.0 black --check . || (echo "Linter didn't succeed. You can use the following command to fix python linter issues: make format" && exit 1)

.PHONY: format
format: format-documentation
docker run --rm -v "$(CURDIR):/code" -w /code pyfound/black:22.10.0 black .

.PHONY: format-documentation
format-documentation:
Expand Down
2 changes: 0 additions & 2 deletions schemas/Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
.PHONY: format
format:
docker run --rm -v "$(CURDIR):/code" -w /code pyfound/black:22.10.0 black .
./manage_type_schemas.sh --generate

.PHONY: lint
lint:
docker run --rm -v "$(CURDIR):/code" -w /code pyfound/black:22.10.0 black --check . || (echo "Linter didn't succeed. You can use the following command to fix python linter issues: make format" && exit 1)
./manage_type_schemas.sh --check

0 comments on commit 929197c

Please sign in to comment.