Skip to content

Commit 39d3741

Browse files
authored
Merge pull request #20326 from michaelnebel/csharp/ql4ql
C#: Fix some Ql4Ql violations.
2 parents f73f9a0 + ef4b41a commit 39d3741

File tree

13 files changed

+30
-28
lines changed

13 files changed

+30
-28
lines changed

csharp/ql/lib/printAst.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ external string selectedSourceFile();
1818

1919
class PrintAstConfigurationOverride extends PrintAstConfiguration {
2020
/**
21-
* Holds if the location matches the selected file in the VS Code extension and
22-
* the element is `fromSource`.
21+
* Holds if the location `l` matches the selected file in the VS Code extension and
22+
* the element is `e` is `fromSource`.
2323
*/
2424
override predicate shouldPrint(Element e, Location l) {
2525
super.shouldPrint(e, l) and

csharp/ql/lib/semmle/code/csharp/Assignable.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ module AssignableDefinitions {
583583
}
584584

585585
/**
586-
* Holds if the `ref` assignment to `aa` via call `c` is uncertain.
586+
* Holds if the `ref` assignment to `arg` via call `c` is uncertain.
587587
*/
588588
// Not in the cached module `Cached`, as that would introduce a dependency
589589
// on the CFG construction, and effectively collapse too many stages into one

csharp/ql/lib/semmle/code/csharp/Callable.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ class TrueOperator extends UnaryOperator {
708708
*
709709
* Either an addition operator (`AddOperator`), a checked addition operator
710710
* (`CheckedAddOperator`) a subtraction operator (`SubOperator`), a checked
711-
* substraction operator (`CheckedSubOperator`), a multiplication operator
711+
* subtraction operator (`CheckedSubOperator`), a multiplication operator
712712
* (`MulOperator`), a checked multiplication operator (`CheckedMulOperator`),
713713
* a division operator (`DivOperator`), a checked division operator
714714
* (`CheckedDivOperator`), a remainder operator (`RemOperator`), an and

csharp/ql/lib/semmle/code/csharp/Member.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ class Parameterizable extends Declaration, @parameterizable {
491491
final Parameter getARawParameter() { result = this.getRawParameter(_) }
492492

493493
/**
494-
* Gets the type of the parameter, possibly prefixed
494+
* Gets the type of the `i`th parameter, possibly prefixed
495495
* with `out`, `ref`, or `params`, where appropriate.
496496
*/
497497
private string parameterTypeToString(int i) {

csharp/ql/lib/semmle/code/csharp/PrintAst.qll

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -523,11 +523,9 @@ final class AttributeNode extends ElementNode {
523523
* A node representing a `TypeParameter`.
524524
*/
525525
final class TypeParameterNode extends ElementNode {
526-
TypeParameter typeParameter;
527-
528526
TypeParameterNode() {
529-
typeParameter = element and
530-
not isNotNeeded(typeParameter.getDeclaringGeneric())
527+
element =
528+
any(TypeParameter typeParameter | not isNotNeeded(typeParameter.getDeclaringGeneric()))
531529
}
532530

533531
override ElementNode getChild(int childIndex) { none() }

csharp/ql/lib/semmle/code/csharp/controlflow/internal/Completion.qll

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,10 +310,8 @@ private class Overflowable extends UnaryOperation {
310310

311311
/** A control flow element that is inside a `try` block. */
312312
private class TriedControlFlowElement extends ControlFlowElement {
313-
TryStmt try;
314-
315313
TriedControlFlowElement() {
316-
this = try.getATriedElement() and
314+
this = any(TryStmt try).getATriedElement() and
317315
not this instanceof NonReturningCall
318316
}
319317

csharp/ql/lib/semmle/code/csharp/dataflow/SSA.qll

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,10 +451,9 @@ module Ssa {
451451
* An SSA definition that corresponds to an explicit assignable definition.
452452
*/
453453
class ExplicitDefinition extends Definition, SsaImpl::WriteDefinition {
454-
SourceVariable sv;
455454
AssignableDefinition ad;
456455

457-
ExplicitDefinition() { SsaImpl::explicitDefinition(this, sv, ad) }
456+
ExplicitDefinition() { SsaImpl::explicitDefinition(this, _, ad) }
458457

459458
/**
460459
* Gets an underlying assignable definition. The result is always unique,

csharp/ql/lib/semmle/code/csharp/dataflow/internal/SsaImpl.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ private module SourceVariableImpl {
143143
}
144144

145145
/**
146-
* Gets an `out`/`ref` definition of the same source variable as the `out`/`ref`
146+
* Gets an `out`/`ref` definition of the same source variable `v` as the `out`/`ref`
147147
* definition `def`, belonging to the same call, at a position after `def`.
148148
*/
149149
OutRefDefinition getASameOutRefDefAfter(Ssa::SourceVariable v, OutRefDefinition def) {

csharp/ql/lib/semmle/code/csharp/security/dataflow/UnsafeDeserializationQuery.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,7 @@ private predicate isStrongTypeFsPicklerCall(MethodCall mc, Method m) {
874874
(
875875
m instanceof FsPicklerSerializerClassDeserializeMethod or
876876
m instanceof FsPicklerSerializerClassDeserializeSequenceMethod or
877-
m instanceof FsPicklerSerializerClasDeserializeSiftedMethod or
877+
m instanceof FsPicklerSerializerClassDeserializeSiftedMethod or
878878
m instanceof FsPicklerSerializerClassUnPickleMethod or
879879
m instanceof FsPicklerSerializerClassUnPickleSiftedMethod or
880880
m instanceof CsPicklerSerializerClassDeserializeMethod or

csharp/ql/lib/semmle/code/csharp/serialization/Deserializers.qll

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -560,9 +560,15 @@ class FsPicklerSerializerClassDeserializeSequenceMethod extends Method, UnsafeDe
560560
}
561561
}
562562

563+
/**
564+
* DEPRECATED: Use `FsPicklerSerializerClassDeserializeSiftedMethod` instead.
565+
*/
566+
deprecated class FsPicklerSerializerClasDeserializeSiftedMethod =
567+
FsPicklerSerializerClassDeserializeSiftedMethod;
568+
563569
/** `MBrace.FsPickler.FsPicklerSerializer.DeserializeSifted` method */
564-
class FsPicklerSerializerClasDeserializeSiftedMethod extends Method, UnsafeDeserializer {
565-
FsPicklerSerializerClasDeserializeSiftedMethod() {
570+
class FsPicklerSerializerClassDeserializeSiftedMethod extends Method, UnsafeDeserializer {
571+
FsPicklerSerializerClassDeserializeSiftedMethod() {
566572
this.getDeclaringType().getBaseClass*() instanceof FsPicklerSerializerClass and
567573
this.hasUndecoratedName("DeserializeSifted")
568574
}

0 commit comments

Comments
 (0)