Skip to content

Commit 38b8d88

Browse files
authored
Merge pull request #1 from BerryBytes/feat/init
Feature - Languages Supported are Golang, TypeScript, Terraform, Python
2 parents c8942cf + 9ff9664 commit 38b8d88

29 files changed

Lines changed: 2877 additions & 0 deletions

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
### Date - 2025-02-6
2+
Initial release of precommit-utils
3+
```
4+
Project setup and configuration with default supported laguages
5+
6+
NOTE: Currently we are supporting below languages,
7+
8+
Golang,
9+
TypeScript,
10+
Terraform,
11+
Python
12+
```

CODE_OF_CONDUCT.md

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
2+
3+
# **Contributor Covenant Code of Conduct**
4+
5+
## **Our Pledge**
6+
7+
We, as contributors and maintainers, pledge to foster an open, inclusive, and harassment-free environment for everyone. We are committed to ensuring participation in our project and community is respectful and welcoming, regardless of:
8+
9+
- Age
10+
- Body size
11+
- Disability
12+
- Ethnicity
13+
- Gender identity and expression
14+
- Level of experience
15+
- Nationality
16+
- Personal appearance
17+
- Race
18+
- Religion
19+
20+
---
21+
22+
## **Our Standards**
23+
24+
To create a positive and collaborative environment, we encourage:
25+
26+
### **Positive Behaviors**
27+
28+
- Using welcoming and inclusive language
29+
- Respecting diverse viewpoints and experiences
30+
- Gracefully accepting constructive feedback
31+
- Prioritizing what is best for the community
32+
- Demonstrating empathy towards others
33+
34+
### 🚫 **Unacceptable Behaviors**
35+
36+
- Use of sexualized language or imagery and unwelcome advances
37+
- Trolling, insults, derogatory comments, and personal or political attacks
38+
- Public or private harassment
39+
- Sharing private information (e.g., physical or electronic addresses) without explicit permission
40+
- Other behavior deemed inappropriate in a professional setting
41+
42+
---
43+
44+
## **Our Responsibilities**
45+
46+
Project maintainers are responsible for:
47+
48+
- Clarifying acceptable behavior standards.
49+
- Taking fair and appropriate action in response to unacceptable behavior.
50+
- Removing, editing, or rejecting contributions that violate this Code of Conduct.
51+
- Enforcing temporary or permanent bans for inappropriate behavior.
52+
53+
---
54+
55+
## **Scope**
56+
57+
This Code of Conduct applies:
58+
59+
- **Within project spaces** (e.g., repositories, chats, forums).
60+
- **In public spaces** when representing the project (e.g., via an official email, social media account, or at events).
61+
62+
Project maintainers may further clarify what constitutes project representation.
63+
64+
---
65+
66+
## **Enforcement**
67+
68+
### **Reporting**
69+
70+
Instances of abusive, harassing, or otherwise unacceptable behavior can be reported to the project team at: **[community@01cloud.com](mailto:community@01cloud.com)**
71+
72+
All reports will be:
73+
74+
- Reviewed and investigated confidentially.
75+
- Responded to appropriately, based on the situation.
76+
77+
---
78+
79+
### **Enforcement Guidelines**
80+
81+
1. **First Instance:**
82+
83+
- The message is edited and marked as "abuse."
84+
- Content added:
85+
> "Dear user, we want Pre-commit Automation Tools to provide a welcoming and respectful environment. Your [comment/issue/PR] has been reported and marked as abuse according to our [Code of Conduct](./CODE_OF_CONDUCT.md). Thank you."
86+
87+
2. **Second Instance:**
88+
89+
- The message is again edited and marked as "abuse."
90+
- Results in a **7-day ban**.
91+
92+
3. **Third Instance:**
93+
- The message is edited and marked as "abuse."
94+
- Results in a **permanent ban**.
95+
96+
All enforcement actions are discussed among maintainers beforehand to ensure fairness. Reports must be resolved following the [GitHub Reporting Guidelines](https://docs.github.com/en/communities/moderating-comments-and-conversations/managing-reported-content-in-your-organizations-repository#resolving-a-report).
97+
98+
---
99+
100+
## **Attribution**
101+
102+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.4. Full details available at [http://contributor-covenant.org/version/1/4/](http://contributor-covenant.org/version/1/4/).
103+
104+
---
105+
106+
By adhering to this Code of Conduct, we ensure Pre-commit Automation Tools remains a safe and thriving community for all. Thank you for your cooperation and support! 🚀

CONTRIBUTING.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
# **Contributing to Pre-commit Automation Tools**
3+
4+
Thank you for your interest in contributing to Pre-commit Automation Tools! We value every contribution, whether it’s reporting a bug, suggesting an improvement, or submitting code. Here’s how you can get started:
5+
---
6+
7+
## **Contribution Resources**
8+
9+
Explore these resources to make your contribution effective and aligned with the project’s goals:
10+
11+
### 📥 **Submitting Pull Requests**
12+
13+
Follow the step-by-step guide to submit pull requests:
14+
[**Submitting Pull Requests Guide**](docs/content/contributing/submitting-pull-requests.md)
15+
16+
### 🐛 **Submitting Issues**
17+
18+
Learn how to report bugs, propose features, or provide feedback:
19+
[**Submitting Issues Guide**](docs/content/contributing/submitting-issues.md)
20+
21+
### 🔒 **Submitting Security Issues**
22+
23+
Help us keep Pre-commit Automation Tools secure by reporting vulnerabilities responsibly:
24+
[**Submitting Security Issues Guide**](docs/content/contributing/submitting-security-issues.md)
25+
26+
27+
## **Interested in Becoming a Maintainer?**
28+
29+
If you’re passionate about Pre-commit Automation Tools and want to take a more active role, check out the:
30+
[**Maintainers Guidelines**](docs/content/contributing/maintainers-guidelines.md)
31+
32+
---
33+
34+
### **Together, We Build Better**
35+
36+
Your contributions help make Pre-commit Automation Tool a robust and thriving project.
37+
38+

README.md

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
# Pre-commit Automation Tools 🔧
2+
A comprehensive suite of Git hooks and development environment setup tools that enforce code quality, formatting standards, and conventional commits across your projects.
3+
4+
## Table of Contents 📋
5+
6+
- [Overview](#overview)
7+
- [Prerequisites](#prerequisites)
8+
- [Installation](#installation)
9+
- [Skipping Pre-commit Hooks](#skipping-pre-commit-hooks)
10+
- [Maintainers](#maintainers)
11+
- [Contributing](#contributing)
12+
- [Credits](#credits)
13+
- [License](#license)
14+
15+
16+
17+
## Overview
18+
This toolkit provides automated setup and enforcement of development best practices through:
19+
20+
- Code formatting and linting
21+
- Security scanning
22+
- Conventional commit message enforcement
23+
- Development environment standardization across multiple projects
24+
25+
## OS Requirements
26+
- **Linux:** Above Linux 4.16.10-300.fc28.x86_64 x86_64
27+
- **MacOS:** Above Mac OS X 10.7 Lion
28+
29+
## Prerequisites
30+
- ```sudo``` may be required depending on your system configuration
31+
- git (version control)
32+
## Installation Tools
33+
The following tools will be automatically installed during setup:
34+
35+
- asdf (version manager)
36+
- Node.js
37+
- python
38+
- typescript
39+
- black 23.9.1
40+
- Golang
41+
- terraform
42+
- tflint 0.39.2
43+
- tfsec 1.28.1
44+
- terraform-docs 0.16.0
45+
- pre-commit 3.3.3
46+
- yamlfmt 0.14.0
47+
- prettier
48+
- codespell 2.2.5
49+
- gitleaks 8.21.0
50+
51+
52+
## Installation
53+
54+
1. Clone this repository
55+
```
56+
git clone git@github.com:BerryBytes/precommit-util.git
57+
```
58+
59+
2. Make the precommit-startup.sh executable:
60+
```
61+
chmod +x precommit-startup.sh
62+
```
63+
3. Run the startup script:
64+
```
65+
./precommit-startup.sh
66+
```
67+
4. Choose the pre-commit hooks you want to install:
68+
```
69+
70+
[1] Golang pre-commit hooks
71+
[2] Python pre-commit hooks
72+
[3] Terraform pre-commit hooks
73+
[4] TypeScript pre-commit hooks
74+
[5] Exit
75+
```
76+
5. Ensure that you provide the correct version of [nodejs/golang/python/terraform] instead of "latest" before proceeding.
77+
6. After installation, the githooks template will be set up globally for all repositories.
78+
79+
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:
80+
- You will need to manually reinitialize the repository with `git init` to apply the template.
81+
82+
OR
83+
84+
- Clone the existing repository to your local machine again to adopt the hooks automatically.
85+
86+
87+
8. After initializing / cloning the repository, make changes to the codebase and commit them. The pre-commit hooks will automatically run and enforce the code quality standards.
88+
89+
90+
## Skipping Pre-commit Hooks
91+
92+
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.
93+
94+
For example, to exclude the main.yaml file from the check-yaml hook, add the following line to the .pre-commit-config.yaml file:
95+
96+
a. Exclude a file (main.yaml is excluded)
97+
98+
```
99+
repos:
100+
- repo: https://github.com/pre-commit/pre-commit-hooks
101+
rev: v4.4.0
102+
hooks:
103+
- id: check-yaml
104+
exclude: ^main\.yaml$
105+
```
106+
107+
108+
109+
b. Exclude multiple files (main.yaml and config.yaml are excluded)
110+
111+
```
112+
repos:
113+
- repo: https://github.com/pre-commit/pre-commit-hooks
114+
rev: v4.4.0
115+
hooks:
116+
- id: check-yaml
117+
exclude: ^(main\.yaml|config\.yaml)$
118+
```
119+
120+
121+
c. If you want to ignore all files inside the folder from being processed by your pre-commit hooks, you can modify the `exclude` filed in your `.pre-commit-config.yaml` file to ignore the files you want to ignore.
122+
123+
```
124+
repos:
125+
- repo: https://github.com/pre-commit/pre-commit-hooks
126+
rev: v4.4.0
127+
hooks:
128+
- id: check-yaml
129+
exclude: ^folder-to-ignore/
130+
```
131+
132+
d. If multiple folders are to be ignored, you can use the `exclude` field to ignore multiple folders.
133+
134+
```
135+
repos:
136+
- repo: https://github.com/pre-commit/pre-commit-hooks
137+
rev: v4.4.0
138+
hooks:
139+
- id: check-yaml
140+
exclude: ^(first-folder-to-ignore|second-folder-to-ignore)/
141+
```
142+
143+
## Maintainers
144+
145+
We embrace an open and inclusive community philosophy. Motivated contributors are encouraged to join the [maintainers' team](docs/content/contributing/maintainers.md).
146+
Learn more about pull request reviews and issue triaging in our [maintainers guide](https://github.com/01cloud/01cloud-githooks/blob/develop/docs/content/contributing/maintainers-guidelines.md).
147+
148+
## Contributing
149+
Interested in contributing? Refer to our [contributing documentation](CONTRIBUTING.md).
150+
This project adheres to a [Code of Conduct](CODE_OF_CONDUCT.md), and participation requires compliance with its terms.
151+
152+
---
153+
When contributing to this project:
154+
155+
- Follow the conventional commit message format
156+
- Ensure all pre-commit hooks pass
157+
- Test your changes across different environments
158+
159+
## Credits
160+
161+
Special thanks to [Berrybytes](https://www.berrybytes.com) for bringing this project to life!
162+
163+
164+
## License
165+
166+
Pre-commit Automation Tools is open-source software licensed under the [MIT License](LICENSE).
167+
168+
### Key Enhancements:
169+
170+
1. **Visually Engaging Structure**: We've used emojis to separate sections and make key areas stand out. This creates an easy-to-read, welcoming atmosphere.
171+
2. **Readable Headers**: The use of headers like **Installation**, **Features**, **Prerequisites**, etc., makes the document easy to navigate.
172+
3. **Clear Examples and Code Blocks**: Code snippets are formatted properly and separated for easier reading.
173+
4. **Table of Contents**: The Table of Contents at the beginning allows users to quickly navigate the document to relevant sections.
174+
5. **Improved Formatting**: Sections like **Installation** and **Prerequisites** are cleanly formatted, making the process easier to follow.
175+
176+
This revised README is more visually appealing and user-friendly while maintaining its clarity and professionalism.

current_dir.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
set -e
3+
4+
if [ "${PWD##*/}" != "01cloud-githooks" ]; then
5+
printf "[!] Error: Please run this script from the 01cloud-githooks directory. \n"
6+
exit 1
7+
fi
8+
current_dir=$(pwd)
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Contributor Guidelines for Pre-commit Automation Tools
2+
3+
Thank you for your interest in contributing to Pre-commit Automation Tools! Follow these simple steps to get started:
4+
5+
## How to Contribute
6+
7+
1. **Clone the repository:**
8+
9+
```bash
10+
git clone git@github.com:BerryBytes/precommit-util.git
11+
```
12+
13+
2. **Submit your work:**
14+
- Create a branch:
15+
```bash
16+
git checkout -b feature/your-feature-name
17+
```
18+
- Push your branch:
19+
```bash
20+
git push origin feature/your-feature-name
21+
```
22+
- Open a pull request with a clear description.
23+
24+
## Reporting Issues
25+
26+
- Check existing issues first to avoid duplicates.
27+
- Provide clear details, including steps to reproduce, expected behavior, and logs/screenshots if possible.
28+
29+
## Guidelines
30+
31+
- Use meaningful commit messages (e.g., "Fix typo in README").
32+
- Adhere to the [Code of Conduct](../../../CODE_OF_CONDUCT.md).
33+
- Ensure all CI tests pass before submitting a pull request.

0 commit comments

Comments
 (0)