diff --git a/rules/S6850/html/metadata.json b/rules/S6850/html/metadata.json new file mode 100644 index 00000000000..2874b29fde0 --- /dev/null +++ b/rules/S6850/html/metadata.json @@ -0,0 +1,5 @@ +{ + "tags": [ + "accessibility" + ] +} diff --git a/rules/S6850/html/rule.adoc b/rules/S6850/html/rule.adoc new file mode 100644 index 00000000000..8d85c33bd06 --- /dev/null +++ b/rules/S6850/html/rule.adoc @@ -0,0 +1,45 @@ +include::../rule.adoc[tag=header] + +=== Code examples + +==== Noncompliant code example + +[source,html,diff-id=1,diff-type=noncompliant] +---- +
An introduction to JavaScript programming and its applications.
+ +Understanding the basic concepts in JavaScript programming.
+ +Explanation of what variables are and how to declare them in JavaScript.
+ +Overview of the different data types in JavaScript.
+ + +Understanding how to declare and use functions in JavaScript.
+---- + +==== Compliant solution + +[source,html,diff-id=1,diff-type=compliant] +---- +An introduction to JavaScript programming and its applications.
+ +Understanding the basic concepts in JavaScript programming.
+ +Explanation of what variables are and how to declare them in JavaScript.
+ +Overview of the different data types in JavaScript.
+ +Understanding how to declare and use functions in JavaScript.
+---- + +include::../rule.adoc[tag=footer] \ No newline at end of file diff --git a/rules/S6850/javascript/metadata.json b/rules/S6850/javascript/metadata.json index 70bc4c3e9b9..d79173ef449 100644 --- a/rules/S6850/javascript/metadata.json +++ b/rules/S6850/javascript/metadata.json @@ -1,26 +1,6 @@ { - "title": "Header elements should have accessible content", - "type": "CODE_SMELL", - "status": "ready", - "remediation": { - "func": "Constant\/Issue", - "constantCost": "5min" - }, "tags": [ "accessibility", "react" - ], - "defaultSeverity": "Major", - "ruleSpecification": "RSPEC-6850", - "sqKey": "S6850", - "scope": "All", - "defaultQualityProfiles": ["Sonar way"], - "quickfix": "infeasible", - "code": { - "impacts": { - "MAINTAINABILITY": "LOW", - "RELIABILITY": "MEDIUM" - }, - "attribute": "CONVENTIONAL" - } + ] } diff --git a/rules/S6850/javascript/rule.adoc b/rules/S6850/javascript/rule.adoc index a4948a98181..f283f62f1d3 100644 --- a/rules/S6850/javascript/rule.adoc +++ b/rules/S6850/javascript/rule.adoc @@ -1,16 +1,4 @@ -== Why is this an issue? - -Header elements are represented by the tags ``++An introduction to JavaScript programming and its applications.
+ return ( + <> +An introduction to JavaScript programming and its applications.
-Understanding the basic concepts in JavaScript programming.
+Understanding the basic concepts in JavaScript programming.
-Explanation of what variables are and how to declare them in JavaScript.
+Explanation of what variables are and how to declare them in JavaScript.
-Overview of the different data types in JavaScript.
+Overview of the different data types in JavaScript.
- // Noncompliant -Understanding how to declare and use functions in JavaScript.
- > - ); + // Noncompliant +Understanding how to declare and use functions in JavaScript.
+ > + ); } ---- @@ -45,30 +33,25 @@ function JavaScript101() { [source,javascript,diff-id=1,diff-type=compliant] ---- function JavaScript101() { - return ( - <> -An introduction to JavaScript programming and its applications.
+ return ( + <> +An introduction to JavaScript programming and its applications.
-Understanding the basic concepts in JavaScript programming.
+Understanding the basic concepts in JavaScript programming.
-Explanation of what variables are and how to declare them in JavaScript.
+Explanation of what variables are and how to declare them in JavaScript.
-Overview of the different data types in JavaScript.
+Overview of the different data types in JavaScript.
-Understanding how to declare and use functions in JavaScript.
- > - ); +Understanding how to declare and use functions in JavaScript.
+ > + ); } ---- -== Resources -=== Documentation - -* MDN web docs - https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements[Heading elements] -* MDN web docs - https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-hidden[aria-hidden] -* WCAG - https://www.w3.org/TR/UNDERSTANDING-WCAG20/navigation-mechanisms-descriptive.html[Headings and Labels] +include::../rule.adoc[tag=footer] diff --git a/rules/S6850/metadata.json b/rules/S6850/metadata.json index 2c63c085104..7135fdcc6c6 100644 --- a/rules/S6850/metadata.json +++ b/rules/S6850/metadata.json @@ -1,2 +1,22 @@ { -} + "title": "Heading elements should have accessible content", + "type": "CODE_SMELL", + "status": "ready", + "remediation": { + "func": "Constant\/Issue", + "constantCost": "5min" + }, + "defaultSeverity": "Major", + "ruleSpecification": "RSPEC-6850", + "sqKey": "S6850", + "scope": "All", + "defaultQualityProfiles": ["Sonar way"], + "quickfix": "infeasible", + "code": { + "impacts": { + "MAINTAINABILITY": "LOW", + "RELIABILITY": "MEDIUM" + }, + "attribute": "CONVENTIONAL" + } +} \ No newline at end of file diff --git a/rules/S6850/rule.adoc b/rules/S6850/rule.adoc new file mode 100644 index 00000000000..c612b201863 --- /dev/null +++ b/rules/S6850/rule.adoc @@ -0,0 +1,30 @@ +:doctype: book + +# tag::header[] +== Why is this an issue? + +Heading elements are represented by the tags ``++