remove vcs integration

This commit is contained in:
Anthony Sottile 2021-03-29 19:01:59 -07:00
parent 434c108f74
commit 1a1d850e99
13 changed files with 2 additions and 659 deletions

View file

@ -59,7 +59,6 @@ accepts as well as what it returns.
filepaths = list(copy_indexed_files_to(tempdir, lazy))
app.initialize(['.'])
app.options.exclude = update_excludes(app.options.exclude, tempdir)
app.options._running_from_vcs = True
app.run_checks(filepaths)
app.report_errors()

View file

@ -70,9 +70,6 @@ All options available as of Flake8 3.1.0::
Enable plugins and extensions that are otherwise
disabled by default
--exit-zero Exit with status code "0" even if there are errors.
--install-hook=INSTALL_HOOK
Install a hook that is run prior to a commit for the
supported version control system.
-j JOBS, --jobs=JOBS Number of subprocesses to use to run checks in
parallel. This is ignored on Windows. The default,
"auto", will auto-detect the number of processors

View file

@ -78,8 +78,6 @@ Index of Options
- :option:`flake8 --exit-zero`
- :option:`flake8 --install-hook`
- :option:`flake8 --jobs`
- :option:`flake8 --output-file`
@ -751,28 +749,6 @@ Options and their Descriptions
This **can not** be specified in config files.
.. option:: --install-hook=VERSION_CONTROL_SYSTEM
:ref:`Go back to index <top>`
Install a hook for your version control system that is executed before
or during commit.
The available options are:
- git
- mercurial
Command-line usage:
.. prompt:: bash
flake8 --install-hook=git
flake8 --install-hook=mercurial
This **can not** be specified in config files.
.. option:: --jobs=<n>
:ref:`Go back to index <top>`

View file

@ -36,83 +36,7 @@ plugins, use the ``additional_dependencies`` setting.
- id: flake8
additional_dependencies: [flake8-docstrings]
Built-in Hook Integration
=========================
.. note::
It is strongly suggested to use |Flake8| via `pre-commit`_ over the
built-in hook mechanisms. ``pre-commit`` smooths out many of the rough
edges of ``git`` and is much more battle-tested than the |Flake8|
hook implementation.
|Flake8| can be integrated into your development workflow in many ways. A
default installation of |Flake8| can install pre-commit hooks for both
`Git`_ and `Mercurial`_. To install a built-in hook, you can use the
:option:`flake8 --install-hook` command-line option. For example, you can
install a git pre-commit hook by running:
.. prompt:: bash
flake8 --install-hook git
This will install the pre-commit hook into ``.git/hooks/``. Alternatively,
you can install the mercurial commit hook by running
.. prompt:: bash
flake8 --install-hook mercurial
Preventing Commits
==================
By default, |Flake8| does not prevent you from creating a commit with these
hooks. Both hooks can be configured to be strict easily.
Both our Git and Mercurial hooks check for the presence of ``flake8.strict``
in each VCS' config. For example, you might configure this like so:
.. prompt:: bash
git config --bool flake8.strict true
hg config flake8.strict true
Checking All Modified Files Currently Tracked
=============================================
.. note::
Mercurial does not have the concept of an index or "stage" as best as I
understand.
|Flake8| aims to make smart choices that keep things fast for users where
possible. As a result, the |Flake8| Git pre-commit will default to only
checking files that have been staged (i.e., added to the index). If, however,
you are keen to be lazy and not independently add files to your git index, you
can set ``flake8.lazy`` to ``true`` (similar to how you would set
``flake8.strict`` above) and this will check all tracked files.
This is to support users who often find themselves doing things like:
.. prompt:: bash
git commit -a
.. note::
If you have files you have not yet added to the index, |Flake8| will not
see these and will not check them for you. You must ``git-add`` them
first.
.. _pre-commit:
https://pre-commit.com/
.. _pre-commit docs:
https://pre-commit.com/#pre-commit-configyaml---hooks
.. _Git:
https://git-scm.com/
.. _Mercurial:
https://www.mercurial-scm.org/