Devanik21 / ISRO_Mining_Site_FINAL_APP

MIT License
11 stars 39 forks source link

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

Open Vikranth3140 opened 1 month ago

Vikranth3140 commented 1 month ago

This pull request addresses closes #77 by adding pre-commit hooks to automatically handle code formatting and linting for various file types in the repository. These hooks help maintain consistent code style and formatting across Python files, Jupyter Notebooks, YAML, Markdown, and text files, ensuring better code quality and minimizing errors before committing.

Changes:

Key Updates:

  1. Python Files: Black is used for automatic code formatting.
  2. Jupyter Notebooks: Black and Flake8 linting are applied using nbQA.
  3. YAML Files: Validation using the check-yaml hook.
  4. Text Files: Whitespace and end-of-file formatting fixes are applied.
  5. Markdown Files: Linting for style consistency using mdformat (replacing markdownlint).

Notes:

How to Test:

  1. Install pre-commit by running:
    pip install pre-commit
  2. Run the following command to install the hooks:
    pre-commit install
  3. Apply the hooks to all files:
    pre-commit run --all-files

This ensures that all files are formatted and linted according to the new configuration, improving code quality across the repository.