FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
codeql/java/ql/src/Complexity/ComplexCondition.ql at codeql-cli/v2.27.1 · github/codeql · GitHub
github
codeql
Repository navigation
Code
Issues
1k
(1k)
Pull requests
490
(490)
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
codeql
/
java
/
ql
/
src
/
Complexity
/
ComplexCondition.ql
Copy path
More file actions
More file actions
Latest commit
History
History
History
31 lines (27 loc) · 780 Bytes
Breadcrumbs
codeql
/
java
/
ql
/
src
/
Complexity
/
ComplexCondition.ql
Copy path
File metadata and controls
31 lines (27 loc) · 780 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/**
* @name Complex condition
* @description Very complex conditions are difficult to read and may include defects.
* @kind problem
* @problem.severity recommendation
* @precision low
* @id java/complex-condition
* @tags testability
* readability
*/
import
java
predicate
nontrivialLogicalOperator
(
BinaryExpr
e
)
{
e
instanceof
LogicExpr
and
(
not
e
.
getParent
(
)
.
(
Expr
)
.
getKind
(
)
=
e
.
getKind
(
)
or
e
.
isParenthesized
(
)
)
}
Expr
getSimpleParent
(
Expr
e
)
{
result
=
e
.
getParent
(
)
and
not
result
instanceof
MethodCall
}
from
Expr
e
where
not
e
.
getParent
(
)
instanceof
Expr
and
strictcount
(
BinaryExpr
op
|
getSimpleParent
*
(
op
)
=
e
and
nontrivialLogicalOperator
(
op
)
)
>
5
select
e
,
"Complex condition: too many logical operations in this expression."
Back
|
FazBrowse Home
|
New Git URL