Skip to content

mutator 0.3.0

Choose a tag to compare

@programLyrique programLyrique released this 21 Oct 17:44

Mutation operators

  • New operators argument of mutate_file() and mutate_package() to select
    the mutation operators by id or family, e.g.
    operators = c("default", "seq_idiom", "-bool_flip"). The option
    mutator.operators sets it for a session. The new mutation_operators()
    lists the operators.
  • New operators: boundary changes of relational operators (< to <=),
    ^, %% and %/% swaps, removal of an &&/|| operand, break/next
    swaps, forced conditions, off-by-one constants, empty strings, and
    R-specific operators: TRUE/FALSE flips (also in argument defaults),
    <<- to <-, && to &, max to pmax, [[ to [, seq_len(n) to
    1:n, dropping drop = FALSE and other named arguments, function swaps
    (any/all, min/max, head/tail, ...), removal of wrappers such as
    rev() or unique(), and removal of error handling (tryCatch(),
    stop()). The replacement of values by 42, which was disabled, is
    available as value_42.
  • The default set changed, based on a benchmark of the operators on seven
    CRAN packages (see the README). It adds the boundary, &&/|| operand,
    break/next, TRUE/FALSE, <<-, named argument, function swap and
    error handling operators. NA type swaps (NA to NA_integer_, ...) are
    no longer in the default set, as most of their mutants are equivalent.
    Results of mutate_package() therefore differ from earlier versions.
  • # mutator:ignore-start and # mutator:ignore-file can list operator ids
    or families, to exclude only those operators.
  • mutate_package() reports the mutation score per operator in
    summary$by_operator, printed with isFullLog = TRUE.
  • Mutants that cannot change the behaviour of the code are no longer written
    or tested: those identical to the original code or to another mutant, and
    those that simple rules show to be equivalent (for example paste to
    paste0 with a single argument). A message gives their number per file.

Equivalent mutant detection

  • Requests refused for rate limiting (HTTP 429) or by an overloaded gateway
    (502, 503, 504) are retried with exponential backoff, honouring
    Retry-After. Network errors are retried twice, and a request may wait up
    to 30 minutes for the answer of a reasoning model.
  • When an answer is cut off by the output token limit, the verdicts of its
    complete entries are kept and the missing mutants are asked again in
    smaller batches.

Continuous integration

  • The reusable workflow has a new operators input.