Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

feat(rome_analyze): improve the diagnostics builder in the analyzer #2692

Merged
merged 2 commits into from
Jun 13, 2022

Conversation

leops
Copy link
Contributor

@leops leops commented Jun 9, 2022

Summary

This PR replicates the builder pattern implemented on rome_diagnostic::Diagnostic for the RuleDiagnostic type used internally by the analyzer rules. It should expose all the capabilities of normal diagnostics (including multiple labels and footers) with the notable exception of:

  • file_id: at the moment diagnostics are considered to belong to the file currently being analyzed
  • code: this property has its value set to the name of the rule that emitted the diagnostic
  • suggestions: rules that emit quick fix suggestions are expected to do so by emitting a code action

Additionally, it adds a new optional summary field to diagnostics containing a plain-text description of the issue, aimed at rendering contexts that don't support rich formatting (such as diagnostic popovers in editors)

Test Plan

Existing rules have been modified to use the new methods, and snapshots were updated accordingly

@leops leops temporarily deployed to aws June 9, 2022 16:44 Inactive
@github-actions
Copy link

github-actions bot commented Jun 9, 2022

@cloudflare-pages
Copy link

cloudflare-pages bot commented Jun 10, 2022

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: bd9d8fd
Status: ✅  Deploy successful!
Preview URL: https://fdbeb41e.tools-8rn.pages.dev
Branch Preview URL: https://feature-analyzer-diagnostic-.tools-8rn.pages.dev

View logs

@leops leops temporarily deployed to aws June 10, 2022 12:49 Inactive
@leops leops force-pushed the feature/analyzer-diagnostic-builder branch from ba7c79d to bdd68e4 Compare June 10, 2022 13:00
@leops leops temporarily deployed to aws June 10, 2022 13:00 Inactive
@leops leops changed the title feat(rome_analyze): implement the rome_diagnostic builder API on RuleDiagnostic feat(rome_analyze): improve the diagnostics builder in the analyzer Jun 10, 2022
@leops leops marked this pull request as ready for review June 10, 2022 14:08
@leops leops temporarily deployed to aws June 13, 2022 07:24 Inactive
@leops leops force-pushed the feature/analyzer-diagnostic-builder branch from 03d25e6 to bd9d8fd Compare June 13, 2022 12:05
@leops leops temporarily deployed to aws June 13, 2022 12:05 Inactive
@leops leops merged commit a3009e2 into main Jun 13, 2022
@leops leops deleted the feature/analyzer-diagnostic-builder branch June 13, 2022 12:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants