We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents d41331b + 6c7d848 commit d2222eeCopy full SHA for d2222ee
1 file changed
ql/src/queries/style/IfWithElseNone.ql
@@ -0,0 +1,15 @@
1
+/**
2
+ * @name Use of 'if' with a 'none()' branch.
3
+ * @description Using 'if p() then q() else none()' is bad style. It should be rewritten as 'p() and q()'.
4
+ * @kind problem
5
+ * @problem.severity warning
6
+ * @id ql/if-with-none
7
+ * @precision very-high
8
+ * @tags maintainability
9
+ */
10
+
11
+import ql
12
13
+from IfFormula ifFormula
14
+where ifFormula.getElsePart() instanceof NoneCall or ifFormula.getThenPart() instanceof NoneCall
15
+select ifFormula, "Use a conjunction instead."
0 commit comments