paetzke / py-autopep8.el

py-autopep8.el integrates autopep8 into Emacs.
GNU General Public License v3.0
79 stars 21 forks source link

setup.cfg ignored #24

Open henniss opened 7 years ago

henniss commented 7 years ago

I'd like to be able to disable autopep8 by default, and enable on a per-repository basis.

I have the following:

~/.config/pep8:

[pep8]
select=None

$PROJECT/setup.cfg

[pep8]
select=

When I run autopep8 $PROJECT/bad.py, this behaves as I expect, and bad.py is printed with errors corrected. Furthermore, if I remove setup.cfg, autopep8 will respect the user config and will no longer correct errors.

However, if I open up bad.py with emacs, py-autopep8 reports the buffer as already pep8ified, as if setup.cfg wasn't there. (py-autopep8 works fine if I edit the user config, but that's not the behavior I want).

bsima commented 7 years ago

I too am having this issue. It causes conflicts with project-specific pep8 settings, which is inhibitory in some use-cases where you want to enforce formatting settings across all dev environments. I'm going with a git precommit hook for now instead of an emacs plugin.

piojanu commented 5 years ago

The same here, I had to disable py-autopep8 :/ Any work around for this issue?

ideasman42 commented 2 years ago

This happened because the temporary file caused the local configuration not to be detected.

Resolved in my repo which used stdin/stdout pipes to format, changing the working directory to that of the file causes the configuration to be loaded properly in my tests https://github.com/ideasman42/emacs-py-autopep8/commit/171a69198e7a379622b84a51239f3e621219f9a0

ideasman42 commented 2 years ago

Melpa now points to a fork of this package maintained here: https://github.com/ideasman42/emacs-py-autopep8

Detecting local configuration is supported, although I've only added support for pyproject.toml which seems to be the recommended configuration these days. Writing checks for other kinds of files is trivial.