Closed TimvdLippe closed 6 years ago
This diff is easier to process using https://github.com/TestRoots/watchdog/pull/310/files?utf8=%E2%9C%93&diff=unified&w=1
Do I understand it correctly that in public Warning(int docLineNumber, T type, int lineNumber, Date warningCreationTime) {
, docLineNumber
is the total number of lines in that file at the point in time the warning was created? I think then that docTotalLines
(and/or documenting the above) would be clearer (I could only figure this out after reading your explanation above.)
Your understanding is correct :smile: I will add a clarifying comment in the Javadoc and rename the parameter.
In IntelliJ, the timing of the warning creation is different compared to the moment of
Document
parsing. The Document statistics are only obtained at the moment of transferring the information, e.g. when the file is saved in IntelliJ. However, the total number of line numbers in a file can be changed in the mean time.For example, a warning event can be generated on line 70 with the document having 72 lines, but then the developer deletes 6 lines. At this point, the full document has 66 lines, while the warning reports it was on line 70. Instead of having both 70 and 66, we should have 70 and 72 to make sure we capture the correct information.
To that end, call
intelliJDocument.getLineCount()
whenever we process a warning, to store this information prematurely and correctly.I have also fixed the indentation of all files I touched at the same time, to unify the indentation per file one at a time :smile: