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

Fix failing pre-commit hook mypy-python #952

Closed
2 tasks
tatiana opened this issue May 10, 2024 · 0 comments · Fixed by #957
Closed
2 tasks

Fix failing pre-commit hook mypy-python #952

tatiana opened this issue May 10, 2024 · 0 comments · Fixed by #957
Assignees

Comments

@tatiana
Copy link
Collaborator

tatiana commented May 10, 2024

Context

If we run

$ pre-commit run --all-files

We currently get:

Check if .env file is empty...................................................Passed
check for added large files...................................................Passed
check for merge conflicts.....................................................Passed
check toml....................................................................Passed
check yaml....................................................................Passed
debug statements (python).....................................................Passed
fix end of files..............................................................Passed
mixed line ending.............................................................Passed
pretty format json............................................................Passed
trim trailing whitespace......................................................Passed
Run codespell to check for common misspellings in files.......................Passed
rst ``code`` is two backticks.................................................Passed
check for not-real mock methods...............................................Passed
CRLF end-lines remover........................................................Passed
Tabs remover..................................................................Passed
pyupgrade.....................................................................Passed
ruff..........................................................................Passed
black.........................................................................Passed
blacken-docs..................................................................Passed
mypy-python...................................................................Failed
- hook id: mypy
- exit code: 1

cosmos/profiles/base.py:45: error: "DbtProfileConfigVars" has no attribute "__dataclass_fields__"  [attr-defined]
cosmos/operators/local.py:228: error: Item "None" of "BaseOperator | MappedOperator | None" has no attribute "template_fields"  [union-attr]
Found 2 errors in 2 files (checked 65 source files)

Acceptance criteria

  • Pre commit checks should pass
  • Understand/fix why this check is being skipped in the CI
@pankajastro pankajastro self-assigned this May 13, 2024
tatiana pushed a commit that referenced this issue May 14, 2024
closes: #952

This PR addresses the following issues:

**1. Pre-commit Setup:**
- Pre-commit was not running in the CI pipeline because it was neither
configured for this repository nor were we using the pre-commit command
in CI to run it manually. To fix this:
Installed and added pre-commit to this repository. This allows
pre-commit to automatically run the pre-commit configuration on every
push.

**2. Type Check Job:**
- Previously, the type-check job was running with mypy directly, and the
pre-commit type check command had different configurations. This PR
aligns the configurations.

**3. Type Check Fixes:**
- Ignored the type check for __dataclass_fields__ since mypy seems to
not recognize it.
- Added a check for None for ti.task
chris-okorodudu pushed a commit to chris-okorodudu/astronomer-cosmos that referenced this issue May 15, 2024
closes: astronomer#952

This PR addresses the following issues:

**1. Pre-commit Setup:**
- Pre-commit was not running in the CI pipeline because it was neither
configured for this repository nor were we using the pre-commit command
in CI to run it manually. To fix this:
Installed and added pre-commit to this repository. This allows
pre-commit to automatically run the pre-commit configuration on every
push.

**2. Type Check Job:**
- Previously, the type-check job was running with mypy directly, and the
pre-commit type check command had different configurations. This PR
aligns the configurations.

**3. Type Check Fixes:**
- Ignored the type check for __dataclass_fields__ since mypy seems to
not recognize it.
- Added a check for None for ti.task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants