mirror of
https://github.com/github/codeql.git
synced 2026-04-30 03:05:15 +02:00
delete all dead code
This commit is contained in:
@@ -969,12 +969,6 @@ private module Scopes {
|
||||
scope = n.getEnclosingModule()
|
||||
}
|
||||
|
||||
private predicate maybe_defined(SsaVariable var) {
|
||||
exists(var.getDefinition()) and not py_ssa_phi(var, _) and not var.getDefinition().isDelete()
|
||||
or
|
||||
exists(SsaVariable input | input = var.getAPhiInput() | maybe_defined(input))
|
||||
}
|
||||
|
||||
private predicate maybe_undefined(SsaVariable var) {
|
||||
not exists(var.getDefinition()) and not py_ssa_phi(var, _)
|
||||
or
|
||||
|
||||
@@ -900,22 +900,6 @@ private class EssaTaintTracking extends string {
|
||||
or
|
||||
result = this.testEvaluates(defn, not_operand(test), use, src).booleanNot()
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if `test` is the test in a branch and `use` is that test
|
||||
* with all the `not` prefixes removed.
|
||||
*/
|
||||
private predicate boolean_filter(ControlFlowNode test, ControlFlowNode use) {
|
||||
any(PyEdgeRefinement ref).getTest() = test and
|
||||
(
|
||||
use = test
|
||||
or
|
||||
exists(ControlFlowNode notuse |
|
||||
this.boolean_filter(test, notuse) and
|
||||
use = not_operand(notuse)
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private predicate testEvaluatesMaybe(ControlFlowNode test, ControlFlowNode use) {
|
||||
|
||||
@@ -21,9 +21,6 @@ private module Invoke {
|
||||
|
||||
/** Provides models for the `invoke` module. */
|
||||
module invoke {
|
||||
/** Gets a reference to the `invoke.context` module. */
|
||||
API::Node context() { result = invoke().getMember("context") }
|
||||
|
||||
/** Provides models for the `invoke.context` module */
|
||||
module context {
|
||||
/** Provides models for the `invoke.context.Context` class */
|
||||
|
||||
@@ -295,17 +295,6 @@ private module RestFramework {
|
||||
result = API::moduleImport("rest_framework").getMember("response").getMember("Response")
|
||||
}
|
||||
|
||||
/**
|
||||
* A source of instances of `rest_framework.response.Response`, extend this class to model new instances.
|
||||
*
|
||||
* This can include instantiations of the class, return values from function
|
||||
* calls, or a special parameter that will be set when functions are called by an external
|
||||
* library.
|
||||
*
|
||||
* Use the predicate `Response::instance()` to get references to instances of `rest_framework.response.Response`.
|
||||
*/
|
||||
abstract class InstanceSource extends DataFlow::LocalSourceNode { }
|
||||
|
||||
/** A direct instantiation of `rest_framework.response.Response`. */
|
||||
private class ClassInstantiation extends PrivateDjango::django::http::response::HttpResponse::InstanceSource,
|
||||
DataFlow::CallCfgNode {
|
||||
|
||||
@@ -185,11 +185,6 @@ predicate function_can_never_return(FunctionObject func) {
|
||||
func = ModuleObject::named("sys").attr("exit")
|
||||
}
|
||||
|
||||
private newtype TIterationDefinition =
|
||||
TIterationDefinition_(SsaSourceVariable var, ControlFlowNode def, ControlFlowNode sequence) {
|
||||
SsaSource::iteration_defined_variable(var, def, sequence)
|
||||
}
|
||||
|
||||
/** Hold if outer contains inner, both are contained within a test and inner is a use is a plain use or an attribute lookup */
|
||||
pragma[noinline]
|
||||
predicate contains_interesting_expression_within_test(ControlFlowNode outer, ControlFlowNode inner) {
|
||||
|
||||
@@ -40,16 +40,6 @@ private predicate class_statement(Comment c) {
|
||||
|
||||
private predicate triple_quote(Comment c) { c.getText().regexpMatch("#.*(\"\"\"|''').*") }
|
||||
|
||||
private predicate triple_quoted_string_part(Comment start, Comment end) {
|
||||
triple_quote(start) and end = start
|
||||
or
|
||||
exists(Comment mid |
|
||||
triple_quoted_string_part(start, mid) and
|
||||
end = non_empty_following(mid) and
|
||||
not triple_quote(end)
|
||||
)
|
||||
}
|
||||
|
||||
private predicate maybe_code(Comment c) {
|
||||
not non_code(c) and not filler(c) and not endline_comment(c) and not file_or_url(c)
|
||||
or
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
import python
|
||||
|
||||
class ImplicitConcat extends StrConst {
|
||||
ImplicitConcat() { exists(this.getAnImplicitlyConcatenatedPart()) }
|
||||
}
|
||||
|
||||
from StringPart s
|
||||
select s.getLocation().getStartLine(), s.getText(), s.getLocation().getStartColumn(),
|
||||
s.getLocation().getEndColumn()
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
import python
|
||||
|
||||
class ImplicitConcat extends StrConst {
|
||||
ImplicitConcat() { exists(this.getAnImplicitlyConcatenatedPart()) }
|
||||
}
|
||||
|
||||
from StrConst s, StringPart part, int n
|
||||
where part = s.getImplicitlyConcatenatedPart(n)
|
||||
select s.getLocation().getStartLine(), s.getText(), n, part.getText()
|
||||
|
||||
Reference in New Issue
Block a user