diff --git a/rules/S6826/java/asciidocs.adoc b/rules/S6826/java/asciidocs.adoc new file mode 100644 index 00000000000..6e2a3e6bd6e --- /dev/null +++ b/rules/S6826/java/asciidocs.adoc @@ -0,0 +1,98 @@ +:data-uri: + +There are two AsciiDoc image macro types, block and inline. As with all macros, +the block and inline forms differ by the number of colons that follow the macro +name. The block form uses two colons (``++::++``), whereas the inline form only +uses one (``++:++``). + +==== Block image macro + +https://docs.asciidoctor.org/asciidoc/latest/macros/images/ + +---- +// Example 1 + +Content in document. + +image::image.png[] + +Content in document +---- + +Content in document. + +image::image.png[] + +Content in document + +include::lorem.adoc[] + +==== Position and Frame Images + +https://docs.asciidoctor.org/asciidoc/latest/macros/image-position/ + +==== Positioning attributes + +---- +// Example 1. A block image pulled to the right and centered within the block + +image::image.png[Tiger,200,200,float="right",align="center"] +---- + +image::image.png[Tiger,200,200,float="right",align="center"] + +include::lorem.adoc[] + +---- +// Example 2. An inline image pulled to the right of the paragraph text + +image:image.png[Linux,150,150,float="right"] +You can find Linux everywhere these days! +---- + +image:image.png[Linux,150,150,float="right"] +You can find Linux everywhere these days! + +include::lorem.adoc[] + +==== Control the float + +---- +[.float-group] +-- +[.left] +.Image A +image::image.png[A,240,180] + +[.left] +.Image B +image::image.png[B,240,180] +-- + +Text below images. +---- + +[.float-group] +-- +[.left] +.Image A +image::image.png[A,240,180] + +[.left] +.Image B +image::image.png[B,240,180] +-- + +Text below images. + +include::lorem.adoc[] + +==== SVG images + +https://docs.asciidoctor.org/asciidoc/latest/macros/image-svg/ + +---- +image::icon.svg[Static,300] +---- + +image::icon.svg[Static,300] diff --git a/rules/S6826/java/icon.svg b/rules/S6826/java/icon.svg new file mode 100644 index 00000000000..ec0e152da0e --- /dev/null +++ b/rules/S6826/java/icon.svg @@ -0,0 +1 @@ +SonarCloud icon \ No newline at end of file diff --git a/rules/S6826/java/image.png b/rules/S6826/java/image.png new file mode 100644 index 00000000000..7a17df3d2f4 Binary files /dev/null and b/rules/S6826/java/image.png differ diff --git a/rules/S6826/java/lorem.adoc b/rules/S6826/java/lorem.adoc new file mode 100644 index 00000000000..1b85bc7854d --- /dev/null +++ b/rules/S6826/java/lorem.adoc @@ -0,0 +1,7 @@ +_Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce a massa sit +amet lectus pellentesque auctor. Mauris efficitur egestas elementum. Morbi +placerat quam ut hendrerit porta. Nulla vitae orci sit amet elit pellentesque +interdum. Sed tincidunt ipsum at hendrerit ornare. Ut orci magna, fringilla et +finibus eu, consectetur vestibulum massa. Pellentesque habitant morbi tristique +senectus et netus et malesuada fames ac turpis egestas. Fusce sed lorem urna._ + diff --git a/rules/S6826/java/metadata.json b/rules/S6826/java/metadata.json new file mode 100644 index 00000000000..9f02b01ae9f --- /dev/null +++ b/rules/S6826/java/metadata.json @@ -0,0 +1,26 @@ +{ + "title": "This is a rule showcasing images in rules", + "type": "CODE_SMELL", + "status": "ready", + "remediation": { + "func": "Constant\/Issue", + "constantCost": "5min" + }, + "tags": [ + "rspec-showcase" + ], + "defaultSeverity": "Major", + "ruleSpecification": "RSPEC-6826", + "sqKey": "S6826", + "scope": "All", + "defaultQualityProfiles": ["Sonar way"], + "quickfix": "unknown", + "code": { + "impacts": { + "MAINTAINABILITY": "HIGH", + "RELIABILITY": "MEDIUM", + "SECURITY": "LOW" + }, + "attribute": "CONVENTIONAL" + } +} diff --git a/rules/S6826/java/rule.adoc b/rules/S6826/java/rule.adoc new file mode 100644 index 00000000000..36962c79947 --- /dev/null +++ b/rules/S6826/java/rule.adoc @@ -0,0 +1,45 @@ +== Why is this an issue? + +This rule is not really a rule, but a demonstration of the images that can +appear in a rule description. The Asciidoc docs are copied, but only their code +samples. + +A version containing links is available in +[the initial PR](https://github.com/SonarSource/rspec/blob/b83c150164ae37a77a978d6729c09a5178cbf1aa/rules/S6826/java/asciidocs-links.adoc?plain=1). + +=== What is the potential impact? + +:random_variable: 42 + +include::asciidocs.adoc[] + +== How to fix it in Spring + +=== Code examples + +==== Noncompliant code example + +[source,text,diff-id=1,diff-type=noncompliant] +---- +FIXME +---- + +==== Compliant solution + +[source,text,diff-id=1,diff-type=compliant] +---- +FIXED +---- + +=== How does this work? + +:random_variable: 1337 + +include::asciidocs.adoc[] + +== Resources + +=== Documentation + +* None + diff --git a/rules/S6826/metadata.json b/rules/S6826/metadata.json new file mode 100644 index 00000000000..2c63c085104 --- /dev/null +++ b/rules/S6826/metadata.json @@ -0,0 +1,2 @@ +{ +}