Skip to content
Draft
9 changes: 9 additions & 0 deletions cpp/ql/lib/utils/test/InlineExpectationsTestQuery.ql
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,13 @@ private module Input implements T::TestPostProcessing::InputSig<Impl> {
f.getRelativePath() + ":" + startline + ":" + startcolumn + ":" + endline + ":" + endcolumn
)
}

bindingset[relativePath]
string getStartCommentMarker(string relativePath) {
// C/C++ databases can also contain XML (e.g. `.xml`, `.props`), whose block-comment
// syntax is not yet supported, so we only render for C/C++ sources.
relativePath
.regexpMatch(".*\\.(c|cc|cpp|cxx|cp|c\\+\\+|h|hh|hpp|hxx|h\\+\\+|inl|tcc|ipp|tpp|cu|cuh)") and
result = "//"
}
}
8 changes: 8 additions & 0 deletions csharp/ql/lib/utils/test/InlineExpectationsTestQuery.ql
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,12 @@ private module Input implements T::TestPostProcessing::InputSig<Impl> {
f.getRelativePath() + ":" + startline + ":" + startcolumn + ":" + endline + ":" + endcolumn
)
}

bindingset[relativePath]
string getStartCommentMarker(string relativePath) {
// C# databases can also contain XML (e.g. `.csproj`, `.config`) and Razor markup, whose
// comment syntaxes are not yet supported, so we only render for C# sources.
relativePath.regexpMatch(".*\\.(cs|csx)") and
result = "//"
}
}
8 changes: 8 additions & 0 deletions go/ql/lib/utils/test/InlineExpectationsTestQuery.ql
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,12 @@ private module Input implements T::TestPostProcessing::InputSig<Impl> {
f.getRelativePath() + ":" + startline + ":" + startcolumn + ":" + endline + ":" + endcolumn
)
}

bindingset[relativePath]
string getStartCommentMarker(string relativePath) {
// Go databases can also contain XML, whose block-comment syntax is not yet supported, so
// we only render for Go sources.
relativePath.matches("%.go") and
result = "//"
}
}
8 changes: 8 additions & 0 deletions java/ql/lib/utils/test/InlineExpectationsTestQuery.ql
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,12 @@ private module Input implements T::TestPostProcessing::InputSig<Impl> {
f.getRelativePath() + ":" + startline + ":" + startcolumn + ":" + endline + ":" + endcolumn
)
}

bindingset[relativePath]
string getStartCommentMarker(string relativePath) {
// Java databases can also contain XML; those files use a different (block) comment
// syntax that is not yet supported, so we only render for Java and Kotlin sources.
(relativePath.matches("%.java") or relativePath.matches("%.kt")) and
result = "//"
}
}
8 changes: 8 additions & 0 deletions javascript/ql/lib/utils/test/InlineExpectationsTestQuery.ql
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,12 @@ private module Input implements T::TestPostProcessing::InputSig<Impl> {
f.getRelativePath() + ":" + startline + ":" + startcolumn + ":" + endline + ":" + endcolumn
)
}

bindingset[relativePath]
string getStartCommentMarker(string relativePath) {
// JavaScript databases can also contain HTML, whose (block) comment syntax is not yet
// supported, so we only render for the line-comment source files.
relativePath.regexpMatch(".*\\.(js|cjs|mjs|jsx|ts|cts|mts|tsx)") and
result = "//"
}
}
8 changes: 8 additions & 0 deletions python/ql/lib/utils/test/InlineExpectationsTestQuery.ql
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,12 @@ private module Input implements T::TestPostProcessing::InputSig<Impl> {
f.getRelativePath() + ":" + startline + ":" + startcolumn + ":" + endline + ":" + endcolumn
)
}

bindingset[relativePath]
string getStartCommentMarker(string relativePath) {
// Python databases can also contain XML, whose block-comment syntax is not yet supported,
// so we only render for Python sources.
relativePath.regexpMatch(".*\\.(py|pyi)") and
result = "#"
}
}
8 changes: 8 additions & 0 deletions ql/ql/src/utils/test/InlineExpectationsTestQuery.ql
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,12 @@ private module Input implements T::TestPostProcessing::InputSig<Impl> {
f.getRelativePath() + ":" + startline + ":" + startcolumn + ":" + endline + ":" + endcolumn
)
}

bindingset[relativePath]
string getStartCommentMarker(string relativePath) {
// The QL extractor can also extract YAML (e.g. `qlpack.yml`), whose `#` comment syntax
// differs, so we only render for QL sources and dbscheme files.
relativePath.regexpMatch(".*\\.(ql|qll|dbscheme)") and
result = "//"
}
}
8 changes: 8 additions & 0 deletions ruby/ql/lib/utils/test/InlineExpectationsTestQuery.ql
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,12 @@ private module Input implements T::TestPostProcessing::InputSig<Impl> {
f.getRelativePath() + ":" + startline + ":" + startcolumn + ":" + endline + ":" + endcolumn
)
}

bindingset[relativePath]
string getStartCommentMarker(string relativePath) {
// Ruby databases can also contain ERB, whose comment syntax is not yet supported, so we
// only render for plain Ruby sources.
relativePath.matches("%.rb") and
result = "#"
}
}
8 changes: 8 additions & 0 deletions rust/ql/lib/utils/test/InlineExpectationsTestQuery.ql
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,12 @@ private module Input implements T::TestPostProcessing::InputSig<Impl> {
f.getRelativePath() + ":" + startline + ":" + startcolumn + ":" + endline + ":" + endcolumn
)
}

bindingset[relativePath]
string getStartCommentMarker(string relativePath) {
// Rust databases can also contain YAML, whose `#` comment syntax differs, so we only
// render for Rust sources.
relativePath.matches("%.rs") and
result = "//"
}
}
Loading
Loading