Rubocop analysis fails: "Custom tool exited with code 0 but returned invalid JSON"




I was testing Lift with a Ruby repository and encountered — what appears to be — errant behaviour. It appears that Lift is running Rubocop, but is receiving an unexpected output.

Running Rubocop
Sanitizing repository
CustomTool "Rubocop" - Invalid Json Error: Custom tool exited with code 0 but returned invalid JSON: Error in $: not enough input

Hi @rgomez , thanks for sharing your bad experience. We should be showing errors in the console logs when they’re encountered. We have a ticket created to address these types of issues to give a clear understanding of why something is failing.

Your specific failure is due to a dependency conflict with rubocop. The specific error I’m seeing is

Unable to activate rubocop-github-0.16.1, because rubocop-1.17.0 conflicts with rubocop (<= 1.6.1)

If you add a setup script with the following commands it should setup your environment to correctly get results:

gem install bundler
apt-get install -y ruby-dev
bundler install
gem uninstall rubocop --version 1.17.0

This should ensure that the version of rubocop required by your app matches correctly.

Thanks, @mjohnson.

I’ve noticed similar failures for JavaScript projects analyzed with ES Lint.

No plans to run tools that require a compilation database. Short-circuiting.
Running V1 API (bulk) tools
Running ESLint
Sanitizing repository
Using .eslintrc configurationfile in repository
Failure {failureType = "SolverError", failureMessage = "ESLint", failureActionableInformation = Nothing, solverName = Just "failed to decode output:\nError in $: not enough input", hostName = Nothing, httpCode = Nothing}
ESLint error output:
Oops! Something went wrong! :(
ESLint: 7.29.0
ESLint couldn't find the plugin "eslint-plugin-import".
(The package "eslint-plugin-import" was not found when loaded as a Node module from the directory "/tmp/analyzing-e29fbfd63d9a2676".)
It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:
    npm install eslint-plugin-import@latest --save-dev
The plugin "eslint-plugin-import" was referenced from the config file in "tmp/analyzing-e29fbfd63d9a2676/.eslintrc.js".
If you still can't figure out the problem, please stop by to chat with the team.
Analysis failed in 0 seconds