-
Notifications
You must be signed in to change notification settings - Fork 181
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
JS-155 SonarJS exposes entry point to the parser for testing #4734
Conversation
3ec5834
to
0cf360c
Compare
* This class will contain only information required by {@link BridgeServerImpl}. | ||
* This will reduce the dependency on external API, and ease the testing. | ||
*/ | ||
public record BridgeServerConfig(Configuration config, String workDirAbsolutePath, SonarProduct product) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a first step toward removing the dependency over sonar.api
in the Bridge. I failed to remove everything, as we rely deeply on the Configuration
object. I tried to wrap the object, store only the result that we need, but both solution result in a lot of non-trivial changes.
It is a bit annoying, as it means you will need to have the classes from sonar.api
when using the standalone... But I'm afraid we will have to deal with it for now.
I still miss a bit of coverage. I'm really surprised to see the lines in |
@Test | ||
void should_throw_exception_when_fail_to_parse_code() { | ||
assertThatThrownBy(() -> parser.parse("...")) | ||
.isInstanceOf(IllegalStateException.class) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe throw ParseException instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After thinking about it, this exception takes an offset, I'm not sure it makes sense in our context. It is probably meant to be used when parsing Java Objects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed, let's use IllegalArgumentException
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one small change proposal, otherwise LGTM
2ed4d63
to
101d01e
Compare
Quality Gate failedFailed conditions |
No description provided.