Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix running checkers on remote hosts via TRAMP. #1842

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

carrete
Copy link

@carrete carrete commented Dec 6, 2020

In response to #1816

This patch does three things:

  • Update flycheck-default-executable-find to search remote hosts when
    default-directory is a remote directory. See also the documentation for
    executable-find.

  • Change uses of call-process and start-process to start-file-process
    which is the same as these two functions, but starts the process on a remote
    host when default-directory is a remote directory. See also the
    documentation for
    start-file-process.

  • Passes the local part of buffer-file-name to the compile command,
    e.g. strips /ssh:10.0.0.42, since the checker is run on the remote machine
    where the file name must be local. See also the documentation for
    file-local-name.

@CLAassistant
Copy link

CLAassistant commented Dec 6, 2020

CLA assistant check
All committers have signed the CLA.

(command (mapconcat #'shell-quote-argument
(cons abs-prog (cdr wrapped)) " ")))
(cons program (cdr wrapped)) " ")))
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to be obsolete. flycheck-find-checker-executable calls flycheck-executable-find which calls executable-find which returns an absolute path.

@carrete
Copy link
Author

carrete commented Dec 6, 2020

I'll do something about the Travis CI errors

@carrete carrete force-pushed the master branch 2 times, most recently from 04804e9 to 647f11e Compare December 6, 2020 23:05
@cpitclaudel
Copy link
Member

👍 This is very exciting stuff. I'm swamped with work right now, but I should have time to look at this later this month. Hope that's OK!

@carrete
Copy link
Author

carrete commented Dec 7, 2020

👍 This is very exciting stuff. I'm swamped with work right now, but I should have time to look at this later this month. Hope that's OK!

Absolutely. I still have to get the tests to pass. I get different results locally 🤔

@carrete carrete force-pushed the master branch 3 times, most recently from 0c28c12 to ee9f4bc Compare December 12, 2020 17:41
@carrete
Copy link
Author

carrete commented Dec 12, 2020

First of all, this only works with Emacs 27.1, the first version to include the second, optional remote option to executable-find. The advice approach is the best I could do because even when (executable-find executable t) is behind a version check byte-compilation fails.

Please see my comment about start-file-process when let bound. I think it's true, though I'm not certain.

I don't know what's up with the tests. These https://gist.github.com/carrete/8ab881bc3ff1a9c20285f9edf6ce8ac6 are my local test results for Emacs 26.3 and 27.1 which both behave the same. I couldn't get Emacs 25.3 to work.

I have no idea why flycheck-set-checker-executable/file-not-executable fails. Apparently warnings.el is seen as executable even though its file permissions say it isn't. I see a recent pull-request, https://travis-ci.org/github/flycheck/flycheck/builds/741547489, that has the same spec failure so I assume the changes in this pull-request aren't to blame. The builds on Travis CI behave differently even though I used docker-tools and the same build and test commands in .travis.yml. I don't know why the results are different.

I've been using this version in my day job the past week and haven't noticed any problems. At this point I'm not sure what I should try next. Any ideas would be greatly appreciated, @cpitclaudel. No rush. Thanks!

@carrete carrete force-pushed the master branch 2 times, most recently from f5225e3 to 686424a Compare December 13, 2020 06:41
@carrete
Copy link
Author

carrete commented Dec 13, 2020

I pushed up an additional change that updates the built-in checkers. Sorry, I shouldn't have submitted the pull-request without this. I was distracted by the odd test failures and forgot about it. I still don't get the same results as on Travis CI. The tests behave better there than they do on my laptop. As for the remaining test failures on Travis CI, I believe these are because source (possibly more) needs to be tweaked somehow too before it's substituted in the checker definitions.

@Blade6570
Copy link

Hey, why not replace all executable-find to executable-find-add-remote? After I replaced it, I did not get any error.

@carrete
Copy link
Author

carrete commented Mar 31, 2021

@Blade6570 Do you mean tests passed? Provided I understand the issue correctly, the file name of the buffer must also be localized.

@yfyyfy
Copy link

yfyyfy commented Nov 22, 2021

Based on this pull request, I made further changes so that remote check works on my environment.
I also added support for eslint and stylelint.
Please see #1922 for the details.

@carrete
Copy link
Author

carrete commented Mar 18, 2023

I needed this recently so I took the opportunity to rebase this on top of the latest upstream, plus add the changes by @yfyyfy to fix the stylelint tests. With these and the move to GitHub Actions the tests now pass.

@peterbecich
Copy link

peterbecich commented May 29, 2023

Can this be merged? Or #1922 ? It would help me significantly. Thank you

flycheck.el Outdated Show resolved Hide resolved
flycheck.el Show resolved Hide resolved
@carrete
Copy link
Author

carrete commented May 30, 2023

@jcs090218 I added the flycheck- prefix as requested. Please let me know if you'd like me to make any other changes. Thanks for taking the time to look this over

@peterbecich
Copy link

Thank you @carrete and @jcs090218

@peterbecich
Copy link

Any chance this can be merged?

This patch does three things:

* Update `flycheck-default-executable-find` to search remote hosts when
  `default-directory` is a remote directory. See also the documentation for
  [executable-find](https://www.gnu.org/software/emacs/manual/html_node/elisp/Locating-Files.html).

* Change uses of `call-process` and `start-process` to `start-file-process`
  which is the same as these two functions, but starts the process on a remote
  host when `default-directory` is a remote directory. See also the
  documentation for
  [start-file-process](https://www.gnu.org/software/emacs/manual/html_node/elisp/Asynchronous-Processes.html).

* Passes the local part of `buffer-file-name` to the compile command,
  e.g. strips `/ssh:10.0.0.42`, since the checker is run on the remote machine
  where the file name must be local. See also the documentation for
  [file-local-name](https://www.gnu.org/software/emacs/manual/html_node/elisp/Magic-File-Names.html).
@peterbecich
Copy link

@marsam , any chance this can be merged? Thank you

@zabuxx
Copy link

zabuxx commented Jan 9, 2024

It would be great if this could be merged...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants