mirror of
https://github.com/SigNoz/signoz.git
synced 2026-11-13 03:41:20 +00:00
Compare commits
9 Commits
fix/safe-n
...
ns/githook
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a8c48fe9cd | ||
|
|
31c342c2e5 | ||
|
|
773453f104 | ||
|
|
eff31a0180 | ||
|
|
e7b8ec2a00 | ||
|
|
3c6c700a73 | ||
|
|
872194dbee | ||
|
|
bfaac7a7cc | ||
|
|
f1010908db |
@@ -1,4 +1,12 @@
|
||||
cd frontend && pnpm run commitlint --edit $1
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
msg_file="$(cd "$(dirname "$1")" && pwd)/$(basename "$1")"
|
||||
|
||||
if [ -d frontend/node_modules ] && command -v pnpm >/dev/null 2>&1; then
|
||||
(cd frontend && pnpm exec commitlint --edit "$msg_file")
|
||||
fi
|
||||
|
||||
branch="$(git rev-parse --abbrev-ref HEAD)"
|
||||
|
||||
33
.githooks/pre-commit
Executable file
33
.githooks/pre-commit
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
IFS='
|
||||
'
|
||||
|
||||
go_files=$(git diff --cached --name-only --diff-filter=ACM -- '*.go')
|
||||
if [ -n "$go_files" ] && command -v gofmt >/dev/null 2>&1; then
|
||||
partially_staged=""
|
||||
for f in $go_files; do
|
||||
[ -n "$(git show ":$f" | gofmt -l)" ] || continue
|
||||
if git diff --quiet -- "$f"; then
|
||||
gofmt -w "$f"
|
||||
git add -- "$f"
|
||||
else
|
||||
partially_staged="$partially_staged
|
||||
$f"
|
||||
fi
|
||||
done
|
||||
if [ -n "$partially_staged" ]; then
|
||||
echo "pre-commit: unformatted and partially staged, run gofmt -w and restage:$partially_staged" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$(git diff --cached --name-only --diff-filter=ACM -- frontend/)" ]; then
|
||||
if [ ! -d frontend/node_modules ] || ! command -v pnpm >/dev/null 2>&1; then
|
||||
echo "pre-commit: frontend changes need dependencies, run: cd frontend && pnpm install" >&2
|
||||
exit 1
|
||||
fi
|
||||
(cd frontend && pnpm exec lint-staged)
|
||||
fi
|
||||
25
.github/workflows/prtitleci.yaml
vendored
Normal file
25
.github/workflows/prtitleci.yaml
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
name: prtitleci
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- edited
|
||||
- synchronize
|
||||
- reopened
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: read
|
||||
steps:
|
||||
- name: check
|
||||
uses: amannn/action-semantic-pull-request@v6.1.1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
subjectPattern: ^(?![A-Z]).+$
|
||||
subjectPatternError: The subject "{subject}" must not start with an uppercase letter.
|
||||
4
Makefile
4
Makefile
@@ -48,6 +48,10 @@ $(TARGET_DIR):
|
||||
help: ## Displays help.
|
||||
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n\nTargets:\n"} /^[a-z0-9A-Z_-]+:.*?##/ { printf " \033[36m%-40s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST)
|
||||
|
||||
.PHONY: hooks
|
||||
hooks: ## Installs the git hooks from .githooks
|
||||
@git config core.hooksPath .githooks
|
||||
|
||||
##############################################################
|
||||
# devenv commands
|
||||
##############################################################
|
||||
|
||||
@@ -36,6 +36,10 @@ Before diving in, make sure you have these tools installed:
|
||||
```bash
|
||||
cd signoz
|
||||
```
|
||||
4. Install the git hooks (formatting, linting and commit message checks), once per clone:
|
||||
```bash
|
||||
make hooks
|
||||
```
|
||||
|
||||
## How do I run it locally?
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
cd frontend && pnpm lint-staged
|
||||
@@ -24,8 +24,7 @@
|
||||
"jest": "jest",
|
||||
"jest:coverage": "jest --coverage",
|
||||
"jest:watch": "jest --watch",
|
||||
"postinstall": "pnpm i18n:generate-hash && ([ -n \"$CI\" ] || pnpm husky:configure) && node scripts/update-registry.cjs",
|
||||
"husky:configure": "cd .. && husky frontend/.husky",
|
||||
"postinstall": "pnpm i18n:generate-hash && ([ -n \"$CI\" ] || git config core.hooksPath .githooks || true) && node scripts/update-registry.cjs",
|
||||
"commitlint": "commitlint --edit $1",
|
||||
"test": "jest",
|
||||
"test:changedsince": "jest --changedSince=main --coverage --silent",
|
||||
@@ -190,7 +189,6 @@
|
||||
"@types/testing-library__jest-dom": "^5.14.5",
|
||||
"@typescript/native-preview": "7.0.0-dev.20260430.1",
|
||||
"eslint-plugin-sonarjs": "4.0.2",
|
||||
"husky": "^9.1.7",
|
||||
"jest-environment-jsdom": "29.7.0",
|
||||
"jest-styled-components": "^7.2.0",
|
||||
"json-schema-to-typescript": "^15.0.4",
|
||||
|
||||
10
frontend/pnpm-lock.yaml
generated
10
frontend/pnpm-lock.yaml
generated
@@ -443,9 +443,6 @@ importers:
|
||||
eslint-plugin-sonarjs:
|
||||
specifier: 4.0.2
|
||||
version: 4.0.2(eslint@10.2.1(jiti@2.6.1))
|
||||
husky:
|
||||
specifier: ^9.1.7
|
||||
version: 9.1.7
|
||||
jest-environment-jsdom:
|
||||
specifier: 29.7.0
|
||||
version: 29.7.0
|
||||
@@ -6171,11 +6168,6 @@ packages:
|
||||
resolution: {integrity: sha512-eKCa6bwnJhvxj14kZk5NCPc6Hb6BdsU9DZcOnmQKSnO1VKrfV0zCvtttPZUsBvjmNDn8rpcJfpwSYnHBjc95MQ==}
|
||||
engines: {node: '>=18.18.0'}
|
||||
|
||||
husky@9.1.7:
|
||||
resolution: {integrity: sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==}
|
||||
engines: {node: '>=18'}
|
||||
hasBin: true
|
||||
|
||||
hyphenate-style-name@1.0.4:
|
||||
resolution: {integrity: sha512-ygGZLjmXfPHj+ZWh6LwbC37l43MhfztxetbFCoYTM2VjkIUpeHgSNn7QIyVFj7YQ1Wl9Cbw5sholVJPzWvC2MQ==}
|
||||
|
||||
@@ -16029,8 +16021,6 @@ snapshots:
|
||||
|
||||
human-signals@8.0.1: {}
|
||||
|
||||
husky@9.1.7: {}
|
||||
|
||||
hyphenate-style-name@1.0.4: {}
|
||||
|
||||
i18next-browser-languagedetector@6.1.8:
|
||||
|
||||
Reference in New Issue
Block a user