Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent issues from being reported when in Razor generated file or content after mapped back #7940

Merged

Conversation

sebastien-marichal
Copy link
Contributor

@sebastien-marichal sebastien-marichal commented Sep 1, 2023

Fixes #7930

Should be merged after #7932

Copy link
Contributor

@csaba-sagi-sonarsource csaba-sagi-sonarsource left a comment

Choose a reason for hiding this comment

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

Few small suggestions.

@csaba-sagi-sonarsource
Copy link
Contributor

Also, in theory once these changes are done we should be able to remove

<!-- Once the correct location mapping for razor generated files is implemented the following two configurations can be removed. -->
. If not then we will be able to remove it once the noisy rules for razor are disabled.

@sebastien-marichal sebastien-marichal force-pushed the sebastien/razor-mapped-location branch 3 times, most recently from 06343be to 3208b4c Compare September 5, 2023 09:35
@sebastien-marichal sebastien-marichal force-pushed the sebastien/disable-issue-razor-generated-content branch from f704783 to b3947bd Compare September 5, 2023 09:35
@sebastien-marichal sebastien-marichal force-pushed the sebastien/disable-issue-razor-generated-content branch from b3947bd to e52f1c9 Compare September 5, 2023 12:09
Base automatically changed from sebastien/razor-mapped-location to master September 5, 2023 12:55
@sebastien-marichal sebastien-marichal force-pushed the sebastien/disable-issue-razor-generated-content branch from e52f1c9 to d8fd500 Compare September 5, 2023 13:50
@sebastien-marichal sebastien-marichal marked this pull request as ready for review September 5, 2023 13:52
@sebastien-marichal sebastien-marichal force-pushed the sebastien/disable-issue-razor-generated-content branch 2 times, most recently from b24d40b to 5ee622e Compare September 6, 2023 09:09
Copy link
Contributor

@csaba-sagi-sonarsource csaba-sagi-sonarsource left a comment

Choose a reason for hiding this comment

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

Looks good, what I am afraid of is that we don't have a single intentional test that changes this change. Even the ITs that would fail are not the Razor or Blazor support samples that we added for razor blazor testing. The NetCore app It can be freely removed and from that point on we would have no tests.
Could you please add a UT on .net side and introduce some issues for the razor blazor app that would raise without your changes?

{
using var scope = new EnvironmentVariableScope(false) { EnableRazorAnalysis = true };
new VerifierBuilder()
.AddAnalyzer(() => new DummyAnalyzerRazorGeneratedCode())
Copy link
Contributor

Choose a reason for hiding this comment

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

There is no need to create a new dummy analyzer. you can also you DummyCS to assert the functionality.

Suggested change
.AddAnalyzer(() => new DummyAnalyzerRazorGeneratedCode())
.AddAnalyzer(() => new DummyCS())

Copy link
Contributor

@csaba-sagi-sonarsource csaba-sagi-sonarsource left a comment

Choose a reason for hiding this comment

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

I am approving, but please address the comment I left before merging.

- Prevent report if location still in generated content after location mapping
- Do not analyse if SyntaxNode is in location that cannot be mapped to the original file
@sebastien-marichal sebastien-marichal force-pushed the sebastien/disable-issue-razor-generated-content branch from 77a761b to ca0c80e Compare September 8, 2023 11:49
@sonarcloud
Copy link

sonarcloud bot commented Sep 8, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@sonarcloud
Copy link

sonarcloud bot commented Sep 8, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@sebastien-marichal sebastien-marichal merged commit 463fc5a into master Sep 8, 2023
22 checks passed
@sebastien-marichal sebastien-marichal deleted the sebastien/disable-issue-razor-generated-content branch September 8, 2023 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prevent issues from being reported when in Razor generated file or content after mapped back
2 participants