I have two HTML reports generated from sonar showing the issues in my code.
Problem Statement: I need to compare two sonar reports and find out the differences i.e. new issues that got introduced. Basically need to find differences in html and print those differences only.
I tried a few things:
import difflibfile1 = open('sonarlint-report.html', 'r').readlines()file2 = open('sonarlint-report_latest.html', 'r').readlines()htmlDiffer = difflib.HtmlDiff()htmldiffs = htmlDiffer.make_file(file1, file2)with open('comparison.html', 'w') as outfile: outfile.write(htmldiffs)
Now this gives me a comparison.html which is nothing but two html diff. Doesn't print only the different lines.
Should I try HTML parsing and then somehow get the differences only to be printed?