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

Add Pre-commit Hooks for Code Formatting and Linting #77

Open
Vikranth3140 opened this issue Oct 24, 2024 · 3 comments · May be fixed by #79
Open

Add Pre-commit Hooks for Code Formatting and Linting #77

Vikranth3140 opened this issue Oct 24, 2024 · 3 comments · May be fixed by #79
Assignees

Comments

@Vikranth3140
Copy link

To ensure consistent code style and formatting across the entire repository, we need to implement pre-commit hooks that automatically handle formatting and linting for multiple file types. This will improve code quality, catch errors early, and maintain clean code standards.

File Types to be Covered:

  • Python files (.py)
  • Jupyter Notebooks (.ipynb)
  • YAML files (.yml)
  • Markdown files (.md)
  • Text files (.txt)

Tasks:

  1. Add a .pre-commit-config.yaml file in the root directory of the repository.
  2. Configure the following pre-commit hooks:
    • Black: For automatic code formatting for Python and Jupyter Notebooks.
    • Flake8: For linting Python files and Jupyter Notebooks.
    • nbQA: To apply Black and Flake8 formatting and linting to Jupyter Notebooks (.ipynb).
    • Check YAML: To validate the format of YAML files.
    • Markdownlint: To ensure style consistency in Markdown files.
    • Trailing Whitespace, End-of-file fixer, and Check-merge-conflict: For cleaning up text files and ensuring proper file formatting.
  3. Install and activate the pre-commit hooks with the pre-commit install command.
  4. Run pre-commit run --all-files to apply the hooks to the entire codebase.

By implementing these hooks, we can maintain consistent formatting across all relevant file types and automatically prevent common formatting issues before code is committed.

Copy link

👋 Thank you for raising an issue! We appreciate your effort in helping us improve. Our team will review it shortly. Stay tuned!

@Vikranth3140
Copy link
Author

Hey @Devanik21, I have already submitted the PR #79 to cover this.

Please crosscheck the pre-commit hooks i have added.

@Absk024
Copy link

Absk024 commented Nov 7, 2024

i would like to contribute @Devanik21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants