dandi / dandi-archive

DANDI API server and Web app
https://dandiarchive.org
13 stars 10 forks source link

Add/use pre-commit to automate/formalize expectations on code formatting etc #1939

Open yarikoptic opened 1 month ago

yarikoptic commented 1 month ago

I got a CI (lint) fail for

so I had to (re)discover that ruff is used to state its expectations on code formatting.

In dandi-cli we intensively use pre-commit to automate imposing of the assumptions/conventions on the code, please see the hooks we enabled in https://github.com/dandi/dandi-cli/blob/master/.pre-commit-config.yaml .

What do you @dandi/archive-maintainers and @dandi/dandiarchive at large think if we start to formalize statement of our expectations if not to total uniformity of configuration and tools we use across different components, but at least to how we automate their triggering across components via pre-commit?

CodyCBakerPhD commented 1 month ago

+1

We love using pre-commit on the CN side of things, we even use the pre-commit bot in place of ruff to automatically push back simple changes (instead of simple CI failure) just in case someone forgot to run pre-commit locally first

We also love using prettier (JS/TS equivalent of black) on the NWB GUIDE - pre-commit hook for prettier - config for prettier