www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - [SAOC 2024] Improve D Error Messages - Weekly Update #4


This week, I focused on adding SARIF (Static Analysis Results 
Interchange Format) report generation to the DMD compiler. The 
current PR introduces a `--sarif` compiler flag to produce 
structured SARIF output for error messages, which can be 
integrated with tools like GitHub’s SARIF viewer.

**PR-** [feat(errors): add SARIF report 
generation](https://github.com/dlang/dmd/pull/16986)



  1. **SARIF Report Generation via Compiler Flag**
I added support for generating SARIF reports using the `--sarif` 
flag. When used, the compiler outputs error messages in SARIF 
format, making it easier for integration with static analysis 
tools.

  2. **Implemented MessageStyle (To Be in a Separate PR)**
Although the current PR focuses on the `--sarif` flag, I also 
implemented SARIF reporting using `MessageStyle`. Based on 
feedback, I will move this to a separate PR once the current one 
is merged.


- I learned a lot from working on this PR, especially since it 
was a valuable addition to DMD. It required careful planning and 
implementation of new functionality.
- I will also address handling multiple diagnostics in the SARIF 
report format in a separate PR.


- I will continue adding updates here and look into addressing 
feedback.
- I still need to add tests for these changes to ensure 
everything works as expected.
Oct 14