Check if RuboCop is available before searching for add-on #3071
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
This is a fix for the bug I just introduced in #3067 🤦♂️. We cannot assume that the
RuboCop
constant will be defined because projects may use a different formatter. We need to check first.Implementation
Started checking if the constant we need is defined as part of the check.
Automated Tests
Part of why this wasn't caught is because our integration tests were ignoring the response return for the initialize request.
That makes the tests extremely weak because the LSP will actually rescue anything that happens during initialize and then simply return an error back to the client, which means that tests passed despite initialization failing.
I started properly checking for what response was returned, so that we can fail tests if initialization was not successful. Without the fix, tests now properly fail.