Enable pre-commit

This commit is contained in:
Sorin Sbarnea 2021-01-12 13:17:16 +00:00
parent a16383a13f
commit 9c781e7937
4 changed files with 56 additions and 1 deletions

14
.github/workflows/pre-commit.yml vendored Normal file
View File

@ -0,0 +1,14 @@
name: pre-commit
on:
pull_request:
push:
branches: [master]
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: pre-commit/action@v2.0.0

25
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,25 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks.git
rev: v3.4.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- id: mixed-line-ending
- id: check-byte-order-marker
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: debug-statements
language_version: python3
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.25.0
hooks:
- id: yamllint
files: \.(yaml|yml)$
types: [file, yaml]
entry: yamllint --strict
- id: yamllint
name: queries-key-ordering
files: src\/data\/queries\.yml$
entry: >
yamllint --strict -d "rules: { key-ordering: enable }"

16
.yamllint.yaml Normal file
View File

@ -0,0 +1,16 @@
extends: default
ignore: |
.tox
src/data/sova-patterns.yml
rules:
braces:
max-spaces-inside: 1
level: error
brackets:
max-spaces-inside: 1
level: error
document-start: disable
line-length: disable
truthy:
check-keys: false

View File

@ -5,7 +5,7 @@
uri:
url: https://raw.githubusercontent.com/rdo-infra/queries/main/build/queries.json
method: GET
return_content: yes
return_content: true
status_code: 200
body_format: json
register: data