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

feat: add precommit #7056

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
13 changes: 13 additions & 0 deletions .azure-pipelines/precommitValidation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
jobs:
- job: "precommitValidation"
pool:
vmImage: 'ubuntu-latest'
steps:
- script: |
pip3 install pre-commit
displayName: 'Install requirements'
- script: |
pre-commit run --all-files --show-diff-on-failure
exit $RET
displayName: 'Pre-commit check - server side'
continueOnError: true
27 changes: 27 additions & 0 deletions .github/workflows/precommit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: precommit

on:
push:
pull_request:
workflow_dispatch:

permissions: {}

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- uses: pre-commit/action@v2.0.0
with:
extra_args: --all-files --show-diff-on-failure
continue-on-error: true
25 changes: 25 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-yaml
exclude: invalidFile.yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-added-large-files
args: ['--maxkb=800']
- id: check-json
types: [text]
files: \.(json|config)$
exclude: '(invalidFile.json|SkipValidationsTemplates.json|tsconfig.json|nuget.config)$'
- id: pretty-format-json
args:
- "--autofix"
- "--indent=4"
- "--no-sort-keys"
types: [text]
files: \.(json|config)$
exclude: '(invalidFile.json|SkipValidationsTemplates.json|tsconfig.json|nuget.config)$'
- id: detect-private-key
- id: check-case-conflict
- id: requirements-txt-fixer
3 changes: 2 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ jobs:
- template: .azure-pipelines/playbooksValidations.yaml
- template: .azure-pipelines/sampleDataValidator.yaml
- template: .azure-pipelines/contentValidations.yaml
- template: .azure-pipelines/callGithubWorkflow.yaml
- template: .azure-pipelines/callGithubWorkflow.yaml
- template: .azure-pipelines/precommitValidation.yaml
Loading