Package com.lpvs.util
Class LPVSCommentUtil
java.lang.Object
com.lpvs.util.LPVSCommentUtil
Utility class providing methods for generating links and formatting matched lines in comments.
It includes functionality to create links to specific lines in a file on version control platforms
like GitHub, based on the provided
LPVSQueue
configuration, LPVSFile
, and LPVSVcs
.
This class is designed to enhance the generation of comment content by creating clickable links to specific lines in a file, making it easier for users to navigate directly to the relevant code.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
buildHTMLComment
(LPVSQueue webhookConfig, List<LPVSFile> scanResults, List<LPVSLicenseService.Conflict<String, String>> conflicts) Generates a formatted string for an HTML report with scan results.static String
getMatchedLinesAsLink
(LPVSQueue webhookConfig, LPVSFile file, LPVSVcs vcs) Generates a formatted string containing links to matched lines in a file.static String
reportCommentBuilder
(LPVSQueue webhookConfig, List<LPVSFile> scanResults, List<LPVSLicenseService.Conflict<String, String>> conflicts) Generates a formatted string for an LPVS GitHub comment.static void
saveHTMLToFile
(String htmlContent, String filePath) Saves HTML report to given location.
-
Constructor Details
-
LPVSCommentUtil
public LPVSCommentUtil()
-
-
Method Details
-
getMatchedLinesAsLink
Generates a formatted string containing links to matched lines in a file. -
reportCommentBuilder
public static String reportCommentBuilder(LPVSQueue webhookConfig, List<LPVSFile> scanResults, List<LPVSLicenseService.Conflict<String, String>> conflicts) Generates a formatted string for an LPVS GitHub comment.- Parameters:
webhookConfig
- TheLPVSQueue
configuration for the webhook.scanResults
- List containing preformatted scan results.conflicts
- List of conflicts, containing license conflict information.- Returns:
- A string containing scan results in GitHub-friendly format.
-
buildHTMLComment
public static String buildHTMLComment(LPVSQueue webhookConfig, List<LPVSFile> scanResults, List<LPVSLicenseService.Conflict<String, String>> conflicts) Generates a formatted string for an HTML report with scan results.- Parameters:
webhookConfig
- TheLPVSQueue
configuration for the webhook.scanResults
- List containing preformatted scan results.conflicts
- List containing license conflict information.- Returns:
- A string containing scan results in HTML format.
-
saveHTMLToFile
Saves HTML report to given location.- Parameters:
htmlContent
- The string, containing report in HTML format.filePath
- The path to expected html report file.
-