-
Notifications
You must be signed in to change notification settings - Fork 93
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
SONARPY-2014 SONARPY-2377 Repair rules reading PythonVisitorContext.pythonFile.contents() on Jupyter notebooks #2192
Conversation
3f9b32d
to
d7eee32
Compare
d7eee32
to
a94ef9d
Compare
Small reminder to rebase master as there are changes in the notebook parser test |
We should maybe create a ticket to refactor |
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.
I think this looks good, as we mitigate a lot of issues. I think the next step is creating a few tickets.
And for this PR we could maybe move the parser to the frontend?
String fileId = path != null ? path.toString() : ipynbFile.toString(); | ||
LocationInFile locationInFile; | ||
if (begin.isCompresssed()) { | ||
var next = mapping.get(lineNumber + 1); |
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.
Here we could do a null check on next
, even if it should not happen we could create tests that can throw NPEs.
We could also just create a ticket (if it does not exists yet) and reference it in the code, specifying what we should
do to compute the correct location. This ticket should have a low priority as this should work for the majority of cases.
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.
What would we do if next
is null? I am not sure it is recoverable
|
||
@Test | ||
void trailing_whitespace() throws IOException { | ||
var inputFile = createInputFile(baseDir, "notebook_trailing_whitespace.ipynb", InputFile.Status.CHANGED, InputFile.Type.MAIN); |
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.
Should we move this parser then to the frontend? Not sure if there is a reason why we kept it here
a94ef9d
to
8348fc7
Compare
…tents() on Jupyter notebooks SONARPY-2014 TrailingWhitespaceCheck
8348fc7
to
c5e82ed
Compare
Quality Gate passedIssues Measures |
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.
LGTM! Thank you!
SONARPY-2377
SONARPY-2014 TrailingWhitespaceCheck