Giter Site home page Giter Site logo

py-yapf.el's People

Contributors

lins05 avatar nevsan avatar paetzke avatar purcell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

py-yapf.el's Issues

[bug]

Doesn't recognize python syntax.

    for row in list(X):
        add_values = add_feature(row.items())
        row = {**row, **add_values}

if row and add_values are dictionaries, this is valid syntax. py-yapf doesn't think it is. This might be upstream in yapf?

There a back door open by jose

When this backdoor open it leaves the integration variable and allows a hacker to clone and steal a person identity and accounts and inables apps. In the wanlsn

Add option for specifying yapf path

Sometimes yapf might be installed in a path that is not in $PATH. I don't actually know if this is what is currently preventing py-yapf from working for me, but regardless, it would be cool if I could set its path through customize.

Errors always ignored

Not sure if this is still being maintained, but I wanted to echo a few issues I had to correct to get an error message to show up properly on py-yapf-buffer in cases where yapf fails. Currently it simply says 'buffer is already yapfed' if anything goes wrong. Some of these have been echoed elsewhere but I found more than one issue so I'll list them all here.

Firstly, the if-statement determining whether to print a success/unchanged message as opposed to an error message incorrectly looks for a non-zero return value from the executable for its success case and also calls ignore-return-code as a function though it is a variable.
so this:

    (if (or (funcall executable-call errbuf tmpfile)
            (ignore-return-code))

should be this:

    (if (or (zerop (funcall executable-call errbuf tmpfile))
            ignore-return-code)

Furthermore, the actual call to that function is passing 't' for ignore-return-code. To get errors to show up this needs to be nil.
so this:

(defun py-yapf--call ()
  (py-yapf-bf--apply-executable-to-buffer "yapf" 'py-yapf--call-executable nil "py" t))

should be this:

(defun py-yapf--call ()
  (py-yapf-bf--apply-executable-to-buffer "yapf" 'py-yapf--call-executable nil "py" nil))

Hope this is useful. Happy to do a PR if this project is still being maintained...

error when use it on windows emacs 24.4

i have the
Error: (error "invalid rcs patch or internal error in py-yapf-bf--apply-rcs-patch")
when run py-yapf-buffer on any python file
i am using windows and emacs 24.4

i checked the source code of py-yapf.el but could not figure out why :(

compilation warning, potential bug

Hello, when installing through melpa I got the following compilation warning:

py-yapf.el:166:1:Warning: the function `ignore-return-code' is not known to be defined.

I think the warning is legit.

A error when saving

I find this mode is not compatible with the following configuration. A error occurs when saving.
(setq python-shell-virtualenv-path "/home/mike/.virtualenvs/python3")

Without the upper configuration and using pyenv to activate virtualenv, py-yapf woks nice.
I can't fix this problem.

make yapf apply on change region only

yapf can be very slow on large files. Maybe an option to only reformat the changed region, because it's not really make sense to reformat a reformated file everytime it saves

Suggested patch to handle syntax errors

Thank you for this excellent module!

I just have a suggestion: if there are any python syntax errors that occur during formatting, we currently simply get the message "Buffer is already yapfed". Instead of that, I believe it would be helpful to see these syntax errors. Therefore, I suggest this following patch, or something similar ...

--- py-yapf.el.orig	2017-11-18 12:36:18.017017290 -0500
+++ py-yapf.el	2017-11-18 12:36:27.086994492 -0500
@@ -139,7 +139,7 @@
         (if (zerop (call-process-region (point-min) (point-max) "diff" nil
                                         patchbuf nil "-n" "-" tmpfile))
             (progn
-              (kill-buffer errbuf)
+	      (switch-to-buffer errbuf)
               (pop kill-ring)
               (message (format "Buffer is already %sed" executable-name)))

What do you think?

Auto install yapf in a virtualenv?

In general, it would be really cool if py-yapf could install yapf automatically on demand.

We could limit the side-effects of this operations by executing it in a virtual environment. This is a common strategy for packages like jedi, anaconda-mode and others. See the way anaconda-mode does it here.

py-yapf does not use local style settings

yapf will normally look in directories upwards to see if it can find information in the [yapf] section in setup.cfg or the [yapf] section in .yapf.style. Because py-yapf operates on a file in /tmp, this settings are not respected.

It would be convenient if py-yapf would operate as if it were changing the file that a buffer represents.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.