From 6c9e87f959e52876d4e7f8fe26524863daffcad1 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Mon, 14 Oct 2024 22:46:43 -0400 Subject: [PATCH 1/2] Add rudimentary pre-commit with codespell and ruff check and formatting Closes #1939 --- .pre-commit-config.yaml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 000000000..a9ac085fb --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,23 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +exclude: (^\.codespellrc|yarn.lock) +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files +- repo: https://github.com/codespell-project/codespell + rev: v2.3.0 + hooks: + - id: codespell +- repo: https://github.com/astral-sh/ruff-pre-commit + # Ruff version. + rev: v0.6.9 + hooks: + # Run the linter. + - id: ruff + # Run the formatter. + - id: ruff-format From ad5b04e1c564b22abdb771d6dead5c44d4304c45 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Mon, 14 Oct 2024 22:50:48 -0400 Subject: [PATCH 2/2] Run pre-commit run --all and save the results --- .../api/templates/api/mail/dandiset_unembargo_failed.html | 2 +- doc/design/audit-trail-mvp.md | 4 ++-- doc/design/deployment-1.md | 2 +- doc/design/embargo-full.md | 2 +- doc/design/garbage-collection-1.md | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dandiapi/api/templates/api/mail/dandiset_unembargo_failed.html b/dandiapi/api/templates/api/mail/dandiset_unembargo_failed.html index 7a4b1356c..648e7ba2c 100644 --- a/dandiapi/api/templates/api/mail/dandiset_unembargo_failed.html +++ b/dandiapi/api/templates/api/mail/dandiset_unembargo_failed.html @@ -4,4 +4,4 @@ dandiset in the meantime, as that may hinder or delay the process of resolving this issue. If in two business days your dandiset is still embargoed, please reply to this email.


-You are receiving this email because you are an owner of this dandiset. \ No newline at end of file +You are receiving this email because you are an owner of this dandiset. diff --git a/doc/design/audit-trail-mvp.md b/doc/design/audit-trail-mvp.md index 1b3c980af..8ee27b3da 100644 --- a/doc/design/audit-trail-mvp.md +++ b/doc/design/audit-trail-mvp.md @@ -32,14 +32,14 @@ at https://github.com/dandisets. A possible example of such a display follows (the final rendered form may differ from this depending on best practices, etc.): - + ``` YYYYMMDDTHHMMSS.mmmm: X added asset at path (/full/path) checksum YYYYMMDDTHHMMSS.mmmm: X updated asset at path (/full/path) checksum YYYYMMDDTHHMMSS.mmmm: X removed asset at path (/full/path) checksum YYYYMMDDTHHMMSS.mmmm: X updated dandiset metadata ``` - + 3. **Extensible significant action list.** The significant actions the system is capable of tracking should be extensible--that is, in the future new actions should be able to be added to the system, and existing actions should be able diff --git a/doc/design/deployment-1.md b/doc/design/deployment-1.md index c78e75411..c7eb46981 100644 --- a/doc/design/deployment-1.md +++ b/doc/design/deployment-1.md @@ -7,7 +7,7 @@ The staging Netlify site is deployed automatically from `master`. The production The staging and production Heroku apps are deployed manually from a GitHub CI workflow using a GitHub action. -Netlify and Heroku can deploy themselves automatically from a branch, but not from a release tag. This means we need to deploy manually from GitHub CI, which is quite complex and not ideal. Additionally, Netlify does not support multiple `netlify.toml` configuration files in a single project directory, which means the deployment CI step deletes the `netlify.toml` in the production deployment and specifies the environment with the Netlify CLI instead. +Netlify and Heroku can deploy themselves automatically from a branch, but not from a release tag. This means we need to deploy manually from GitHub CI, which is quite complex and not ideal. Additionally, Netlify does not support multiple `netlify.toml` configuration files in a single project directory, which means the deployment CI step deletes the `netlify.toml` in the production deployment and specifies the environment with the Netlify CLI instead. This proposed solution is to use a second `release` branch which tracks the released code. This allows us to use the automatic Netlify and Heroku deployments rather than pushing manually from GitHub CI. diff --git a/doc/design/embargo-full.md b/doc/design/embargo-full.md index 936908621..c977c7730 100644 --- a/doc/design/embargo-full.md +++ b/doc/design/embargo-full.md @@ -85,4 +85,4 @@ If this becomes an issue, we could: - email the owners of an embargoed dandiset (and admins) when it has been successfully unembargoed - on the stats page, display the full amount of data stored in the archive, and indicate how much of it is under embargo - e.g., `300 TB total data size (100 TB currently under embargo)` - - link the word "embargo" to docs/explanation thereof \ No newline at end of file + - link the word "embargo" to docs/explanation thereof diff --git a/doc/design/garbage-collection-1.md b/doc/design/garbage-collection-1.md index 4b36e27a8..64151caa2 100644 --- a/doc/design/garbage-collection-1.md +++ b/doc/design/garbage-collection-1.md @@ -58,4 +58,4 @@ The actual implementation of these operations should be added to `dandiapi.api.g After thoroughly testing the script by hand in staging/production, a Celery Beat task should be created that checks for stale data nightly. -All of these numbers should be available in the admin data dashboard so that we can independently verify that the scheduled task is working correctly. \ No newline at end of file +All of these numbers should be available in the admin data dashboard so that we can independently verify that the scheduled task is working correctly.