Fix #2052: Revert the reverted pre-commit (#2053)

This commit is contained in:
Alberto Miorin 2022-01-07 03:53:21 +01:00 committed by GitHub
parent dee7cd7717
commit 34a9d31240
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 39 additions and 20 deletions

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

@ -0,0 +1,31 @@
repos:
- repo: https://github.com/ambv/black
rev: 21.12b0
hooks:
- id: black
language_version: python3.8
exclude: ingestion/src/metadata/generated
- repo: https://github.com/timothycrosley/isort
rev: 5.9.3
hooks:
- id: isort
args: ["--profile", "black"]
exclude: ingestion/src/metadata/generated
- repo: local
hooks:
- id: google-style-java
name: Google Java Code Style for Java
description: Formats code in Google's Java codestyle with 120 line length.
entry: scripts/format-code.sh
language: script
files: \.java$
require_serial: true
- repo: local
hooks:
- id: lint-staged
name: lint-staged
description: Formats TS and JS code.
entry: scripts/lint-staged.sh
language: script
files: \.(js|jsx|ts|tsx)$
require_serial: true

View File

@ -19,7 +19,7 @@ install_dev:
precommit_install:
@echo "Installing pre-commit hooks"
@echo "Make sure to first run `make install_test`"
pre-commit install --config ingestion/.pre-commit-config.yaml
pre-commit install
isort:
isort $(PY_SOURCE) --skip $(PY_SOURCE)/metadata/generated --profile black --multi-line 3

View File

@ -1,13 +0,0 @@
repos:
- repo: https://github.com/ambv/black
rev: stable
hooks:
- id: black
language_version: python3.8
exclude: ingestion/src/metadata/generated
- repo: https://github.com/timothycrosley/isort
rev: 5.9.3
hooks:
- id: isort
args: ["--profile", "black"]
exclude: ingestion/src/metadata/generated

View File

@ -1,5 +0,0 @@
{
"hooks": {
"pre-commit": "lint-staged --concurrent false"
}
}

View File

@ -140,7 +140,6 @@
"file-loader": "4.3.0",
"fork-ts-checker-webpack-plugin": "^6.0.8",
"html-webpack-plugin": "^4.5.1",
"husky": "^4.3.0",
"jest": "^26.6.3",
"jest-environment-jsdom-fourteen": "^1.0.1",
"lint-staged": "^10.3.0",

3
scripts/format-code.sh Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env sh
mvn googleformatter:format@reformat-sources

4
scripts/lint-staged.sh Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env sh
cd openmetadata-ui/src/main/resources/ui
npx lint-staged --concurrent false