-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: some failing pre-commits and add conventional commit message for…
…mat check ISSUE: #1935 CHANGELOG: - [x] Addresses error handling and parallelized formatting for toml files. - [x] Configures the ruff formatter to use requested format. - [x] Clean up some lint. - [x] Update copyright headers in files missing them. - [x] Add scripts to add and check license headers. - [x] Add checks to ensure we have a conventional commit message format. - [x] Add a commit message template that uses the conventional commit message format. - [x] Add biomejs configuration for later use.
- Loading branch information
Showing
23 changed files
with
383 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
# Copyright 2025 Google LLC | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
name: "Pull Request Labeler" | ||
|
||
on: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Copyright 2025 Google LLC | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
set -euo pipefail | ||
|
||
cat "$1" | convco check --from-stdin |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
feat: | ||
|
||
ISSUE: | ||
|
||
CHANGELOG: | ||
- [ ] | ||
|
||
## COMMIT MESSAGE FULL EXAMPLE | ||
# | ||
# feat(user-authentication): Implement two-factor authentication | ||
# | ||
# This commit introduces two-factor authentication for enhanced security. | ||
# It uses TOTP and requires users to configure an authenticator app. | ||
# | ||
# ISSUE: #123 | ||
# | ||
# CHANGELOG: | ||
# - [ ] Add support for two-factor authentication | ||
# - [ ] Update user login endpoint to require two-factor authentication | ||
# | ||
# BREAKING CHANGE: The API endpoint for user login has been modified. | ||
|
||
## CONVENTIONAL COMMIT TEMPLATE | ||
# | ||
# Subject line (required, max 50 characters, use imperative mood): | ||
# <type>(<scope>): <short description> | ||
# Example: feat(user-authentication): Implement two-factor authentication | ||
# | ||
# Body (optional, wrap at 72 characters, explain the change in more detail, mention why and what): | ||
# <detailed description> | ||
|
||
## TYPES OF CHANGE (choose one): | ||
# - feat: A new feature | ||
# - fix: A bug fix | ||
# - docs: Documentation changes | ||
# - style: Code style changes (formatting, etc.) | ||
# - refactor: Code refactoring (no new features or bug fixes) | ||
# - perf: Performance improvements | ||
# - test: Adding or modifying tests | ||
# - build: Changes that affect the build system or external dependencies | ||
# - ci: Changes to CI configuration files and scripts | ||
# - chore: Routine tasks, build process changes, etc. | ||
# - revert: Revert a previous commit | ||
# | ||
## SCOPE (optional, specify the affected area, e.g., component, module): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Copyright 2025 Google LLC | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# Adds a license header to all files that don't already have it. | ||
|
||
# set -x # Uncomment to enable tracing. | ||
set -euo pipefail | ||
|
||
TOP_DIR=$(git rev-parse --show-toplevel) | ||
|
||
if ! command -v addlicense &>/dev/null; then | ||
if ! command -v go &>/dev/null; then | ||
echo "Please install go" | ||
exit 1 | ||
fi | ||
echo "Installing addlicense..." | ||
go install github.com/google/addlicense@latest | ||
fi | ||
|
||
# NOTE: If you edit the ignore patterns, make sure to update the ignore patterns | ||
# in the corresponding check_license script. | ||
$HOME/go/bin/addlicense \ | ||
-c "Google LLC" \ | ||
-s=only \ | ||
-l apache \ | ||
-ignore '**/.dist/**/*' \ | ||
-ignore '**/.eggs/**/*' \ | ||
-ignore '**/.idea/**/*' \ | ||
-ignore '**/.mypy_cache/**/*' \ | ||
-ignore '**/.next/**/*' \ | ||
-ignore '**/.output/**/*' \ | ||
-ignore '**/.pytest_cache/**/*' \ | ||
-ignore '**/.ruff_cache/**/*' \ | ||
-ignore '**/.venv/**/*' \ | ||
-ignore '**/.wxt/**/*' \ | ||
-ignore '**/__pycache__/**/*' \ | ||
-ignore '**/bazel-*/**/*' \ | ||
-ignore '**/coverage/**/*' \ | ||
-ignore '**/develop-eggs/**/*' \ | ||
-ignore '**/dist/**/*' \ | ||
-ignore '**/node_modules/**/*' \ | ||
-ignore '**/pnpm-lock.yaml' \ | ||
-ignore '.nx/**/*' \ | ||
-ignore '.trunk/**/*' \ | ||
"$TOP_DIR" |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Copyright 2025 Google LLC | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# Checks that all files have a license header. | ||
|
||
# set -x # Uncomment to enable tracing. | ||
set -euo pipefail | ||
|
||
TOP_DIR=$(git rev-parse --show-toplevel) | ||
|
||
if ! command -v addlicense &>/dev/null; then | ||
if ! command -v go &>/dev/null; then | ||
echo "Please install go" | ||
exit 1 | ||
fi | ||
echo "Installing addlicense..." | ||
go install github.com/google/addlicense@latest | ||
fi | ||
|
||
export PATH=$(go env GOPATH):$PATH | ||
|
||
# NOTE: If you edit the ignore patterns, make sure to update the ignore patterns | ||
# in the corresponding add_license script. | ||
$HOME/go/bin/addlicense \ | ||
-check \ | ||
-c "Google LLC" \ | ||
-s=only \ | ||
-l apache \ | ||
-ignore '**/.dist/**/*' \ | ||
-ignore '**/.eggs/**/*' \ | ||
-ignore '**/.idea/**/*' \ | ||
-ignore '**/.mypy_cache/**/*' \ | ||
-ignore '**/.next/**/*' \ | ||
-ignore '**/.output/**/*' \ | ||
-ignore '**/.pytest_cache/**/*' \ | ||
-ignore '**/.ruff_cache/**/*' \ | ||
-ignore '**/.venv/**/*' \ | ||
-ignore '**/.wxt/**/*' \ | ||
-ignore '**/__pycache__/**/*' \ | ||
-ignore '**/bazel-*/**/*' \ | ||
-ignore '**/coverage/**/*' \ | ||
-ignore '**/develop-eggs/**/*' \ | ||
-ignore '**/dist/**/*' \ | ||
-ignore '**/node_modules/**/*' \ | ||
-ignore '**/pnpm-lock.yaml' \ | ||
-ignore '.nx/**/*' \ | ||
-ignore '.trunk/**/*' \ | ||
"$TOP_DIR" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Format all TOML files in the project. | ||
# | ||
# Copyright 2025 Google LLC | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
set -euo pipefail | ||
|
||
TOP_DIR=$(git rev-parse --show-toplevel) | ||
|
||
if command -v taplo >/dev/null 2>&1; then | ||
if [ ! -f "${TOP_DIR}/taplo.toml" ]; then | ||
echo "error: config file not found at ${TOP_DIR}/taplo.toml" | ||
exit 1 | ||
fi | ||
|
||
FORMATTER_COMMAND="taplo format --config ${TOP_DIR}/taplo.toml" | ||
if command -v rust-parallel >/dev/null 2>&1; then | ||
FORMATTER_COMMAND="rust-parallel -j4 ${FORMATTER_COMMAND}" | ||
else | ||
echo "warning: it is recommended to install https://crates.io/crates/rust-parallel for faster formatting" | ||
fi | ||
|
||
pushd "${TOP_DIR}" | ||
if command -v fd >/dev/null 2>&1; then | ||
echo "Using fd" | ||
fd -e toml \ | ||
--exclude '**/*.egg-info/**' \ | ||
--exclude '**/.dist/**' \ | ||
--exclude '**/.next/**' \ | ||
--exclude '**/.output/**' \ | ||
--exclude '**/.pytest_cache/**' \ | ||
--exclude '**/.venv/**' \ | ||
--exclude '**/__pycache__/**' \ | ||
--exclude '**/bazel-*/**' \ | ||
--exclude '**/build/**' \ | ||
--exclude '**/develop-eggs/**' \ | ||
--exclude '**/dist/**' \ | ||
--exclude '**/eggs/**' \ | ||
--exclude '**/node_modules/**' \ | ||
--exclude '**/sdist/**' \ | ||
--exclude '**/site/**' \ | ||
--exclude '**/target/**' \ | ||
--exclude '**/venv/**' \ | ||
--exclude '**/wheels/**' | | ||
${FORMATTER_COMMAND} | ||
else | ||
echo "Please install https://github.com/sharkdp/fd to find files to format." | ||
fi | ||
popd | ||
else | ||
echo "Please install https://github.com/tamasfe/taplo to format TOML files." | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.