Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
5eecd45
SONARHTML-472 Handle plain C# conditionals in Razor code blocks
victor-peixoto-sonarsource Aug 28, 2026
8222069
SONARHTML-472 Refactor Razor content scanning
victor-peixoto-sonarsource Aug 28, 2026
576e67a
SONARHTML-472 Handle Razor code block edge cases
victor-peixoto-sonarsource Aug 28, 2026
83b3f57
SONARHTML-472 Balance braces in rendered Razor markup
victor-peixoto-sonarsource Aug 28, 2026
5eb4d21
SONARHTML-472 Harden Razor markup scope tracking
victor-peixoto-sonarsource Aug 28, 2026
d9b5805
SONARHTML-472 Address code quality findings
victor-peixoto-sonarsource Aug 28, 2026
1a98fe5
SONARHTML-472 Recover Razor scopes from malformed markup
victor-peixoto-sonarsource Aug 28, 2026
81e82d9
SONARHTML-472 Reduce Razor scope tracking complexity
victor-peixoto-sonarsource Aug 28, 2026
a30465e
SONARHTML-472 Harden Razor lexer state tracking
victor-peixoto-sonarsource Aug 28, 2026
c49c3c4
SONARHTML-472 Address code quality findings
victor-peixoto-sonarsource Aug 28, 2026
46b47c0
SONARHTML-472 Fix Razor raw strings and HTML tags
victor-peixoto-sonarsource Aug 28, 2026
6af5973
SONARHTML-472 Handle common generics and empty raw strings
victor-peixoto-sonarsource Aug 28, 2026
5ff9d8d
SONARHTML-472 Parameterize raw string tests
victor-peixoto-sonarsource Aug 28, 2026
67f49e4
SONARHTML-472 Refine empty raw string detection
victor-peixoto-sonarsource Aug 28, 2026
1a862cb
SONARHTML-472 Address review feedback
victor-peixoto-sonarsource Aug 31, 2026
552663e
SONARHTML-472 Handle nested Razor string contexts
victor-peixoto-sonarsource Aug 31, 2026
2fb0b33
Update ruling results
github-actions[bot] Aug 31, 2026
467f86d
SONARHTML-472 Preserve pending Razor block closes
victor-peixoto-sonarsource Aug 31, 2026
a0da20c
SONARHTML-472 Reduce rendered brace complexity
victor-peixoto-sonarsource Aug 31, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions its/ruling/src/test/resources/expected/Web-S9379.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"project:external_webkit-jb-mr1/Source/WebCore/manual-tests/autofill-popup-location.html": [
18
],
"project:sonar-master/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/_create_form.html.erb": [
19
],
"project:sonar-master/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/_edit_form.html.erb": [
18
],
"project:sonar-master/sonar-server/src/main/webapp/WEB-INF/app/views/issue/_comment_form.html.erb": [
7
],
"project:sonar-master/sonar-server/src/main/webapp/WEB-INF/app/views/issue/_edit_comment_form.html.erb": [
6
],
"project:sonar-master/sonar-server/src/main/webapp/WEB-INF/app/views/issue/_issue.html.erb": [
66
],
"project:sonar-master/sonar-server/src/main/webapp/WEB-INF/app/views/issue/_severity_form.html.erb": [
7
],
"project:sonar-master/sonar-server/src/main/webapp/WEB-INF/app/views/issue/_show_modal.html.erb": [
5
],
"project:sonar-master/sonar-server/src/main/webapp/WEB-INF/app/views/issues/_shared_form.html.erb": [
5
],
"project:sonar-master/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_copy_form.html.erb": [
13
],
"project:sonar-master/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_edit_form.html.erb": [
13
],
"project:sonar-master/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_save_as_form.html.erb": [
15
],
"project:sonar-master/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/_copy_form.html.erb": [
17
],
"project:sonar-master/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/_create_form.html.erb": [
17
],
"project:sonar-master/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/_rename_form.html.erb": [
16
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@

public class HtmlConstants {

private static final String EMBED_TAG = "embed";
private static final String INPUT_TAG = "input";
private static final String PARAM_TAG = "param";
private static final String SOURCE_TAG = "source";
private static final String TRACK_TAG = "track";

/** The language key. */
public static final String LANGUAGE_KEY = "web";
public static final String LANGUAGE_NAME = "HTML";
Expand All @@ -47,6 +53,15 @@ public class HtmlConstants {
* output is HTML.
*/
public static final List<String> OTHER_FILE_SUFFIXES = List.of("php", "php3", "php4", "php5", "phtml", "inc", "vue");

/**
* Void elements can't have any content.
* See https://html.spec.whatwg.org/multipage/syntax.html#void-elements
*/
public static final Set<String> VOID_ELEMENTS = Set.of(
"area", "base", "br", "col", EMBED_TAG, "hr", "img", INPUT_TAG, "link", "meta", PARAM_TAG, SOURCE_TAG, TRACK_TAG, "wbr"
);

public static final List<String> KNOWN_HTML_TAGS = List.of(
"a",
"acronym", // deprecated
Expand Down Expand Up @@ -87,7 +102,7 @@ public class HtmlConstants {
"dl",
"dt",
"em",
"embed",
EMBED_TAG,
"fieldset",
"figcaption",
"figure",
Expand All @@ -111,7 +126,7 @@ public class HtmlConstants {
"iframe",
"image", // deprecated
"img",
"input",
INPUT_TAG,
"ins",
"kbd",
"keygen", // deprecated
Expand All @@ -138,7 +153,7 @@ public class HtmlConstants {
"option",
"output",
"p",
"param", // deprecated
PARAM_TAG, // deprecated
"picture",
"plaintext", // deprecated
"pre",
Expand All @@ -157,7 +172,7 @@ public class HtmlConstants {
"select",
"shadow", // deprecated
"small",
"source",
SOURCE_TAG,
"spacer", // deprecated
"span",
"strike", // deprecated
Expand All @@ -178,7 +193,7 @@ public class HtmlConstants {
"time",
"title",
"tr",
"track",
TRACK_TAG,
"tt", // deprecated
"u",
"ul",
Expand All @@ -189,7 +204,7 @@ public class HtmlConstants {
);

// computed from https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/src/util/isInteractiveElement.js
public static final Set<String> INTERACTIVE_ELEMENTS = Set.of("a", "audio", "button", "canvas", "datalist", "embed", "input", "menuitem", "option", "select", "summary",
public static final Set<String> INTERACTIVE_ELEMENTS = Set.of("a", "audio", "button", "canvas", "datalist", EMBED_TAG, INPUT_TAG, "menuitem", "option", "select", "summary",
"td", "textarea", "th", "tr", "video");

// computed from https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/src/util/isNonInteractiveElement.js
Expand Down Expand Up @@ -223,7 +238,7 @@ public class HtmlConstants {

// computed from https://github.com/A11yance/aria-query/blob/main/src/domMap.js
public static final Set<String> RESERVED_NODE_SET = Set.of(
"base", "col", "colgroup", "head", "html", "link", "meta", "noembed", "noscript", "param", "picture", "script", "source", "style", "title", "track"
"base", "col", "colgroup", "head", "html", "link", "meta", "noembed", "noscript", PARAM_TAG, "picture", "script", SOURCE_TAG, "style", "title", TRACK_TAG
);

public static boolean isInteractiveElement(TagNode element) {
Expand Down
Loading
Loading