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

CI: Add TravisCI for code linting with flake8 #18

Merged
merged 2 commits into from
Sep 25, 2019
Merged

CI: Add TravisCI for code linting with flake8 #18

merged 2 commits into from
Sep 25, 2019

Conversation

oesteban
Copy link
Member

Although this doesn't implement #16, it addresses the need for checking code style before merging in changes. This PR is not meant as an alternative to Black, but rather as an easy first step towards more comprehensive linting, while offloading the contributors from setting up anything on their end.

Although this doesn't implement #16, it addresses the need for checking
code style before merging in changes.
This PR is not meant as an alternative to Black, but rather as an easy
first step towards more comprehensive linting, while offloading the
contributors from setting up anything on their end.
Copy link
Collaborator

@arokem arokem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. Worth doing, for sure.

What do you think about #16, though? IIUC, this might become superfluous, if we use black?

@@ -90,9 +90,9 @@ parentdir_prefix =
[flake8]
max-line-length = 99
doctests = True
exclude=*build/
exclude=*build/,*/_afq/*
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there still anything called *afq* anywhere in here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I placed the old code under dmriprep/workflows/_afq/ for when we reinclude stuff as an AFQ Plugin. Let me know if that's fine with you all.


before_install:
- python -m pip install --upgrade pip
- pip install "flake8<3.0" flake8-putty
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth adding a requirements-dev.txt file, specifying development requirements and installing here from that file, using pip install -r requirements-dev.txt?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the transition to PEP508 and others influencing the setup.cfg & setuptools mode of installation it is possible to minimize different distribution configurations - this covers developers and contributors if they install with pip install -e .[all].

For CI you are sometimes interested in avoiding the installation of the package (via pip, setup.py or wheels). We can try this and if it becomes burdensome to handle environments for Circle and/or Travis, then include a .maintenance/requirements-dev.txt file. WDYT?

@arokem
Copy link
Collaborator

arokem commented Sep 25, 2019 via email

@oesteban
Copy link
Member Author

Is there relevant fmriprep documentation about "plugins" and how those work?

That is an idea that sourced from @satra's brain and is gradually taking shape. In this case, I believe this "plugin" would be much easier if we just use BIDS-Derivatives as an interface since we would not need to modify dmriprep's execution graph, just add nodes.


before_install:
- python -m pip install --upgrade pip
- pip install "flake8<3.0" flake8-putty
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want to use Black instead of flake8 as discussed in #16, then this line would be something like

- pip install black

- pip install "flake8<3.0" flake8-putty

script:
- flake8 dmriprep
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And if switching to black as discussed in #16, this line would read

- black --check .

@richford
Copy link
Collaborator

I added a couple lines showing what changes would be necessary to switch to Black for formatting. But I don't think it's necessary to wait for a resolution of #16 to merge this PR. We can always switch over in the future.

@oesteban
Copy link
Member Author

Yup, I can see how black --check . tells you which files should be reformatted and exit with 1. However, for the travis build to be useful, then we would need to run black --diff ..

So I'd go ahead, and then add black in #16 (I like switching the pre-commit hook to optional). Possibly I would keep flake8 as enforced and allow the black tests to "fail"

@oesteban oesteban merged commit ef1941b into nipreps:master Sep 25, 2019
@oesteban oesteban deleted the maint/add-travis branch September 25, 2019 23:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants