aspect-build / aspect-build/rules_lint

[FR]: Include suggested fixes in SARIF reports

Open
#749 2 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Starlark
Stars
154
Forks
125
Avg merge
3d 21h
Merged PRs (30d)
20

Description

### What is the current behavior?

Lint aspects currently produce two distinct sets of outputs: patches and (SARIF) reports. Tooling that wants to correlate reports to patches must be custom-built outside of this rule set. While each of these outputs is useful in isolation, it would improve the rule set if it were possible to produce correlated reports in SARIF format that includes suggested fixes.

### Describe the feature

The SARIF specification allows for the inclusion of `fixes` under `results`. Fixes specify a region to delete and replacement text to include.

There are a few different ways this could be implemented and depending on the tool, different strategies could be used. For example:
* The existing SARIF tool (`//tools/sarif`) could accept patches in addition to the raw machine reports and use a best-effort correlation strategy to match regions in the patch to the error messages in the reports.
* Some linters already include patches in their custom reports, and in some cases, the reports themselves are generated based on a diff. For example, the scalafix linter proposed in #711 produces SARIF entries for rewritten regions directly from a patch-like format.

Contributor guide

Open the contributing guide

Research direction

Start by reading the existing SARIF tool at //tools/sarif and how it consumes raw machine reports and patches. Compare the proposed best-effort correlation approach with linters that emit patch data directly, including the scalafix work in #711. Done means SARIF results contain correctly correlated fixes with deletion regions and replacement text.

Written by the indexing model from the issue text.

Assessment

Domain
devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.