Skip to content
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

slither-mutate: fit and finish #2302

Merged
merged 45 commits into from
Mar 29, 2024
Merged

slither-mutate: fit and finish #2302

merged 45 commits into from
Mar 29, 2024

Conversation

bohendo
Copy link
Contributor

@bohendo bohendo commented Feb 12, 2024

This PR takes care of a handful of random quality-of-life improvements that will make slither-mutate as useful as possible out-of-the box during code reviews. So far, improvements include:

  • count valid/total revert, comment, and tweak mutants separately
  • exclude any mutants that fail to compile from the cumulative counts
  • only replace a line with revert if it's not already a revert
  • exclude interfaces from mutation campaign
  • add very-verbose logs with useful debugging information
  • tidy up output logs for better at-a-glance comprehension

One maybe-controversial change is a rebrand from reporting "in/valid" mutants to reporting "un/caught" mutants. The word "valid" sounds like a good thing to most people, but more valid mutants means worse test coverage, which is bad (& often confuses me). In contrast, "uncaught" (previously "valid") sounds to the untrained ear like something was missed, which it was. While "caught" (previously "invalid") sounds like tests did their job, which they did. This also frees up the term "invalid mutant" to refer to mutants which do not compile, which makes more sense to me. Note that this new terminology does not follow the standards established in academic literature. But, it should make it easier for newcomers to wrap their head around what's going on. A worthwhile tradeoff IMO but lmk if you disagree.

Some additional features I'd like to include in this PR before we merge:

  • exit immediately when we get a ctrl-c interrupt, don't just stop the current test run & move on to the next mutant
  • when we exit after a ctrl-c interrupt, remove mutated files and restore the originals
  • run the tests once before commencing the mutation testing campaign, abort if tests don't pass
  • During the above, time how long the tests take normally. If no timeout specified, default to 2x as long as the tests usually take.
  • make --quick the default (skip tweak mutants if revert/comment mutants in the same expression are uncaught), replace it with a --comprehensive flag that will test all mutants (current default)

Copy link

coderabbitai bot commented Feb 12, 2024

Important

Auto Review Skipped

Auto reviews are disabled on base/target branches other than the default branch. Please add the base/target branch pattern to the list of additional branches to be reviewed in the settings.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository.

To trigger a single review, invoke the @coderabbitai review command.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

@bohendo bohendo changed the title [WIP] slither-mutate: fit and finish slither-mutate: fit and finish Feb 16, 2024
@bohendo
Copy link
Contributor Author

bohendo commented Feb 16, 2024

Pylint failure is due to the mutate function which has branches for adding up different mutant types. Could use a switch, but that hardly cleans things up. Should I ignore this warning? Or do you all have any recommendations for refactoring it?

@0xalpharush
Copy link
Contributor

Probably fine to ignore at the function level

@bohendo
Copy link
Contributor Author

bohendo commented Feb 16, 2024

This PR is done & ready for a final review

@0xalpharush 0xalpharush merged commit 28402ae into dev Mar 29, 2024
83 checks passed
@0xalpharush 0xalpharush deleted the mutator/fit-and-finish branch March 29, 2024 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants