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

feat(rome_service): add a max_diagnostics parameter to pull_diagnostics #3512

Merged
merged 2 commits into from
Oct 27, 2022

Conversation

leops
Copy link
Contributor

@leops leops commented Oct 27, 2022

Summary

This PR adds a new max_diagnostics field to PullDiagnosticsParams that limits how many diagnostics are emitted in the diagnostics field of PullDiagnosticsResult, and maintains a counter of skipped_diagnostics as well as an has_errors flag to allow checking if any of the skipped diagnostics had a severity of Error or higher. The max_diagnostics value is not a hard limit, and more diagnostics may be emitted by the parser. This new argument is used in the CLI since it's only printing a limited amount of diagnostics, the console thread now maintains an approximate counter of remaining_diagnostics that can still be printed, and the shared value of this counter is used as the value of max_diagnostics in the worker threads of the traversal.

Test Plan

This change is covered by the test suite of the CLI, none of the snapshots have been modified since it should be an internal change only.

@leops leops requested a review from ematipico as a code owner October 27, 2022 10:21
@leops leops requested a review from a team October 27, 2022 10:21
@netlify
Copy link

netlify bot commented Oct 27, 2022

Deploy Preview for rometools ready!

Name Link
🔨 Latest commit 7ded49d
🔍 Latest deploy log https://app.netlify.com/sites/rometools/deploys/635a74421774030008263a08
😎 Deploy Preview https://deploy-preview-3512--rometools.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@leops leops had a problem deploying to netlify-playground October 27, 2022 10:21 Failure
if let Some(mut diagnostic) = signal.diagnostic() {
diagnostic_count += 1;
Copy link
Contributor

@ematipico ematipico Oct 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note for the future, but I think it's fine for now. We are grouping diagnostics regardless of their severity, which means that:

  • errors and warnings are treated the same
  • the CLI won't show many errors and warnings were encountered/skipped/not shown

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workspace command could very easily expose individual skipped_errors / skipped_warnings / ... counters for each severity level if needed

@leops leops force-pushed the feature/pull-diagnostics-limit branch from 0bb94bd to 7ded49d Compare October 27, 2022 12:06
@leops leops temporarily deployed to netlify-playground October 27, 2022 12:06 Inactive
@github-actions
Copy link

@leops leops merged commit 69cf35d into main Oct 27, 2022
@leops leops deleted the feature/pull-diagnostics-limit branch October 27, 2022 12:28
@leops leops added A-Linter Area: linter A-CLI Area: CLI A-Diagnostic Area: errors and diagnostics labels Nov 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-CLI Area: CLI A-Diagnostic Area: errors and diagnostics A-Linter Area: linter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载