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

Create rule S6451: Do not escape quotes in code snippet’s attributes values #1242

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

github-actions[bot]
Copy link
Contributor

You can preview this rule here (updated a few minutes after each push).

@github-actions github-actions bot added the java label Sep 12, 2022
@Wohops Wohops changed the title Create rule S6451 Create rule S6451: Do not escape quotes in code snippet’s attributes values Sep 12, 2022
@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

@Wohops Wohops marked this pull request as ready for review September 12, 2022 15:10
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks nice, just a few comments.

@@ -0,0 +1,77 @@
In Javadoc code snippets introduced with Java 18, attributes' values can be quoted with single-quote (') characters or double-quote (") characters. Simple values, such as identifiers or numbers need not be quoted. According to Javadoc's specification, escape sequences are not supported in attribute value. Using them will therefore lead to unpredictable behaviors when parsing the snippet, at best, and "spurious markup" warnings being reported.

Choose a reason for hiding this comment

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

How about

Suggested change
In Javadoc code snippets introduced with Java 18, attributes' values can be quoted with single-quote (') characters or double-quote (") characters. Simple values, such as identifiers or numbers need not be quoted. According to Javadoc's specification, escape sequences are not supported in attribute value. Using them will therefore lead to unpredictable behaviors when parsing the snippet, at best, and "spurious markup" warnings being reported.
In Javadoc code snippets introduced with Java 18, attributes' values can be quoted with single-quote (') characters or double-quote (") characters. Simple values, such as identifiers or numbers don't need to be quoted. According to Javadoc's specification, escape sequences are not supported in the attribute values. Using them will therefore lead to unpredictable behaviors when parsing the snippet, at best, and "spurious markup" warnings being reported.

Choose a reason for hiding this comment

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

And I think it will be nice to use hyperlink when mentioning Javadoc specification

@@ -0,0 +1,18 @@
{
"title": "Do not escape quotes in code snippet attributes values",

Choose a reason for hiding this comment

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

According to this guideline rule titles should be "X should (not) Y"

How about "Quotes should not be escaped in the code snippet attributes values"?

"constantCost": "5min"
},
"tags": [
"javadoc"

Choose a reason for hiding this comment

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

Suggested change
"javadoc"
"javadoc",
"java18"

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants