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

Python flavor image failing: FileNotFoundError: [Errno 2] No such file or directory: 'shfmt' #266

Closed
bcdady opened this issue Jan 18, 2021 · 2 comments · Fixed by #267
Closed
Labels
bug Something isn't working

Comments

@bcdady
Copy link

bcdady commented Jan 18, 2021

Describe the bug
Running the the python 'flavor' image errors out instead of displaying the final SUMMARY table.
I was able to reproduce the error messages / symptom when running from both 'local' mega-linter-runner and also in my GitLab CI pipeline.
I was also able to reproduce this error with the 'documentation' flavor. The error does not show when running the full mega-linter image.

To Reproduce

  1. $> npx mega-linter-runner -p ~/repo/data/ci --flavor python
    1. See error

Expected behavior
mega-linter runs and display 'SUMMARY' table without errors

Error Output
[Text Reporter] Generated TEXT report: /builds/data/ci/report/linters_logs/SUCCESS-YAML_V8R.log
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/usr/local/lib/python3.8/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
File "/megalinter/MegaLinter.py", line 27, in run_linters
linter.run()
File "/megalinter/Linter.py", line 419, in run
return_code, stdout = self.process_linter(file)
File "/megalinter/Linter.py", line 528, in process_linter
return_code, return_output = self.execute_lint_command(command)
File "/megalinter/Linter.py", line 564, in execute_lint_command
process = subprocess.run(
File "/usr/local/lib/python3.8/subprocess.py", line 489, in run
with Popen(*popenargs, **kwargs) as process:
File "/usr/local/lib/python3.8/subprocess.py", line 854, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/local/lib/python3.8/subprocess.py", line 1702, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'shfmt'
"""
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/local/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/megalinter/run.py", line 15, in
linter.run()
File "/megalinter/MegaLinter.py", line 125, in run
self.process_linters_parallel(active_linters, linters_do_fixes)
File "/megalinter/MegaLinter.py", line 208, in process_linters_parallel
updated_linters = pool_result.get()
File "/usr/local/lib/python3.8/multiprocessing/pool.py", line 771, in get
raise self._value
FileNotFoundError: [Errno 2] No such file or directory: 'shfmt'

Additional context
macOS 11.1
zsh in iTerm2

@bcdady bcdady added the bug Something isn't working label Jan 18, 2021
@nvuillam
Copy link
Member

nvuillam commented Jan 18, 2021

Thanks for reporting, i'll have a look !

Meanwhile, you can bypass the error by adding the following in your .mega-linter.yml file at the root of your repository

DISABLE_LINTERS:
  - BASH_SHFMT

@nvuillam
Copy link
Member

@bcdady solved and released in 4.24.1 :)
shfmt uses go language, and go wasn't installed correctly in flavors not containing golangci-lint :)

If you still see an issue please reopen !

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.

2 participants