When no SCM provider is used with the scanner, no SCM information is sent to changed and new files.
The Compute Engine should generate change dates for all lines which were changed or added.
Report with SCM Info
When the scanner report includes any SCM data for a file, it should be taken without further modifications. Lines without SCM info will likely be commited later and therefore included later in the leak.
File marked as "Copy from previous"
This means that the file was not modified.
We should try to fetch the SCM data from DB.
If no data is present, means that this file was never changed since the new version of SonarQube was installed.
File is modified but no SCM Info is sent at all
In this case we should do a diff with DB to find out which lines were added or modified. For those lines, generate we generate ScmInfo with a date which is the current analysis date. The revision and author will be null. We reset the revision and author for existing lines, but keep the date.
1. New files, no SCM used
- Diff will tell that all lines are new -> generate date for all lines
2. Changed files without SCM, SCM was never used but dates were generated before
- Do a diff, reuse old dates as possible, generate new dates for changed/new lines
3. Changed files without SCM, SCM was used before (new lines are not commited yet)
- Do a diff, reuse old dates generate new dates but reset author and revision for changed/new lines
For the time being, we'll keep SCM info we had in the past for the lines that haven't changed.
4. Changed files without SCM, SCM was never used (migration)
- Do a diff -> generate new dates for changed/new lines (same as 2.). Existing lines will have no information.
5. Changed files with SCM info
- Simply overwrites what is in the DB.
6. Unchanged file
- If "Copy from previous" is set, we won't do anything. We will use whatever is in DB (can be empty).
- If blame information is sent, it simply overwrites what is in the DB (same as 5.)