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 to automatically fix style issue before pushing commits #973

Merged
merged 4 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: 23.7.0
hooks:
- id: black
files: ^tedana/
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
files: ^tedana/
34 changes: 23 additions & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,27 @@ Here are some [instructions][link_signupinstructions].

Already know what you're looking for in this guide? Jump to the following sections:

* [Joining the conversation](#joining-the-conversation)
* [Contributing small documentation changes](#contributing-small-documentation-changes)
* [Contributing through Github](#contributing-through-github)
* [Understanding issues, milestones, and project boards](#understanding-issues-milestones-and-project-boards)
* [Installing in editable mode](#3-Run-the-developer-setup)
* [Making a change](#making-a-change)
* [Testing your change](#5-Test-your-changes)
* [Viewing Documentation Locally](#Changes-to-documentation)
* [Structuring contributions](#style-guide)
* [Recognizing contributors](#Recognizing-contributors)
* [Monthly calls and testing guidelines][link_developing_rtd]
- [Contributing to `tedana`](#contributing-to-tedana)
- [Joining the conversation](#joining-the-conversation)
- [Contributing small documentation changes](#contributing-small-documentation-changes)
- [Contributing through GitHub](#contributing-through-github)
- [Understanding issues, milestones and project boards](#understanding-issues-milestones-and-project-boards)
- [Issue labels](#issue-labels)
- [Making a change](#making-a-change)
- [1. Comment on an existing issue or open a new issue referencing your addition](#1-comment-on-an-existing-issue-or-open-a-new-issue-referencing-your-addition)
- [2. Fork the tedana repository to your GitHub profile](#2-fork-the-tedana-repository-to-your-github-profile)
- [3. Run the developer setup](#3-run-the-developer-setup)
- [4. Make the changes you've discussed](#4-make-the-changes-youve-discussed)
- [5. Test your changes](#5-test-your-changes)
- [Changes to documentation](#changes-to-documentation)
- [6. Submit a pull request](#6-submit-a-pull-request)
- [Pull Requests](#pull-requests)
- [Pull Request Checklist (For Fastest Review):](#pull-request-checklist-for-fastest-review)
- [Comprehensive Developer Guide](#comprehensive-developer-guide)
- [Style Guide](#style-guide)
- [Writing in ReStructuredText](#writing-in-restructuredtext)
- [Recognizing contributors](#recognizing-contributors)
- [Thank you!](#thank-you)

Don't know where to get started?
Read [Joining the conversation](#joining-the-conversation) and pop into
Expand Down Expand Up @@ -293,6 +303,7 @@ The Python code itself should follow [PEP8][link_pep8] convention,
with at most about 500 lines of code (not including docstrings) per script.
We use [black][link_black] and [isort][link_isort] to enforce this code style,
and we strongly recommend running both tools on your fork before opening a pull request.
To make sure all commits are formatted correctly, we use [pre-commit][link_precommit].
handwerkerd marked this conversation as resolved.
Show resolved Hide resolved

Additionally, we have adopted a primarily functional approach in `tedana`,
so we avoid defining our own classes within the library unless absolutely necessary.
Expand Down Expand Up @@ -376,6 +387,7 @@ You're awesome. :wave::smiley:
[link_pep8]: https://www.python.org/dev/peps/pep-0008/
[link_black]: https://black.readthedocs.io/en/stable/
[link_isort]: https://pycqa.github.io/isort/
[link_precommit]: https://pre-commit.com/
[link_rst_guide]: http://docs.sphinxdocs.com/en/latest/step-1.html

[link_contributors]: https://github.com/ME-ICA/tedana/graphs/contributors
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Documentation = "https://www.tedana.readthedocs.io"
Paper = "https://joss.theoj.org/papers/10.21105/joss.03669"

[project.optional-dependencies]
dev = ["pre-commit"]
doc = [
"sphinx>=6.2.1",
"sphinx_copybutton",
Expand All @@ -59,7 +60,7 @@ tests = [
]

# Aliases
all = ["tedana[doc,tests]"]
all = ["tedana[dev,doc,tests]"]

[project.scripts]
ica_reclassify = "tedana.workflows.ica_reclassify:_main"
Expand Down