Skip to content

Commit

Permalink
feat: yamllint to ensure yaml linting (opentargets#338)
Browse files Browse the repository at this point in the history
* feat: yamllint support

* feat: updates yamllint rules
  • Loading branch information
d0choa authored Dec 14, 2023
1 parent e275a83 commit 1b35c99
Show file tree
Hide file tree
Showing 12 changed files with 128 additions and 44 deletions.
7 changes: 2 additions & 5 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
version: 2
updates:
- package-ecosystem: "pip" # See documentation for possible values
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Checks

on: [push]
"on":
push:

jobs:
test:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/prerelease.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
name: Test & pre-release

on:
"on":
push:
branches:
- release/*
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Release and Documentation

on:
"on":
push:
branches:
- main
Expand Down
61 changes: 34 additions & 27 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.6
hooks:
- id: ruff
args:
- --fix
- id: ruff-format
files: ^((otg|utils|tests)/.+)?[^/]+\.py$

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
Expand All @@ -8,11 +17,20 @@ repos:
- id: check-merge-conflict
- id: check-case-conflict
- id: check-json
exclude: (.vscode|.devcontainer)
- id: no-commit-to-branch
args:
- --branch=dev
- --branch=main
- id: check-toml
- id: check-yaml
- id: check-ast
- id: debug-statements
- id: check-docstring-first
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.32.0
hooks:
- id: yamllint

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
Expand All @@ -27,14 +45,12 @@ repos:
- id: pycln
args: [--all]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.6
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.0.3"
hooks:
- id: ruff
args:
- --fix
- id: ruff-format
files: ^((otg|utils|tests)/.+)?[^/]+\.py$
- id: prettier
args: ["--staged"]

- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v9.10.0
hooks:
Expand All @@ -46,20 +62,17 @@ repos:
rev: "v1.7.1"
hooks:
- id: mypy
args: [
# --ignore-missing-imports is required to run mypy on virtual
# environments without installed dependencies
"--ignore-missing-imports",
"--check-untyped-defs",
"--disallow-any-generics",
"--disallow-incomplete-defs",
"--no-implicit-optional",
"--no-implicit-reexport",
"--strict-equality",
"--warn-redundant-casts",
"--warn-unused-ignores",
"--disallow-untyped-defs",
]
args:
- "--ignore-missing-imports"
- "--check-untyped-defs"
- "--disallow-any-generics"
- "--disallow-incomplete-defs"
- "--no-implicit-optional"
- "--no-implicit-reexport"
- "--strict-equality"
- "--warn-redundant-casts"
- "--warn-unused-ignores"
- "--disallow-untyped-defs"

- repo: https://github.com/econchick/interrogate
rev: 1.5.0
Expand All @@ -82,9 +95,3 @@ repos:
rev: 0.3.8
hooks:
- id: pydoclint

- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.0.3"
hooks:
- id: prettier
args: ["--staged"]
4 changes: 3 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"charliermarsh.ruff",
"ms-python.mypy-type-checker",
"ms-python.python",
"esbenp.prettier-vscode"
"esbenp.prettier-vscode",
"redhat.vscode-yaml",
"fnando.linter"
],
"unwantedRecommendations": ["ms-python.flake8"]
}
6 changes: 3 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": false,
"source.organizeImports": true
"source.fixAll": "never",
"source.organizeImports": "explicit"
}
},
"python.terminal.launchArgs": ["-m", "IPython", "--no-autoindent"],
Expand All @@ -15,7 +15,7 @@
"editor.detectIndentation": false,
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
"source.organizeImports": "explicit"
}
},
"json.format.keepLines": true,
Expand Down
59 changes: 59 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
rules:
braces:
level: error
min-spaces-inside: 0
max-spaces-inside: 1
min-spaces-inside-empty: -1
max-spaces-inside-empty: -1
brackets:
level: error
min-spaces-inside: 0
max-spaces-inside: 0
min-spaces-inside-empty: -1
max-spaces-inside-empty: -1
colons:
level: error
max-spaces-before: 0
max-spaces-after: 1
commas:
level: error
max-spaces-before: 0
min-spaces-after: 1
max-spaces-after: 1
comments:
level: error
require-starting-space: true
min-spaces-from-content: 1
comments-indentation:
level: error
document-end:
level: error
present: false
document-start:
level: error
present: false
empty-lines:
level: error
max: 1
max-start: 0
max-end: 1
hyphens:
level: error
max-spaces-after: 1
indentation:
level: error
spaces: 2
indent-sequences: true
check-multi-line-strings: false
key-duplicates:
level: error
line-length: disable
new-line-at-end-of-file:
level: error
new-lines:
level: error
type: unix
trailing-spaces:
level: error
truthy:
level: error
3 changes: 2 additions & 1 deletion config/datasets/gcp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ jung: gs://genetics-portal-raw/pchic_jung2019/jung2019_pchic_tableS3.csv
thurman: gs://genetics-portal-input/v2g_input/thurman2012/genomewideCorrs_above0.7_promoterPlusMinus500kb_withGeneNames_32celltypeCategories.bed8.gz
catalog_associations: ${datasets.inputs}/v2d/gwas_catalog_v1.0.2-associations_e110_r2023-11-24.tsv
catalog_studies:
# To get a complete representation of all GWAS Catalog studies, we need to ingest the list of unpublished studies from a different file.
# To get a complete representation of all GWAS Catalog studies, we need to
# ingest the list of unpublished studies from a different file.
- ${datasets.inputs}/v2d/gwas-catalog-v1.0.3-studies-r2023-11-24.tsv
- ${datasets.inputs}/v2d/gwas-catalog-v1.0.3-unpublished-studies-r2023-11-24.tsv
catalog_ancestries:
Expand Down
22 changes: 20 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ pydoclint = "^0.3.8"
prettier = "^0.0.7"
deptry = "^0.12.0"
python-semantic-release = "^8.3.0"
yamllint = "^1.33.0"

[tool.semantic_release.branches.prerelease]
match = "(release/*)"
Expand Down
1 change: 0 additions & 1 deletion src/airflow/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
# Default: ''
#
# Feel free to modify this file to suit your needs.
---
version: "3.8"
x-airflow-common: &airflow-common
# In order to add custom dependencies or upgrade provider packages you can use your extended image.
Expand Down

0 comments on commit 1b35c99

Please sign in to comment.