Skip to content

Commit

Permalink
add pre-commit with checks (#142)
Browse files Browse the repository at this point in the history
* add pre-commit

* fix isort and black repos

* add hooks,mypy and fix flake8

* add pre-commit installation and running ar CONTRIBUTING.MD

* edit Contributing

---------

Co-authored-by: Adrien Barbaresi <barbaresi@bbaw.de>
  • Loading branch information
nadasuhailAyesh12 and adbar committed Mar 25, 2024
1 parent 3e8ba44 commit b5b95da
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 10 deletions.
27 changes: 27 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/psf/black
rev: 24.3.0
hooks:
- id: black

- repo: https://github.com/PyCQA/flake8
rev: 7.0.0
hooks:
- id: flake8

- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.9.0
hooks:
- id: mypy
33 changes: 23 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,39 @@ Thank you for considering contributing to htmldate!

Here are some important resources:

* [List of currently open issues](https://github.com/adbar/htmldate/issues) (no pretention to exhaustivity!)
* [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/)
- [List of currently open issues](https://github.com/adbar/htmldate/issues) (no pretention to exhaustivity!)
- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/)

There are many ways to contribute, you could:

* Improve the documentation
* Find bugs and submit bug reports
* Submit feature requests
* Write tutorials or blog posts
* Write code
- Improve the documentation
- Find bugs and submit bug reports
- Submit feature requests
- Write tutorials or blog posts
- Write code

## Installing and Running Pre-commit

### Introduction

Pre-commit is a tool that helps maintain a consistent code style and quality in our project by running a set of hooks before each commit. These hooks perform checks such as code formatting, linting, and ensuring compliance with project-specific guidelines.

### Installation and Running

To install and set up pre-commit in your development environment, follow these steps:

1. Run `pip install pre-commit` to your terminal to install pre-commit using pip.
2. Navigate to your project directory and run `pre-commit install` to initialize pre-commit hooks.
3. Run it manually on your changes using `git ls-files -- 'htmldate/*.py' | xargs pre-commit run --files`

## Submitting changes

Please send a [GitHub Pull Request to htmldate](https://github.com/adbar/htmldate/pull/new/master) with a clear list of what you've done (read more about [pull requests](http://help.github.com/pull-requests/)).

**Working on your first Pull Request?** You can learn how from this series: [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github)

For further questions you can contact me on [GitHub issues](), [Twitter](https://twitter.com/adbarbaresi) or by [E-Mail](http://adrien.barbaresi.eu/contact.html)

For further questions you can contact me on [GitHub issues](https://github.com/adbar/htmldate/issues), [Twitter](https://twitter.com/adbarbaresi) or by [E-Mail](http://adrien.barbaresi.eu/contact.html)

Thanks,

Adrien
Adrien

0 comments on commit b5b95da

Please sign in to comment.