dbt-labs / dbt-postgres

Apache License 2.0
22 stars 12 forks source link

Add and configure `pre-commit` #62

Closed mikealfare closed 5 months ago

mikealfare commented 5 months ago

Problem / Solution

We need to setup pre-commit. This PR also addresses the resulting violations.

### Acceptance Criteria
- [ ] `pre-commit` is configured with built-in hooks that are used in other adapter repos
- [ ] `pre-commit` is configured to run `black`, `flake8`, and `mypy` using the configurations in `pyproject.toml`
- [ ] `pre-commit` can be installed via `hatch`
- [ ] GHA workflows that run code quality checks, or use `pre-commit` in other ways (e.g. to tidy up the changelog on release) are updated so they work properly
### Tasks
- [x] Add `pre-commit` as a dev dependency
- [x] Add a `.pre-commit-config.yaml` file that uses the `local` repo so that the config in `pyproject.toml` gets used everywhere
- [x] Add a command `hatch run dev` that will instantiate the dev environment and install `pre-commit` hooks
- [x] Combine `default`, `lint`, and `typecheck` `hatch` environments into the `hatch` `default` environment
- [x] Update `code-quality` workflow to run all code quality at once instead of as separate steps
- [x] Run `pre-commit` (by running `hatch run code-quality`) to trigger updates so that CI passes
- [x] Remove offending tests that don't pass code-quality, but which also don't belong in `dbt-postgres` and which belong in `dbt-core` instead

Checklist