integrated-application-development / delphilint

Delphi IDE package providing on-the-fly code analysis and linting, powered by SonarDelphi
GNU Lesser General Public License v3.0
87 stars 13 forks source link

Display SonarDelphi errors instead of failing scan #67

Closed fourls closed 1 month ago

fourls commented 1 month ago

This PR refactors the handling of errors that occur within SonarDelphi during analysis. Previously, any error-level logging would cause the analysis to fail with a fatal error, which is inaccurate - SonarDelphi is quite resilient to errors and can conduct a successful partial analysis in most cases an error appears. This new approach communicates the logs directly to the client along with any results, leaving the user free to determine how important the error is / continue using DelphiLint while they identify the problem.

A new "View Last Analysis Log" option is available in the "Analyze" dropdown:

image

Clicking this after an analysis shows a log window with options to save a log file or report an issue on integrated-application-development/sonar-delphi:

image

If the analysis produces errors, then the following shows up (clicking opens the log):

image

If the analysis produces warnings, then the following shows up (clicking opens the log):

image

Example of a log with errors:

image

fourls commented 1 month ago

(rebase)

fourls commented 1 month ago

Updated now based on feedback.

Log description:

image

GitHub icon (dark theme):

image

GitHub icon (light theme):

image

Should we have more visual feedback on the Errors and Warnings buttons?

  • The little magnifying glass is cute, but easy to miss.
  • Tooltip on hover saying "View analysis log" or similar
  • Background color change on hover, like with other buttons.

VCL is surprisingly restrictive with what it lets you do with buttons. I've added a tooltip, but the background color is totally dependent on the theme. In light mode, for example, it actually does darken the buttons:

light_mode_errors

There's not too much I can do without implementing a custom control. I don't think what we have now will be too much of a problem - it's so colourful and angry that I expect most people will click on it anyway.