mirror of
https://github.com/github/codeql.git
synced 2026-05-04 21:25:44 +02:00
Python: Fix "use set literal" warnings
This commit is contained in:
@@ -79,18 +79,12 @@ deprecated class ExternalUrlSplitResult extends ExternalStringSequenceKind {
|
||||
override TaintKind getTaintOfAttribute(string name) {
|
||||
result = super.getTaintOfAttribute(name)
|
||||
or
|
||||
(
|
||||
// namedtuple field names
|
||||
name = "scheme" or
|
||||
name = "netloc" or
|
||||
name = "path" or
|
||||
name = "query" or
|
||||
name = "fragment" or
|
||||
// class methods
|
||||
name = "username" or
|
||||
name = "password" or
|
||||
name = "hostname"
|
||||
) and
|
||||
name in [
|
||||
// namedtuple field names
|
||||
"scheme", "netloc", "path", "query", "fragment",
|
||||
// class methods
|
||||
"password", "username", "hostname",
|
||||
] and
|
||||
result instanceof ExternalStringKind
|
||||
}
|
||||
|
||||
@@ -108,19 +102,12 @@ deprecated class ExternalUrlParseResult extends ExternalStringSequenceKind {
|
||||
override TaintKind getTaintOfAttribute(string name) {
|
||||
result = super.getTaintOfAttribute(name)
|
||||
or
|
||||
(
|
||||
// namedtuple field names
|
||||
name = "scheme" or
|
||||
name = "netloc" or
|
||||
name = "path" or
|
||||
name = "params" or
|
||||
name = "query" or
|
||||
name = "fragment" or
|
||||
// class methods
|
||||
name = "username" or
|
||||
name = "password" or
|
||||
name = "hostname"
|
||||
) and
|
||||
name in [
|
||||
// namedtuple field names
|
||||
"scheme", "netloc", "path", "params", "query", "fragment",
|
||||
// class methods
|
||||
"username", "password", "hostname",
|
||||
] and
|
||||
result instanceof ExternalStringKind
|
||||
}
|
||||
|
||||
|
||||
@@ -17,30 +17,13 @@ import Shadowing
|
||||
import semmle.python.types.Builtins
|
||||
|
||||
predicate allow_list(string name) {
|
||||
/* These are rarely used and thus unlikely to be confusing */
|
||||
name = "iter" or
|
||||
name = "next" or
|
||||
name = "input" or
|
||||
name = "file" or
|
||||
name = "apply" or
|
||||
name = "slice" or
|
||||
name = "buffer" or
|
||||
name = "coerce" or
|
||||
name = "intern" or
|
||||
name = "exit" or
|
||||
name = "quit" or
|
||||
name = "license" or
|
||||
/* These are short and/or hard to avoid */
|
||||
name = "dir" or
|
||||
name = "id" or
|
||||
name = "max" or
|
||||
name = "min" or
|
||||
name = "sum" or
|
||||
name = "cmp" or
|
||||
name = "chr" or
|
||||
name = "ord" or
|
||||
name = "bytes" or
|
||||
name = "_"
|
||||
name in [
|
||||
/* These are rarely used and thus unlikely to be confusing */
|
||||
"iter", "next", "input", "file", "apply", "slice", "buffer", "coerce", "intern", "exit",
|
||||
"quit", "license",
|
||||
/* These are short and/or hard to avoid */
|
||||
"dir", "id", "max", "min", "sum", "cmp", "chr", "ord", "bytes", "_",
|
||||
]
|
||||
}
|
||||
|
||||
predicate shadows(Name d, string name, Function scope, int line) {
|
||||
|
||||
Reference in New Issue
Block a user