Skip to content
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
2 changes: 1 addition & 1 deletion .github/future-release-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ Report issues or suggest features on our [GitHub Issues page](https://github.com

For a complete list of changes, see the [Changelog](https://github.com/BerryBytes/precommit-util/blob/main/CHANGELOG.md).

Thank you for using `Precommit Util`!
Thank you for using `Precommit Util`!
2 changes: 1 addition & 1 deletion .github/initial-release-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ This is our first release, and we’d love your input! Report issues or suggest

For a complete list of changes, see the [Changelog](https://github.com/berrybytes/Precommit Util/blob/main/CHANGELOG.md).

Thank you for using `Precommit Util`!
Thank you for using `Precommit Util`!
2 changes: 1 addition & 1 deletion .github/scripts/generate-changelog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -197,4 +197,4 @@ if [[ "$*" == *"--notes-only"* ]]; then
exit 0
fi

main "$@"
main "$@"
6 changes: 3 additions & 3 deletions .github/workflows/releaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches:
- main

workflow_dispatch:

concurrency:
Expand All @@ -24,15 +24,15 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
fetch-tags: true

- name: Install GitHub CLI
run: |
sudo apt-get update
sudo apt-get install -y gh

- name: Install dependencies
run: |
run: |
npm install --global prettier@3.5.3
npm install --global semver

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sync-precommit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: true
Expand Down
46 changes: 46 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
repos:
# ==========================================
# Pre-commit default hooks
# ==========================================
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-added-large-files
- id: check-vcs-permalinks
- id: check-symlinks
- id: destroyed-symlinks
- id: pretty-format-json

# ==========================================
# Codespell
# ==========================================
- repo: https://github.com/codespell-project/codespell
rev: v2.2.5
hooks:
- id: codespell
files: ^.*\.(py|c|h|md|rst|yml|go|sh|sql|tf|yaml)$
args: ["--ignore-words-list", "hist,nd,bu,gir,maks"]

# ==========================================
# Gitleaks
# ==========================================
- repo: https://github.com/gitleaks/gitleaks
rev: v8.21.0
hooks:
- id: gitleaks
args: ["detect", "--verbose"]

# ==========================================
# FIXED STYLELINT HOOK (No nodeenv)
# ==========================================
- repo: local
hooks:
- id: stylelint
name: stylelint
entry: npx stylelint --fix
language: system
types: [css, scss]
exclude: "node_modules/|dist/|build/"
22 changes: 22 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"singleQuote": true,
"trailingComma": "es5",
"tabWidth": 2,
"semi": true,
"printWidth": 100,
"overrides": [
{
"files": "*.html",
"options": {
"parser": "html"
}
},
{
"files": "*.css",
"options": {
"parser": "css"
}
}
],
"ignore": ["node_modules"]
}
9 changes: 9 additions & 0 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "stylelint-config-standard",
"rules": {
"color-hex-length": "short",
"no-duplicate-selectors": true,
"selector-max-id": 0,
"selector-no-qualifying-type": true
}
}
10 changes: 4 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,27 @@ Explore these resources to make your contribution effective and aligned with the

### 📥 **Submitting Pull Requests**

Follow the step-by-step guide to submit pull requests:
Follow the step-by-step guide to submit pull requests:
[**Submitting Pull Requests Guide**](docs/content/contributing/submitting-pull-requests.md)

### 🐛 **Submitting Issues**

Learn how to report bugs, propose features, or provide feedback:
Learn how to report bugs, propose features, or provide feedback:
[**Submitting Issues Guide**](docs/content/contributing/submitting-issues.md)

### 🔒 **Submitting Security Issues**

Help us keep Pre-commit Automation Tools secure by reporting vulnerabilities responsibly:
Help us keep Pre-commit Automation Tools secure by reporting vulnerabilities responsibly:
[**Submitting Security Issues Guide**](docs/content/contributing/submitting-security-issues.md)


## **Interested in Becoming a Maintainer?**

If you’re passionate about Pre-commit Automation Tools and want to take a more active role, check out the:
If you’re passionate about Pre-commit Automation Tools and want to take a more active role, check out the:
[**Maintainers Guidelines**](docs/content/contributing/maintainers-guidelines.md)

---

### **Together, We Build Better**

Your contributions help make Pre-commit Automation Tool a robust and thriving project.


28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ A comprehensive suite of Git hooks and development environment setup tools that



## Overview
## Overview
This toolkit provides automated setup and enforcement of development best practices through:

- Code formatting and linting
Expand All @@ -27,18 +27,18 @@ This toolkit provides automated setup and enforcement of development best practi
- **MacOS:** Above Mac OS X 10.7 Lion

## Prerequisites
- ```sudo``` may be required depending on your system configuration
- ```sudo``` may be required depending on your system configuration
- git (version control)
## Installation Tools
The following tools will be automatically installed during setup:

- asdf (version manager)
- Node.js
- python
- Node.js
- python
- typescript
- black 23.9.1
- Golang
- terraform
- terraform
- tflint 0.39.2
- tfsec 1.28.1
- terraform-docs 0.16.0
Expand Down Expand Up @@ -66,19 +66,19 @@ chmod +x precommit-startup.sh
```
4. Choose the pre-commit hooks you want to install:
```
[1] Global pre-commit hooks
[1] Global pre-commit hooks
[2] Golang pre-commit hooks
[3] Python pre-commit hooks
[4] Terraform pre-commit hooks
[5] TypeScript pre-commit hooks
[6] Exit
```
5. Ensure that you provide the correct version of [nodejs/golang/python/terraform] instead of "latest" before proceeding.
6. After installation, the githooks template will be set up globally for all repositories.
6. After installation, the githooks template will be set up globally for all repositories.

7. Note that the setup is only required for new repositories. Existing repositories will not automatically adopt these hooks. To set up the hooks for an existing repository:
7. Note that the setup is only required for new repositories. Existing repositories will not automatically adopt these hooks. To set up the hooks for an existing repository:
- You will need to manually reinitialize the repository with `git init` to apply the template.

OR

- Clone the existing repository to your local machine again to adopt the hooks automatically.
Expand All @@ -89,7 +89,7 @@ chmod +x precommit-startup.sh

## Skipping Pre-commit Hooks

To ignore specific pre-commit hooks for a specific file, you can modify the .pre-commit-config.yaml file by adding an `exclude` pattern under the specific hook configuration.
To ignore specific pre-commit hooks for a specific file, you can modify the .pre-commit-config.yaml file by adding an `exclude` pattern under the specific hook configuration.

For example, to exclude the main.yaml file from the check-yaml hook, add the following line to the .pre-commit-config.yaml file:

Expand All @@ -103,11 +103,11 @@ repos:
- id: check-yaml
exclude: ^main\.yaml$
```



b. Exclude multiple files (main.yaml and config.yaml are excluded)

```
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
Expand Down Expand Up @@ -142,11 +142,11 @@ repos:

## Maintainers

We embrace an open and inclusive community philosophy. Motivated contributors are encouraged to join the [maintainers' team](docs/content/contributing/maintainers.md).
We embrace an open and inclusive community philosophy. Motivated contributors are encouraged to join the [maintainers' team](docs/content/contributing/maintainers.md).
Learn more about pull request reviews and issue triaging in our [maintainers guide](docs/content/contributing/maintainers-guidelines.md).

## Contributing
Interested in contributing? Refer to our [contributing documentation](CONTRIBUTING.md).
Interested in contributing? Refer to our [contributing documentation](CONTRIBUTING.md).
This project adheres to a [Code of Conduct](CODE_OF_CONDUCT.md), and participation requires compliance with its terms.

---
Expand Down
2 changes: 1 addition & 1 deletion current_dir.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ if [ "${PWD##*/}" != "01cloud-githooks" ]; then
printf "[!] Error: Please run this script from the 01cloud-githooks directory. \n"
exit 1
fi
current_dir=$(pwd)
current_dir=$(pwd)
2 changes: 1 addition & 1 deletion docs/content/contributing/maintainers.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ To understand the responsibilities, requirements, and guidelines for becoming a

---

We are always looking for more passionate individuals to contribute and take part in the journey of improving Pre-commit Automation Tools. Thank you to all our maintainers for their hard work and dedication!
We are always looking for more passionate individuals to contribute and take part in the journey of improving Pre-commit Automation Tools. Thank you to all our maintainers for their hard work and dedication!
24 changes: 12 additions & 12 deletions docs/content/contributing/submitting-pull-requests.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ Here’s how you can get started:
- Check out the [Good First Issues](https://github.com/BerryBytes/precommit-util/issues).
- Browse the list of [Confirmed Bugs](https://github.com/BerryBytes/precommit-util/issues).

- **Set Up Your Pre-commit Hooks Environment:**
- **Set Up Your Pre-commit Hooks Environment:**
Follow the [Development Guide](https://github.com/BerryBytes/precommit-util) to set up your developer environment.


---

Expand All @@ -28,7 +28,7 @@ Before submitting a PR:
2. **Be Thorough:**
- Add detailed comments explaining your changes.
- Use semantic line breaks for documentation updates.
3. **Allow Maintainers to Edit:**
3. **Allow Maintainers to Edit:**
Keep the "Allow edits from maintainers" checkbox checked.

### 🚦 **Validation Requirements**
Expand Down Expand Up @@ -86,13 +86,13 @@ For more details, see the [Lobicornis README](https://github.com/traefik/lobicor

Your PR may be closed if:

1. **Design Conflicts:**
1. **Design Conflicts:**
The work needed to make it mergeable is too extensive.
- **Solution:** Create an issue first and involve maintainers during the design phase.
2. **Out-of-Scope Enhancements:**
2. **Out-of-Scope Enhancements:**
The PR is for a feature that doesn't align with project goals.
- **Solution:** Always create an issue before submitting a PR.
3. **Inactivity:**
3. **Inactivity:**
If no feedback is received from the contributor for over **90 days**.

---
Expand All @@ -116,13 +116,13 @@ Your PR may be closed if:

## 🔑 **Best Practices for PRs**

- **Create Issues First:**
- **Create Issues First:**
Discuss your proposal with the team before starting work.
- **Submit Small PRs:**
- **Submit Small PRs:**
Break large ideas into smaller, logical PRs.
- **Comment Everything:**
- **Comment Everything:**
Assume reviewers are unfamiliar with your perspective or approach.
- **Write Tests:**
- **Write Tests:**
Include adequate tests or ask for help with them.

### Need Help?
Expand All @@ -134,9 +134,9 @@ Your PR may be closed if:

## 🤝 **Handling Feedback**

- **Disagreements:**
- **Disagreements:**
If you believe a requested change is unnecessary, explain your reasoning politely.
- **Overwhelming Comments:**
- **Overwhelming Comments:**
Focus on feedback from the primary reviewer (assignee). If needed, ask to fork a new PR to clear outdated comments.

---
Expand Down
2 changes: 0 additions & 2 deletions docs/content/contributing/thank-you.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,3 @@ Your contributions — be it code, feedback, or advocacy — make Pre-commit Aut
> **Together, we’re building something amazing.**

Let’s make Pre-commit Automation Tool the best it can be! 🚀


5 changes: 2 additions & 3 deletions docs/content/known-issues/precommit-hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Each known issue links off to an existing GitHub issue. If you have additional q

Please check the [open](https://github.com/01cloud/01cloud-githooks/issues) and [closed](https://github.com/01cloud/01cloud-githooks/issues?q=is%3Aissue+is%3Aclosed) bugs in the issue tracker for the details of your bug. If you can't find it, or if you're not sure, open a [new issue](https://github.com/01cloud/01cloud-githooks/issues/new).

##
##

### Python dependencies not installed
If you are getting an error like python dependencies not installed, please run the following command in your terminal
Expand All @@ -27,7 +27,7 @@ If you are getting an error like python dependencies not installed, please run t
```
sudo apt install -y build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev libffi-dev liblzma-dev python3-openssl
xz-utils tk-dev libffi-dev liblzma-dev python3-openssl
```
##

Expand All @@ -38,4 +38,3 @@ Terraform requires to unzip the terraform binary file. If you are getting an whi
```
sudo apt install unzip
```

2 changes: 1 addition & 1 deletion global/extract_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@

# sed -n '/cat > "\$file" <<'\''EOF'\''/,/EOF/p' global/pre-commit.sh | sed '1d;$d' > global/precommitFile/.pre-commit-config.yaml

# echo "Config extracted to global/precommitFile/.pre-commit-config.yaml"
# echo "Config extracted to global/precommitFile/.pre-commit-config.yaml"
2 changes: 1 addition & 1 deletion global/install_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ declare -a optional_tools=(
"python"
"nodejs"
"terraform"

)

# Install mandatory tools without user interaction
Expand Down
1 change: 0 additions & 1 deletion global/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,3 @@ chmod +x "$TEMPLATE_DIR/pre-commit" "$TEMPLATE_DIR/commit-msg"
## automatically enabling pre-commit on repositories
git config --global init.templateDir "$HOME/.git-templates"
echo "Git hooks set up successfully!"

Loading
Loading