Mutate R code.
We currently support the following mutations (in no particular order):
- Arithmetic operator replacement:
Original Mutation 1 Mutation 2 Mutation 3 +
-
*
/
-
+
*
/
*
+
-
/
/
+
-
*
- Branch condition replacement:
- Conditions of
if
statements andwhile
loops are replaced byTRUE
orFALSE
- Conditions of
- Condition boundary mutation:
Original Mutation >
>=
>=
>
<
<=
<=
<
- Function name replacement:
Original Mutation 1 Mutation 2 lapply
sapply
vapply
sapply
lapply
vapply
sapply
isTRUE
isFALSE
isFALSE
isTRUE
[[
[
any
all
all
any
==
identical
identical
==
union
intersect
setdiff
intersect
union
setdiff
setdiff
union
intersect
- Literal mutation:
- Numeric literals are replaced by
NA
or in- or decremented by 1 - Logical literals are replaced by their negation
- Character literals are modified by appending to the end, removing the first character, or by replacing it with an empty string
- This is only done when the string does not appear inside typical logging functions, like
print
,cat
,message
, orlog_trace
- This is only done when the string does not appear inside typical logging functions, like
- Numeric literals are replaced by
- Logic operator replacement:
Original Mutation &
|
|
&
&&
||
||
&&
- Relational operator replacement:
Original Mutation ==
!=
!=
==
>
<=
>=
<
<
>=
<=
>
- Sign replacement:
Original Mutation +
-
-
+
- Function replacement
- Calls whose result is not assigned by
<-
,<<-
,->
,->>
, or=
are removed - Calls to
length
are replaced by0
,1
, and5
- "is"-checkes (
is.character
,is.logical
, ... , and relation operators) are replaced byTRUE
andFALSE
- Calls whose result is not assigned by
- Return value replacement:
Original Mutation NULL
42
everything else NULL
- Vector modification:
- Wenn the function
c
is called, we either remove and element, add an additional, or remove all elements
- Wenn the function
- Call insertion
- A call to
stop
orwarning
is inserted into blocks ({ ... }
)
- A call to