Skip to content

Commit

Permalink
Added an .editorconfig. Pull request #43.
Browse files Browse the repository at this point in the history
  • Loading branch information
KOLANICH authored and jaraco committed Feb 21, 2021
1 parent 743af72 commit 38fff62
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
charset = utf-8
indent_style = tab

This comment has been minimized.

Copy link
@KOLANICH

KOLANICH Feb 21, 2021

Author Contributor

👍 (though in my projects I use tabs even for python code in violation of PEP 8)

This comment has been minimized.

Copy link
@jaraco

jaraco Feb 21, 2021

Owner

Yeah, me too, and it's still my preference, and if I could get an auto-formatter that was as popular as black but preserved tabs, I'd be tempted to use that instead. However, this project also aims to follow best-practices (by popularity) even if they conflict with best practices (by reason), so I guess no amount of custom tooling would make up for the fact that most of the community has assented to spaces for indentation. Also, tabs doesn't violate PEP-8. It just violates people's over-reading of PEP 8. PEP 8 only speaks to formatting of code in the standard library.

This comment has been minimized.

Copy link
@KOLANICH

KOLANICH Feb 21, 2021

Author Contributor

if I could get an auto-formatter that was as popular as black but preserved tabs

I just patch black. It has a hardcoded (since it is "uncompromising") string of 4 spaces, the only thing to make it indent with tabs is to just replace it with \t (can be done with sed). Of course a better approach may be to create a setup.py cloning the original black, parsing it into AST, patching it to support both (i.e autodetecting from the code) and serializing it back with astor (or maybe even libcst), and then publishing under another name. Or maybe just do it on the fly either with AST modification, or bytecode one, so no serialization at all is needed.

Also, tabs doesn't violate PEP-8. It just violates people's over-reading of PEP 8. PEP 8 only speaks to formatting of code in the standard library.

Thanks for getting me known!

indent_size = 4
insert_final_newline = true
end_of_line = lf

[*.py]
indent_style = space

[*.{yml,yaml}]
indent_style = space
indent_size = 2
4 changes: 2 additions & 2 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ doctest_optionflags=ALLOW_UNICODE ELLIPSIS
# workaround for warning pytest-dev/pytest#6178
junit_family=xunit2
filterwarnings=
# https://github.com/pytest-dev/pytest/issues/6928
ignore:direct construction of .*Item has been deprecated:DeprecationWarning
# https://github.com/pytest-dev/pytest/issues/6928
ignore:direct construction of .*Item has been deprecated:DeprecationWarning

0 comments on commit 38fff62

Please sign in to comment.