universalmutator icon indicating copy to clipboard operation
universalmutator copied to clipboard

`--only` not working

Open brunoerg opened this issue 8 months ago • 0 comments

I've tried to use --only (universalmutator 1.1.11) but it does not work.

*** UNIVERSALMUTATOR ***
MUTATING WITH RULES: rust.rules
8 MUTANTS GENERATED BY RULES
Traceback (most recent call last):
  File "/opt/homebrew/bin/mutate", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/homebrew/lib/python3.12/site-packages/universalmutator/genmutants.py", line 415, in main
    handler = handlers[language].handler
              ~~~~~~~~^^^^^^^^^^
KeyError: '--only'

I do believe the error is into:

if len(args) < 3:
        try:
            language = languages[ending]
        except KeyError:
            language = "none"
        otherRules = []
    else:
        if ".rules" in args[2]:
            language = languages[ending]
            otherRules = args[2:]
        else:
            language = args[2]
            otherRules = args[3:]

If the command is, e.g., mutate mycode.rs --only rust.rules --mutantDir mutants. The .rules is the third element in args not the second one.

brunoerg avatar Jun 04 '24 12:06 brunoerg