(self)
| 248 | # ------------------------------------------------------------------ # |
| 249 | |
| 250 | def to_html(self) -> str: |
| 251 | html = f""" |
| 252 | <html> |
| 253 | <head><title>PySpector Scan Report</title></head> |
| 254 | <body> |
| 255 | <h1>PySpector Scan Report</h1> |
| 256 | <h2>Found {len(self.issues)} issues.</h2> |
| 257 | <table border='1' style='border-collapse: collapse; width: 100%;'> |
| 258 | <tr style='background-color: #f2f2f2;'> |
| 259 | <th style='padding: 8px;'>File</th> |
| 260 | <th style='padding: 8px;'>Line</th> |
| 261 | <th style='padding: 8px;'>Severity</th> |
| 262 | <th style='padding: 8px;'>Description</th> |
| 263 | <th style='padding: 8px;'>Code</th> |
| 264 | </tr> |
| 265 | """ |
| 266 | |
| 267 | for issue in self.issues: |
| 268 | html += f""" |
| 269 | <tr> |
| 270 | <td style='padding: 8px;'>{html_module.escape(issue.file_path)}</td> |
| 271 | <td style='padding: 8px;'>{issue.line_number}</td> |
| 272 | <td style='padding: 8px;'>{html_module.escape(str(issue.severity))}</td> |
| 273 | <td style='padding: 8px;'>{html_module.escape(issue.description)}</td> |
| 274 | <td style='padding: 8px;'><pre><code>{html_module.escape(issue.code)}</code></pre></td> |
| 275 | </tr> |
| 276 | """ |
| 277 | |
| 278 | html += "</table></body></html>" |
| 279 | |
| 280 | return html |
no outgoing calls