-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create rule S6826: Sample rule that showcases potential image feature…
…s in Sonar products (#3287) Co-authored-by: loris-s-sonarsource <[email protected]> Co-authored-by: Loris Sierra <[email protected]> Co-authored-by: Loris S <[email protected]> Co-authored-by: Fred Tingaud <[email protected]>
- Loading branch information
1 parent
5627673
commit 2730041
Showing
7 changed files
with
179 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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] |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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._ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{ | ||
} |