Paths are printed to text sinks, and for SARIF sinks each path is added as
a ``codeFlow`` object (see SARIF 2.1.0
-`3.36 codeFlow object <https://docs.oasis-open.org/sarif/sarif/v2.1.0/errata01/os/sarif-v2.1.0-errata01-os-complete.html#_Toc141790990>`_).
+`§3.36 codeFlow object <https://docs.oasis-open.org/sarif/sarif/v2.1.0/errata01/os/sarif-v2.1.0-errata01-os-complete.html#_Toc141790990>`_).
Fix-it hints are printed to text sinks, and are emitted by SARIF sinks
as ``fix`` objects (see SARIF 2.1.0
-`3.55 fix object <https://docs.oasis-open.org/sarif/sarif/v2.1.0/errata01/os/sarif-v2.1.0-errata01-os-complete.html#_Toc141791131>`_).
+`§3.55 fix object <https://docs.oasis-open.org/sarif/sarif/v2.1.0/errata01/os/sarif-v2.1.0-errata01-os-complete.html#_Toc141791131>`_).
Fix-it hints within a :type:`diagnostic` are "atomic": if any hints can't
be applied, none of them will be, and no fix-its hints will be displayed
.. code-block:: console
- progname: erreur: can't find « free »
+ progname: erreur: can't find « foo »
Note that:
If libgdiagnostics cannot open the file, it will merely print::
- foo.c:17:8: error: can't find 'foo'
+ foo.c:17:8: error: can't find 'foo.h'
A range can span multiple lines within the same file.
We want to generate output like this::
- test-with-note.c:17:11: error: can't find 'foo'
+ test-with-note.c:17:11: error: can't find 'foo.h'
17 | #include <foo.h>
| ^~~~~
test-with-note.c:17:11: note: have you looked behind the couch?
On compiling and running the program, we should get the desired output::
- test-with-note.c:17:11: error: can't find 'foo'
+ test-with-note.c:17:11: error: can't find 'foo.h'
17 | #include <foo.h>
| ^~~~~
test-with-note.c:17:11: note: have you looked behind the couch?
suggestions for the user on how to edit their code to fix a problem. These
can be expressed as insertions, replacements, and removals of text.
-For example, here we add a replacement fix-it hint to a diagnostic:
+For example, here we use :func:`diagnostic_add_fix_it_hint_replace` to add
+a replacement fix-it hint to a diagnostic:
.. literalinclude:: ../../../testsuite/libgdiagnostics.dg/test-fix-it-hint.c
:language: c
| (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
and for SARIF sinks the path will be added as a ``codeFlow`` object
-(see SARIF 2.1.0 `3.36 codeFlow object <https://docs.oasis-open.org/sarif/sarif/v2.1.0/errata01/os/sarif-v2.1.0-errata01-os-complete.html#_Toc141790990>`_).
+(see SARIF 2.1.0 `§3.36 codeFlow object <https://docs.oasis-open.org/sarif/sarif/v2.1.0/errata01/os/sarif-v2.1.0-errata01-os-complete.html#_Toc141790990>`_).
Here's the above example in full: