-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: better mutant descriptions #268
Conversation
+ Rework how `Mutant`s are created to provide more precise descriptions + Update all mutators - Remove `toMutantAt` extension method for `TokenMutator` - Remove `TokenMutatorJS.description` since it is not a value anymore - Remove the test to check for non-empty description in `MutatorTest` since there should always be a default one
…scription # Conflicts: # core/src/main/scala/weaponregex/mutator/predefCharClassMutator.scala
…with a location + Update mutator description to always start with a location + Update mutator docstring to be more consistent with its name + Add a test to check for mutator description to always start with a location
…precation annotation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I like the implementation. It's pretty clean and makes sense. Some minor comments.
*/ | ||
@JSExportAll | ||
case class Location(start: Position, end: Position) | ||
case class Location(start: Position, end: Position) { | ||
val pretty: String = s"[${start.pretty}, ${end.pretty})" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than pretty
, how about show
? This is also in line with the cats typeclass
val pretty: String = s"[${start.pretty}, ${end.pretty})" | |
def show: String = s"[${start.show}, ${end.show})" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated 🧐 Good to know.
core/src/main/scala/weaponregex/model/mutation/TokenMutator.scala
Outdated
Show resolved
Hide resolved
core/src/main/scala/weaponregex/model/mutation/TokenMutator.scala
Outdated
Show resolved
Hide resolved
…nternal API to `Option` instead of using `null`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM feel free to (squash) merge
Overview
Specific mutation description
Specific mutation description can be defined per mutator that extends
TokenMutator
by overriding thedescription
method, which provides the original and mutated string representation of the targeted token and the mutation location:With the above definition, the new descriptions for a
CharClassNegation
would be:If more mutation information is desired, a mutation description can also be directly specified during mutation as an argument for the
toMutantOf
,toMutantBeforeChildrenOf
, ortoMutantAfterChildrenOf
extension methods:New mutant descriptions for a
CharClassChildRemoval
are shown below:Breaking changes
TokenMutator.description
removed in favor of usingTokenMutator.description(original: String, mutated: String, location: Location): String
to define and generate a more detailed description for each mutant instead of the mutator.