From 9f10432292b8f8716eb722f5d95814884637040d Mon Sep 17 00:00:00 2001 From: Liam Mulhall Date: Wed, 3 Jul 2024 10:48:10 -0700 Subject: [PATCH 1/2] ci: Make CI fail if code isn't formatted properly To test this, I improperly formatted `tasks.py`. I expect CI to fail. For: https://github.com/ClinGen/stanford-affils/issues/60 --- .github/workflows/check.yml | 2 +- tasks.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 51d12db..511656c 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -24,7 +24,7 @@ jobs: - name: seed the database run: pipenv run invoke dbseed - name: format - run: pipenv run invoke fmt + run: pipenv run invoke fmtcheck - name: lint run: pipenv run invoke lint - name: check types diff --git a/tasks.py b/tasks.py index 27a75ea..c3ae647 100644 --- a/tasks.py +++ b/tasks.py @@ -32,6 +32,11 @@ def fmt(c): c.run("mdformat README.md") c.run("mdformat doc") +@task +def fmtcheck(c): + """Checks if the code is formatted properly.""" + c.run("black --check .") + @task def lint(c): From 6620cda8e02ad09c759d1f8de5208c278985624f Mon Sep 17 00:00:00 2001 From: Liam Mulhall Date: Tue, 8 Oct 2024 12:37:50 -0700 Subject: [PATCH 2/2] Revert file so that it is formatted properly --- tasks.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tasks.py b/tasks.py index d26bbc6..d9ec719 100644 --- a/tasks.py +++ b/tasks.py @@ -34,6 +34,7 @@ def fmt(c): c.run("mdformat README.md") c.run("mdformat doc") + @task def fmtcheck(c): """Checks if the code is formatted properly."""