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

Modify rule S4545: Add VB.NET specifics, Move C# specifics #1571

Merged

Conversation

antonioaversa
Copy link
Contributor

@antonioaversa antonioaversa commented Feb 13, 2023

Implementation SonarSource/sonar-dotnet#6703

Kept as draft as it is to be merged after SonarSource/sonar-dotnet#6728.

Remark: implementation merged before corresponding RSPEC is ready. Changes to the sonar-dotnet repo are to be expected, when running rspec update upon release.

@sonarsource-next
Copy link

SonarQube Quality Gate for 'rspec-tools'

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

@sonarsource-next
Copy link

SonarQube Quality Gate for 'rspec-frontend'

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

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.

Some minor comments. I'm not a fan of the name rule-expect-see.adoc, but I've seen it used in other rules as well, so it's just my preference.

rules/S4545/csharp/rule-except-see.adoc Outdated Show resolved Hide resolved
rules/S4545/rule.adoc Outdated Show resolved Hide resolved
@antonioaversa antonioaversa force-pushed the Antonio/S4545-debugger-display-attr-existing-members branch from 0c34ec6 to da704cd Compare February 23, 2023 09:38
@antonioaversa
Copy link
Contributor Author

Some minor comments. I'm not a fan of the name rule-expect-see.adoc, but I've seen it used in other rules as well, so it's just my preference.

I have restructured a bit the content:

  • removed the rule-except-see.adoc files
  • moved the content to the rule.adoc of each language
  • fixed the highlighting.adoc, which was inconsistent with the rule implementation
  • refined the description and align it with the implementation of the rule, which has evolved in the last few days

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

Copy link
Contributor

@mary-georgiou-sonarsource mary-georgiou-sonarsource left a comment

Choose a reason for hiding this comment

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

Generally looks good - only a minor change to the description to make it IMO clearer.

The ``DebuggerDisplayAttribute`` is used to determine how an object is displayed in the debugger window.


The ``DebuggerDisplayAttribute`` constructor takes a single mandatory argument: the string to be displayed in the value column for instances of the type. Any text within curly braces is evaluated as the name of a member, or any complex expression converted to a string value, containing method calls and operators.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
The ``DebuggerDisplayAttribute`` constructor takes a single mandatory argument: the string to be displayed in the value column for instances of the type. Any text within curly braces is evaluated as the name of a member, or any complex expression converted to a string value, containing method calls and operators.
The `DebuggerDisplayAttribute` constructor takes a single mandatory argument: the string to be displayed in the value column for instances of the type. Any text within curly braces is evaluated as the name of a field, property, or method or as a complex expression containing method calls and operators that is evaluated to a string.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  • Double backticks to single backticks => OK
  • Member to "field, property or method" => OK ("method" removed, see here)
  • "converted to a string value" to "That is evaluated to a string" => The second seems incorrect to me since expressions such as DebuggerDisplay("{42}") are correctly evaluated, despite 42 not being evaluated to a string. It's rather that the expression is evaluated to whatever object it evaluates to, and then a ToString() is called on that object. In any case, I have removed the subordinate altogether.

The ``DebuggerDisplayAttribute`` is used to determine how an object is displayed in the debugger window.


The ``DebuggerDisplayAttribute`` constructor takes a single mandatory argument: the string to be displayed in the value column for instances of the type. Any text within curly braces is evaluated as the name of member, or any complex expression converted to a string value, containing method calls and operators.
Copy link
Contributor

Choose a reason for hiding this comment

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

same proposal as above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in the same way it is described in #1571 (comment)

@antonioaversa antonioaversa force-pushed the Antonio/S4545-debugger-display-attr-existing-members branch from da704cd to 1cf3bad Compare February 27, 2023 17:26
@sonarsource-next
Copy link

SonarQube Quality Gate for 'rspec-frontend'

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

@sonarsource-next
Copy link

SonarQube Quality Gate for 'rspec-tools'

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

Copy link
Contributor

@mary-georgiou-sonarsource mary-georgiou-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

@antonioaversa antonioaversa marked this pull request as ready for review March 1, 2023 09:41
@antonioaversa antonioaversa merged commit d8afb22 into master Mar 1, 2023
@antonioaversa antonioaversa deleted the Antonio/S4545-debugger-display-attr-existing-members branch March 1, 2023 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants