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

Implement Pre-Commit Hooks for Code Quality and Branch Protection #10

Open
project-delphi opened this issue Oct 9, 2024 · 0 comments
Open

Comments

@project-delphi
Copy link
Collaborator

Pre-Commit Hooks for Code Quality and Branch Protection

We need to set up pre-commit hooks to enforce code quality and branch protection rules. The hooks should include the following checks:

  1. Linting: Ensure that all code adheres to our linting standards.
  2. Big File Check: Prevent committing files that exceed a certain size limit.
  3. Branch Protection: Disallow commits directly to the main or dev branches.
  4. Static Analysis: Run static analysis tools to catch potential issues early.
  5. Code Style: Enforce consistent code style across the codebase.

Tasks

1. Set up linting hook:

  • Configure the linter (e.g., ESLint, Pylint) to run on staged files.
  • Ensure the hook fails if linting errors are found.

2. Implement big file check:

  • Define a size limit for files.
  • Create a hook to check the size of staged files and prevent committing if any file exceeds the limit.

3. Branch protection hook:

  • Create a hook to check the current branch.
  • Prevent commits if the branch is main or dev.

4. Set up static analysis:

  • Configure static analysis tools (e.g., SonarQube, Bandit) to run on staged files.
  • Ensure the hook fails if any issues are detected.

5. Enforce code style:

  • Configure a code style tool (e.g., Prettier, Black) to run on staged files.
  • Ensure the hook fails if code style violations are found.

Additional Notes

  • Consider using a tool like pre-commit to manage these hooks.
  • Ensure that the hooks are easy to set up and run consistently across different development environments.
  • Provide documentation on how to install and configure the pre-commit hooks for new developers.

References

Assignees

Labels

  • enhancement
  • code-quality
  • branch-protection
  • static-analysis
  • style
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant