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

Run linter as Python package FileNotFoundError #67

Closed
larsdekwant opened this issue Jun 20, 2022 · 4 comments · Fixed by #68
Closed

Run linter as Python package FileNotFoundError #67

larsdekwant opened this issue Jun 20, 2022 · 4 comments · Fixed by #68
Labels
bug Something isn't working

Comments

@larsdekwant
Copy link

We were using the Windows linter in our project with fix from issue #50 . However, with the latest merge, running the linter as a Python package throws the following error: FileNotFoundError: [WinError 2] The system cannot find the file specified

The first action that failed for us, can be found here: https://github.com/red-panda-productions/DAISI/runs/6963055842?check_suite_focus=true

We have fixed the issue by cloning an older version of the master branch, but just wanted to let you know about this issue!

@2bndy5
Copy link
Collaborator

2bndy5 commented Jun 20, 2022

Thanks for reporting this. I think I made a mistake in the revised logic that creates the executable cmd. Your workflow shows it trying to use the Linux cmd clang-tidy-12 when it should be resolving to just clang-tidy (or path\to\bin\clang-tidy.exe if specifying the binary exe's path as the version option).

I'll have a fix submitted by tomorrow, but I need to test it (more/better). I honestly don't know how our last test didn't show this problem.

BTW, the Windows runner comes with v13, not v12. Unless your boost lib cache includes/overwrites the clang version that comes with the Windows venv. Sometimes I get lucky with cross-version differences of clang-tools, but usually there's breaking differences in what clang-tools expects in their config.

@shenxianpeng
Copy link
Collaborator

I honestly don't know how our last test didn't show this problem.

@2bndy5 Do you find the reason why our last test (in this run https://github.com/cpp-linter/test-cpp-linter-action/actions/runs/2527084295) did not show FileNotFoundError ? We'd better prevent it from happening again

@2bndy5
Copy link
Collaborator

2bndy5 commented Jun 22, 2022

After researching the point of error, I found that red-panda-productions/DAISI workflow is improperly passing the version number to the version arg. When running on a Windows runner, the only ways to invoke a clang tool executable is to use

  • clang-tidy / clang-format (this invokes whatever the default provided version is for the runner)
  • path\to\bin\clang-tidy.exe / path\to\bin\clang-format.exe (this is used to specify a specifically installed version)

As stated in the README, Windows runners now come with v13 of the clang tools. If you want to use a specifically installed version on Windows then you have to pass the path it was installed to. (see example in README). Our python code will then check if the path has a bin folder and execute path\to\bin\clang-<tool>.exe (only the path\to part needs to be passed to the version arg).

To summarize, the working state of the red-panda-productions/DAISI workflow passes 12 to the version arg, but our action will only execute clang-<tool>. This ends up using v13 because (from what I can tell) v12 is not installed in the runner's environment, and calling clang-<tool> (without the .exe) invokes whatever executable is found in the OS's PATH env variable.

@2bndy5
Copy link
Collaborator

2bndy5 commented Jun 22, 2022

My faulty logic revision in #66 (now fixed by #68) allowed this improper usage of the version arg to surface as an error. The bad logic ended up calling clang-tidy-12 on windows when that can only work on Linux (& possibly MacOS).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants