-
-
Notifications
You must be signed in to change notification settings - Fork 25.9k
MNT Add pre-comit configuration #16957
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
Changes from all commits
fe90833
399e544
08fb033
739adc0
777a11d
0caf4b7
a457efc
File filter 8000
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v2.3.0 | ||
hooks: | ||
- id: check-yaml | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
- repo: https://gitlab.com/pycqa/flake8 | ||
rev: 3.7.8 | ||
hooks: | ||
- id: flake8 | ||
adrinjalali marked this conversation as resolved.
Show resolved
Hide resolved
|
||
types: [file, python] | ||
# only check for unused imports for now, as long as | ||
# the code is not fully PEP8 compatible | ||
args: [--select=F401] | ||
- repo: https://github.com/pre-commit/mirrors-mypy | ||
rev: v0.730 | ||
hooks: | ||
- id: mypy | ||
args: | ||
- --ignore-missing-imports | ||
files: sklearn/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -248,19 +248,28 @@ modifying code and submitting a PR: | |
and start making changes. Always use a feature branch. It's good | ||
practice to never work on the ``master`` branch! | ||
|
||
9. Develop the feature on your feature branch on your computer, using Git to | ||
do the version control. When you're done editing, add changed files using | ||
``git add`` and then ``git commit``:: | ||
9. (**Optional**) Install `pre-commit <https://pre-commit.com/#install>`_ to | ||
run code style checks before each commit:: | ||
|
||
$ git add modified_files | ||
$ git commit | ||
$ pip install pre-commit | ||
$ pre-commit install | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you might need to mention that occasionally (particularly when creating merge commits), you might need to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What error message will users get the first time? This section is aimed at new contributors and we need to be careful about not overloading with information (that was an issue in the previous version of the guide that we tried to trim down). Also I honestly doubt they'll ever remember "oh right I saw that in the UG" |
||
|
||
to record your changes in Git, then push the changes to your GitHub | ||
account with:: | ||
pre-commit checks can be disabled for a particular commit with | ||
`git commit -n`. | ||
|
||
10. Develop the feature on your feature branch on your computer, using Git to | ||
do the version control. When you're done editing, add changed files using | ||
``git add`` and then ``git commit``:: | ||
|
||
$ git add modified_files | ||
$ git commit | ||
|
||
to record your changes in Git, then push the changes to your GitHub | ||
account with:: | ||
|
||
$ git push -u origin my_feature | ||
|
||
10. Follow `these | ||
11. Follow `these | ||
<https://help.github.com/articles/creating-a-pull-request-from-a-fork>`_ | ||
instructions to create a pull request from your fork. This will send an | ||
email to the committers. You may want to consider sending an email to the | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this follow the configuration in
examples/.flake8
when linting examples?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well right now this only checks for one single error (
F401
: unused imports) which is also compatible withexamples/.flake8
. Now it's more a proof of concept for flake8, I'd be happy extend it once we have this pre-commit config file merged :)