Skip to content

Commit

Permalink
Merge pull request #847 from Sauravroy34/pre_commit_hooks
Browse files Browse the repository at this point in the history
pre_commit hooks
  • Loading branch information
matteobachetti authored Sep 30, 2024
2 parents c3e6dd3 + 3b396ac commit 21997f5
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 4 deletions.
13 changes: 13 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: trailing-whitespace
files: \.py$
- id: end-of-file-fixer
files: \.py$
ci:
autofix_prs: false
autoupdate_schedule: "quarterly"

1 change: 1 addition & 0 deletions docs/changes/847.trivial.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added pre-commit hooks in ``pre-commit-config.yaml``
29 changes: 25 additions & 4 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,31 @@ Coding Style and Conventions
``MyNewClass``.
- Inline comments should start with two spaces and a single #.

- **Formatting Style:** The new Python 3 formatting style should be
used, i.e. f-strings ``f"{variable_name}"`` or
``"{0}".format(variable_name}``\ should be used instead of
``"%s" % (variable_name)``.
- **Formatting Style:** The new Python 3 formatting style should be
used, i.e., f-strings ``f"{variable_name}"`` or
``"{0}".format(variable_name}`` should be used instead of
``"%s" % (variable_name)``. Additionally, the project enforces
code formatting and style checks through the **pre-commit** tool,
ensuring consistency and adherence to style guidelines across contributions.

- To set up pre-commit locally for the Stingray project, follow these steps:

1. Install the pre-commit package:

.. code-block:: bash
$ pip install pre-commit
2. Run pre-commit on all files in the Stingray repository:

.. code-block:: bash
$ pre-commit run --all-files
This will run the pre-commit tools on all files in the Stingray git repository. The tools may automatically modify some files, while in other cases, they will report issues that require manual correction. If pre-commit makes changes to any files, those changes will appear as new modifications, which need to be staged before committing.




- **Linter/Style Guide Checker:** Our testing infrastructure currently
enforces a subset of the PEP8 style guide. You can check locally
Expand Down

0 comments on commit 21997f5

Please sign in to comment.