-
Notifications
You must be signed in to change notification settings - Fork 226
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
Fix S3254 FN: primary constructors #8222
Conversation
@@ -2,6 +2,58 @@ | |||
"issues": [ | |||
{ | |||
"id": "S3254", | |||
"message": "Remove this default value assigned to parameter 'lifetime'.", | |||
"location": { | |||
"uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/sources/Nancy/src/Nancy/Bootstrapper/NancyBootstrapperWithRequestContainerBase.cs#L125", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TP: Constructor:
Line 125 in 21bb286
.Select(tr => new TypeRegistration(tr.RegistrationType, tr.ImplementationType, Lifetime.Singleton))) |
"id": "S3254", | ||
"message": "Remove this default value assigned to parameter 'lifetime'.", | ||
"location": { | ||
"uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/sources/Nancy/src/Nancy/Bootstrapper/NancyBootstrapperWithRequestContainerBase.cs#L134", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TP: Constructor
Line 134 in 21bb286
.Select(tr => new CollectionTypeRegistration(tr.RegistrationType, tr.ImplementationTypes, Lifetime.Singleton))) |
"id": "S3254", | ||
"message": "Remove this default value assigned to parameter 'disableMethodNotAllowedResponses'.", | ||
"location": { | ||
"uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/sources/Nancy/src/Nancy/RouteConfiguration.cs#L12", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TP: Constructor:
public static readonly RouteConfiguration Default = new RouteConfiguration( | |
disableMethodNotAllowedResponses: false, |
"id": "S3254", | ||
"message": "Remove this default value assigned to parameter 'explicitHeadRouting'.", | ||
"location": { | ||
"uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/sources/Nancy/src/Nancy/RouteConfiguration.cs#L13", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TP: Constructor
public static readonly RouteConfiguration Default = new RouteConfiguration( | |
disableMethodNotAllowedResponses: false, | |
explicitHeadRouting: false); |
"id": "S3254", | ||
"message": "Remove this default value assigned to parameter 'runtimeViewDiscovery'.", | ||
"location": { | ||
"uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/sources/Nancy/src/Nancy/ViewConfiguration.cs#L12", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TP: Constructor
public static readonly ViewConfiguration Default = new ViewConfiguration( | |
runtimeViewDiscovery: false, | |
runtimeViewUpdates: false); |
"id": "S3254", | ||
"message": "Remove this default value assigned to parameter 'redeliveryBurstLimit'.", | ||
"location": { | ||
"uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/sources/akka.net/src/core/Akka.Persistence/Persistence.cs#L464", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above:
sonar-dotnet/analyzers/its/sources/akka.net/src/core/Akka.Persistence/Persistence.cs
Line 464 in 21bb286
return Copy(null, null, null, maxUnconfirmedMessages); |
"id": "S3254", | ||
"message": "Remove this default value assigned to parameter 'unconfirmedAttemptsToWarn'.", | ||
"location": { | ||
"uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/sources/akka.net/src/core/Akka.Persistence/Persistence.cs#L464", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
sonar-dotnet/analyzers/its/sources/akka.net/src/core/Akka.Persistence/Persistence.cs
Line 464 in 21bb286
return Copy(null, null, null, maxUnconfirmedMessages); |
"id": "S3254", | ||
"message": "Remove this default value assigned to parameter 'redeliverInterval'.", | ||
"location": { | ||
"uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/sources/akka.net/src/core/Akka.Persistence/Persistence.cs#L474", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
sonar-dotnet/analyzers/its/sources/akka.net/src/core/Akka.Persistence/Persistence.cs
Line 474 in 21bb286
return Copy(null, redeliveryBurstLimit); |
"id": "S3254", | ||
"message": "Remove this default value assigned to parameter 'redeliverInterval'.", | ||
"location": { | ||
"uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/sources/akka.net/src/core/Akka.Persistence/Persistence.cs#L484", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two TPs:
sonar-dotnet/analyzers/its/sources/akka.net/src/core/Akka.Persistence/Persistence.cs
Line 484 in 21bb286
return Copy(null, null, unconfirmedAttemptsToWarn); |
@@ -54,6 +54,32 @@ | |||
}, | |||
{ | |||
"id": "S3254", | |||
"message": "Remove this default value assigned to parameter 'writerGuid'.", | |||
"location": { | |||
"uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/sources/akka.net/src/contrib/persistence/Akka.Persistence.Sql.Common/Journal/BatchingSqlJournal.cs#L1361", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I stopped here:
TP
Line 1361 in 21bb286
return new Persistent(deserialized, sequenceNr, persistenceId, manifest, isDeleted, ActorRefs.NoSender, null, timestamp); |
{ | ||
var hasDefaultValue = ArgumentHasDefaultValue(argumentMapping, c.SemanticModel); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still not 100% sure about reverting a PR that we are not sure about why it was introduced in the first place. I suggest asking @pavel-mikula-sonarsource and if he's ok we can move on. With the current information, I think you are right, and even with methods with lengthy parameters, we should raise and suggest to use named arguments (see my other comment).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We got no feedback from @pavel-mikula-sonarsource until now. We either merge today before peach deployment or the PR will not be part of the release. There are only a few new issues in the ITs related to this change and the new issues are TPs (e.g. https://github.com/SonarSource/sonar-dotnet/pull/8222/files#r1365174847).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line was introduced as a fix to #4620, because it was fixing annoying FP in the rule.
de5f27a
to
d01a843
Compare
Kudos, SonarCloud Quality Gate passed! |
Kudos, SonarCloud Quality Gate passed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Peach validation: New issues: 1215 all TPs The distribution of new issues is about:
|
Fixes #8096
Also reverts #4620
Blocked by #8238