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

Adding YAML formatter #141

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions .github/workflows/changelog-entry-check.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
name: Changelog entry check

on:
pull_request:
types:
- opened
- reopened
- labeled
- unlabeled
- synchronize
pull_request:
types:
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you know why this list gets indented whereas lists in other files, e.g. pre-commit-config.yaml align the bullets with the parent node?

- opened
- reopened
- labeled
- unlabeled
- synchronize

defaults:
run:
shell: bash
run:
shell: bash

permissions:
contents: read
pull-requests: write
contents: read
pull-requests: write

jobs:
changelog-entry-check:
uses: dbt-labs/actions/.github/workflows/changelog-existence.yml@main
with:
changelog_comment: >-
Thank you for your pull request! We could not find a changelog entry for this change.
For details on how to document a change, see the
[dbt-postgres contributing guide](https://github.com/dbt-labs/dbt-postgres/blob/main/CONTRIBUTING.md).
skip_label: "Skip Changelog"
secrets: inherit
changelog-entry-check:
uses: dbt-labs/actions/.github/workflows/changelog-existence.yml@main
with:
changelog_comment: >-
Thank you for your pull request! We could not find a changelog entry for this change.
For details on how to document a change, see the
[dbt-postgres contributing guide](https://github.com/dbt-labs/dbt-postgres/blob/main/CONTRIBUTING.md).
skip_label: "Skip Changelog"
secrets: inherit
8 changes: 4 additions & 4 deletions .github/workflows/docs-issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ defaults:
shell: bash

permissions:
issues: write # comments on issues
issues: write # comments on issues

jobs:
open_issues:
Expand All @@ -35,7 +35,7 @@ jobs:
(github.event.action == 'labeled' && github.event.label.name == 'user docs'))
uses: dbt-labs/actions/.github/workflows/open-issue-in-repo.yml@main
with:
issue_repository: "dbt-labs/docs.getdbt.com"
issue_title: "Docs Changes Needed from ${{ github.event.repository.name }} Issue #${{ github.event.issue.number }}"
issue_body: "At a minimum, update body to include a link to the page on docs.getdbt.com requiring updates and what part(s) of the page you would like to see updated."
issue_repository: "dbt-labs/docs.getdbt.com"
issue_title: "Docs Changes Needed from ${{ github.event.repository.name }} Issue #${{ github.event.issue.number }}"
issue_body: "At a minimum, update body to include a link to the page on docs.getdbt.com requiring updates and what part(s) of the page you would like to see updated."
secrets: inherit
10 changes: 5 additions & 5 deletions .github/workflows/release_prep_hatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ jobs:
runs-on: ubuntu-latest
needs: release-inputs
if: |
needs.release-inputs.outputs.changelog-exists == 'false' ||
needs.release-inputs.outputs.version-is-current == 'false'
needs.release-inputs.outputs.changelog-exists == 'false' ||
needs.release-inputs.outputs.version-is-current == 'false'
outputs:
name: ${{ steps.release-branch.outputs.name }}

Expand Down Expand Up @@ -404,9 +404,9 @@ jobs:
- release-branch
- release-inputs
if: |
!failure() && !cancelled() &&
needs.release-branch.result == 'success' &&
inputs.deploy-to == 'prod'
!failure() && !cancelled() &&
needs.release-branch.result == 'success' &&
inputs.deploy-to == 'prod'

steps:
- name: "Checkout ${{ github.event.repository.name }}"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/version-bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ on:
workflow_dispatch:
inputs:
version_number:
description: 'The version number to bump to (ex. 1.2.0, 1.3.0b1)'
required: true
description: 'The version number to bump to (ex. 1.2.0, 1.3.0b1)'
required: true

jobs:
version_bump_and_changie:
Expand Down
86 changes: 46 additions & 40 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,51 +6,57 @@ repos:
rev: v4.4.0
hooks:
- id: check-yaml
args: [--unsafe]
- id: check-json
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-case-conflict

- repo: https://github.com/dbt-labs/pre-commit-hooks
rev: v0.1.0a1
hooks:
- id: dbt-core-in-adapters-check
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.14.0
hooks:
- id: pretty-format-yaml
args: [--autofix, --indent, '2', --offset, '2', --preserve-quotes]
Copy link
Contributor

Choose a reason for hiding this comment

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

We should either make this a long form list (like black's args) or make other lists short form. I think one of the formatters also had an option for enforcing that automatically.

files: ^.github/workflows

- repo: https://github.com/dbt-labs/pre-commit-hooks
rev: v0.1.0a1
hooks:
- id: dbt-core-in-adapters-check

- repo: https://github.com/psf/black
rev: 24.4.0
hooks:
- id: black
args:
- --line-length=99
- --target-version=py38
- --target-version=py39
- --target-version=py310
- --target-version=py311
- --target-version=py312
- repo: https://github.com/psf/black
rev: 24.4.0
hooks:
- id: black
args:
- --line-length=99
- --target-version=py38
- --target-version=py39
- --target-version=py310
- --target-version=py311
- --target-version=py312

- repo: https://github.com/pycqa/flake8
rev: 7.0.0
hooks:
- id: flake8
exclude: tests/
args:
- --max-line-length=99
- --select=E,F,W
- --ignore=E203,E501,E741,W503,W504
- --per-file-ignores=*/__init__.py:F401
- repo: https://github.com/pycqa/flake8
rev: 7.0.0
hooks:
- id: flake8
exclude: tests/
args:
- --max-line-length=99
- --select=E,F,W
- --ignore=E203,E501,E741,W503,W504
- --per-file-ignores=*/__init__.py:F401

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.9.0
hooks:
- id: mypy
args:
- --explicit-package-bases
- --ignore-missing-imports
- --pretty
- --show-error-codes
files: ^dbt/adapters/postgres
additional_dependencies:
- types-PyYAML
- types-protobuf
- types-pytz
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.9.0
hooks:
- id: mypy
args:
- --explicit-package-bases
- --ignore-missing-imports
- --pretty
- --show-error-codes
files: ^dbt/adapters/postgres
additional_dependencies:
- types-PyYAML
- types-protobuf
- types-pytz
Loading