Skip to content

Conversation

@mary-georgiou-sonarsource
Copy link
Contributor

@mary-georgiou-sonarsource mary-georgiou-sonarsource commented May 22, 2024

Fixes #9263

RSPEC PR: SonarSource/rspec#3942

@mary-georgiou-sonarsource mary-georgiou-sonarsource changed the title Rule S6964 FN: rule should raise in case of value type property annotated with RequiredAttribute Fix S6964 FN: rule should raise in case of value type property annotated with RequiredAttribute May 22, 2024
@mary-georgiou-sonarsource
Copy link
Contributor Author

@zsolt-kolbay-sonarsource - I haven't updated the ITs yet - I prefer to get the first round of review since, for example, the message or what we raise might change.
Once we are ok with these I'll update the ITs once and add some more cases as well.

Copy link
Contributor

@zsolt-kolbay-sonarsource zsolt-kolbay-sonarsource left a comment

Choose a reason for hiding this comment

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

LGTM. Left one comment on the RSPEC PR that should addressed before merging this PR.

using Microsoft.AspNetCore.Mvc;
using System;
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
Copy link
Contributor

Choose a reason for hiding this comment

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

Now that we know that [Required] doesn't affect value properties, please change this comment to:

// Compliant - the JSON serializer will throw an exception if the value is missing from the request

@mary-georgiou-sonarsource mary-georgiou-sonarsource changed the title Fix S6964 FN: rule should raise in case of value type property annotated with RequiredAttribute Fix S6964 FN: Rule should raise in case of value type property annotated with RequiredAttribute May 27, 2024
@mary-georgiou-sonarsource mary-georgiou-sonarsource force-pushed the mary/S6964-last branch 2 times, most recently from 74c4793 to 68adace Compare May 27, 2024 13:45
@sonarqubecloud
Copy link

Quality Gate Passed Quality Gate passed for 'Sonar .NET Java Plugin'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@sonarqubecloud
Copy link

@mary-georgiou-sonarsource mary-georgiou-sonarsource merged commit e3a08cf into master May 27, 2024
@mary-georgiou-sonarsource mary-georgiou-sonarsource deleted the mary/S6964-last branch May 27, 2024 14:53
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.

Fix S6964 FN: Rule should raise in case of value type property annotated with RequiredAttribute

2 participants