Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ct 177/add precommit hooks #107

Merged
merged 9 commits into from
Mar 29, 2022
Merged

Ct 177/add precommit hooks #107

merged 9 commits into from
Mar 29, 2022

Conversation

VersusFacit
Copy link
Contributor

@VersusFacit VersusFacit commented Mar 13, 2022

partially addresses #95

Description

Adds precommit hooks and tooling (e.g. a handy makefile) for this repo. A few additions to files that don't really address core logic.

Wait, why review this if it isn't passing?

This PR won't pass until we merge in all the little whitespace formatting code changes. I have those over in PR 108. The proper merge order:
1. approval of this PR (107) 🔴
2. approval of PR 108 🟢
3. merge 108 to make this PR 🟢
4. :shipit:

Background thinking

Why these changes?

  • suppressing duplicate module name errors is the best path forward
    1. mypy's import checker lacks nuance -- it doesn't allow for package overrides which this project necessarily employs when it draws both from dbt and expands the dbt package (by the fact its directories are named what they are)
    2. we can't change the directory paths easily -- I looked in this. There's too much coupling between the directory structure of this project and tooling in core
  • suppressing attribute defined and missing type hint errors is the best path forward (this type information should live with upstream modules, namely dbt if we wanted static analysis in this repository)
    1. the mypy custom stub file model puts the onus on to keep up to date with foreign modules which is work that isn't our responsibility
    2. a similar problem (by way of typed.py) affects imported libraries

Checklist

  • I have signed the CLA
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • I have updated the CHANGELOG.md and added information about my change to the "dbt-snowflake next" section.

Adding precheck manager, make tasks, workflows, and dev requirements to facilitate these workflows.
@VersusFacit VersusFacit self-assigned this Mar 13, 2022
@cla-bot cla-bot bot added the cla:yes label Mar 13, 2022
# of our control to the mix. Unfortunately, there's nothing we can
# do about per pre-commit's author.
# See https://github.com/pre-commit/pre-commit/issues/730 for details.
args: [--show-error-codes, --ignore-missing-imports]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the --ignore-missing-imports flag here to reduce in-code clutter. My argument is that all these errors tell you is that the upstream project lacks static type information, which isn't that powerful of knowledge.

@@ -18,10 +18,10 @@
InternalException, RuntimeException, FailedToConnectException,
DatabaseException, warn_or_error
)
from dbt.adapters.base import Credentials
from dbt.adapters.base import Credentials # type: ignore
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

attr-defined errors are masked by this # type: ignore declaration

@VersusFacit VersusFacit mentioned this pull request Mar 14, 2022
4 tasks
.flake8 Outdated Show resolved Hide resolved
@VersusFacit VersusFacit requested a review from gshank March 15, 2022 21:13
VersusFacit and others added 2 commits March 28, 2022 23:45
* use checks over code and rewrite repo to conform to style conventions
* Add query_id to adapter payload and tests. (#109)
* Mix in released snowflake 1.1.0b1
* Resolve a Black library issue
rev: 21.12b0
hooks:
- id: black
additional_dependencies: ['click==8.0.4']
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants