Skip to content

Commit

Permalink
Switch to formate for autoformatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
domdfcoding committed Jan 27, 2021
1 parent 2c73442 commit 007218c
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 49 deletions.
40 changes: 0 additions & 40 deletions .isort.cfg

This file was deleted.

8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ repos:
- id: remove-crlf
- id: forbid-crlf

- repo: https://github.com/domdfcoding/yapf-isort
rev: v0.5.5
- repo: https://github.com/repo-helper/formate
rev: v0.1.0
hooks:
- id: yapf-isort
exclude: ^(doc-source/conf|__pkginfo__|make_conda_recipe|setup)\.py$
- id: formate
exclude: ^(doc-source/conf|__pkginfo__|make_conda_recipe|setup)\.(_)?py$

- repo: https://github.com/domdfcoding/dep_checker
rev: v0.4.1
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ Install ``pre-commit`` with ``pip`` and install the git hook:
Coding style
--------------

`yapf-isort <https://pypi.org/project/yapf-isort/>`_ is used for code formatting.
`formate <https://formate.readthedocs.io>`_ is used for code formatting.

It can be run manually via ``pre-commit``:

.. code-block:: bash
$ pre-commit run yapf-isort -a
$ pre-commit run formate -a
Or, to run the complete autoformatting suite:
Expand Down
4 changes: 2 additions & 2 deletions doc-source/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ Install ``pre-commit`` with ``pip`` and install the git hook:
Coding style
--------------

`yapf-isort <https://pypi.org/project/yapf-isort/>`_ is used for code formatting.
`formate <https://formate.readthedocs.io>`_ is used for code formatting.

It can be run manually via ``pre-commit``:

.. prompt:: bash

pre-commit run yapf-isort -a
pre-commit run formate -a


Or, to run the complete autoformatting suite:
Expand Down
60 changes: 60 additions & 0 deletions formate.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
[hooks]
dynamic_quotes = 10
collections-import-rewrite = 20
reformat-generics = 40
noqa-reformat = 60
ellipsis-reformat = 70

[config]
indent = "\t"
line_length = 115

[hooks.yapf]
priority = 30

[hooks.isort]
priority = 50

[hooks.yapf.kwargs]
yapf_style = ".style.yapf"

[hooks.isort.kwargs]
line_length = 115
indent = "\"\t\t\""
multi_line_output = 8
import_heading_stdlib = "stdlib"
import_heading_thirdparty = "3rd party"
import_heading_firstparty = "this package"
import_heading_localfolder = "this package"
balanced_wrapping = false
lines_between_types = 0
use_parentheses = true
remove_redundant_aliases = true
default_section = "THIRDPARTY"
known_third_party = [
"apeye",
"betamax",
"click",
"coincidence",
"consolekit",
"coverage",
"coverage_pyver_pragma",
"deprecation_alias",
"domdf_python_tools",
"dulwich",
"github",
"github3_py",
"github3_utils",
"pymacaroons",
"pynacl",
"pytest",
"pytest_cov",
"pytest_randomly",
"pytest_timeout",
"repo_helper",
"requests",
"southwark",
"typing_extensions",
"virtualenv",
]
known_first_party = "repo_helper_github"
1 change: 0 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ exclude_lines =
if TYPE_CHECKING:
if typing.TYPE_CHECKING:
if __name__ == .__main__.:
:[\n\s]*\.\.\.
[check-wheel-contents]
ignore = W002
Expand Down

0 comments on commit 007218c

Please sign in to comment.