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

Pre commit #1592

Merged
merged 5 commits into from
Aug 29, 2024
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ jobs:
- name: Install & Lint
run: |
npm install -g pnpm
pnpm install --no-frozen-lockfile
pnpm install --no-frozen-lockfile --ignore-scripts
pnpm run type-check

frontend-check:
Expand All @@ -189,7 +189,7 @@ jobs:
- name: Install & Lint
run: |
npm install -g pnpm
pnpm install --no-frozen-lockfile
pnpm install --no-frozen-lockfile --ignore-scripts
pnpm lint
- name: Audit for vulnerabilities
run: pnpm dlx audit-ci@^6 --critical --report-type full
Expand Down
63 changes: 44 additions & 19 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,66 +5,92 @@ repos:
hooks:
- id: eslint
name: ESLint
entry: cd frontend && npm run lint
entry: sh -c 'cd frontend && npm run lint'
language: system
stages:
- pre-commit
- id: ts-check
name: TSC check
entry: cd frontend && tsc-files --noEmit
- id: ts-file-check
name: TSC file check
entry: sh -c 'cd frontend && npm run tsc-file-check'
language: system
stages:
- pre-commit
- id: ts-type-check
name: TS type check
entry: cd frontend && npm run type-check
entry: sh -c 'cd frontend && npm run type-check'
language: system
stages:
- pre-commit
- id: px-check
name: px check
entry: ./ops/check.sh px
language: script
stages:
- pre-commit
- id: rgba-check
name: rgba check
entry: ./ops/check.sh rgba
language: script
stages:
- pre-commit
- id: hex-check
name: hex check
entry: ./ops/check.sh hex
language: script
stages:
- pre-commit
- id: prettier
name: Prettier
entry: cd frontend && npx prettier --write . --ignore-unknown
entry: sh -c 'cd frontend && npx prettier --check .'
language: system
stages:
- pre-commit
- id: test-check
name: Test coverage for the whole project
entry: cd frontend && pnpm run coverage:silent
entry: sh -c 'cd frontend && pnpm run coverage:silent'
language: system
pass_filenames: false
require_serial: true
stages:
- pre-push
- id: audit-check
name: Vulnerability check
entry: cd frontend && pnpm run audit
entry: sh -c 'cd frontend && pnpm run audit'
language: system
pass_filenames: false
stages:
- pre-push
- id: license-check
name: License compliance check
entry: cd frontend && pnpm run license-compliance
entry: sh -c 'cd frontend && pnpm run license-compliance'
language: system
pass_filenames: false
stages:
- pre-push
- id: tag-check
name: tag check
entry: ./frontend/scripts/git-hooks/pre-tag.sh
entry: ./ops/git-hooks/pre-tag.sh
language: script
stages:
- commit-msg
- pre-push
- id: check-building-for-frontend
name: Check for building
entry: cd frontend && pnpm run build
language: system
name: Check building for frontend
entry: ./ops/git-hooks/build-check.sh frontend
files: ^frontend/
language: script
pass_filenames: false
require_serial: true
stages:
- pre-push
- id: check-building-for-backend
name: Check for building
entry: cd backend && ./gradlew clean check
language: system
name: Check building for backend
entry: ./ops/git-hooks/build-check.sh backend
files: ^backend/
language: script
pass_filenames: false
require_serial: true
stages:
- pre-push

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
Expand All @@ -75,10 +101,9 @@ repos:
- id: trailing-whitespace
- id: check-json
- repo: https://github.com/koalaman/shellcheck-precommit
rev: v0.7.2
rev: v0.10.0
hooks:
- id: shellcheck
exclude: frontend/.husky
- repo: https://github.com/gitleaks/gitleaks
rev: v8.18.4
hooks:
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,8 @@ For now, we just can download the code in our local machine, please follow below

# 6 Run Heartbeat

> This project runs git hooks via [pre-commit](https://pre-commit.com/), please install it before next steps

## 6.1 How to run frontend

```
Expand Down
2 changes: 1 addition & 1 deletion backend/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
4 changes: 0 additions & 4 deletions frontend/.husky/pre-commit

This file was deleted.

5 changes: 0 additions & 5 deletions frontend/.husky/pre-push

This file was deleted.

13 changes: 0 additions & 13 deletions frontend/.husky/pre-tag

This file was deleted.

8 changes: 7 additions & 1 deletion frontend/audit-ci.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,11 @@
// $schema provides code completion hints to IDEs.
"$schema": "https://github.com/IBM/audit-ci/raw/main/docs/schema.json",
"moderate": true,
"allowlist": ["@adobe/css-tools"],
"allowlist": [
"@adobe/css-tools",
"GHSA-grv7-fg5c-xmjg",
"GHSA-3h5v-q93c-6h6q",
"GHSA-8hc4-vh64-cxmj",
"GHSA-952p-6rrq-rcjv",
],
}
12 changes: 2 additions & 10 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,11 @@
"e2e:updateSnapshots-docker": "docker run --rm --network=host -e APP_ORIGIN='http://host.docker.internal:4321' -v $(pwd)/e2e:/app/e2e -w /app -it heartbeat_e2e:latest pnpm run e2e:updateSnapshots",
"env:local": "dotenvx run --env-file=./e2e/.env.local --",
"env:ci": "dotenvx run --env-file=./e2e/.env.ci --",
"prepare": "cd .. && husky install frontend/.husky",
"postinstall": "pre-commit install",
"license-compliance": "license-compliance -r detailed",
"tsc-file-check": "tsc-files --noEmit",
"type-check": "tsc --noEmit"
},
"lint-staged": {
"**/*.(ts|tsx)": [
"npm run lint",
"tsc-files --noEmit",
"npx prettier --write . --ignore-unknown"
]
},
"dependencies": {
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.5",
Expand Down Expand Up @@ -102,12 +96,10 @@
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.6.2",
"execa": "^8.0.1",
"husky": "^9.0.11",
"identity-obj-proxy": "^3.0.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"license-compliance": "^3.0.0",
"lint-staged": "^15.2.2",
"msw": "^2.2.14",
"node-fetch": "^3.3.2",
"prettier": "3.2.5",
Expand Down
Loading
Loading