Skip to content

Add spell correction for CLI options #5461

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

Conversation

hannes-steffenhagen-diffblue
Copy link
Contributor

This gives you some suggestions if you’ve mistyped a command line parameter.

E.g. on cbmc --traec it will suggest --trace, if you type cbmc --cvc it will suggest trying --cvc3 or --cvc4, that sort of thing.

  • Each commit message has a non-empty body, explaining why the change was made.
  • Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • White-space or formatting changes outside the feature-related changed lines are in commits of their own.

For now only basic levenshtein distance (delete,insert,modify).  This is
probably good enough for the intended use case (suggesting typo fixes on
the command line).
This will provide some suggestions if a command line option
is unknown, but similar to an option that *does* exist.
@codecov
Copy link

codecov bot commented Aug 15, 2020

Codecov Report

Merging #5461 into develop will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #5461      +/-   ##
===========================================
+ Coverage    68.25%   68.28%   +0.02%     
===========================================
  Files         1180     1183       +3     
  Lines        97722    97807      +85     
===========================================
+ Hits         66698    66783      +85     
  Misses       31024    31024              
Flag Coverage Δ
#cproversmt2 42.88% <97.67%> (+0.07%) ⬆️
#regression 65.45% <97.67%> (+0.02%) ⬆️
#unit 32.27% <72.09%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/util/cmdline.h 66.66% <ø> (ø)
src/util/cmdline.cpp 92.95% <100.00%> (+1.08%) ⬆️
src/util/edit_distance.cpp 100.00% <100.00%> (ø)
src/util/edit_distance.h 100.00% <100.00%> (ø)
src/util/nfa.h 100.00% <100.00%> (ø)
src/util/parse_options.cpp 78.66% <100.00%> (+1.20%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2bd790d...ec9c37f. Read the comment docs.

Copy link
Collaborator

@martin-cs martin-cs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a really cute feature -- we should have this.

src/util/nfa.h Outdated
/// \file
/// \author Diffblue Ltd.
///
/// A simple NFA implementation
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please could you add what it is intended for. There have been other automaton implementations in CPROVER (for SATAbs for example) and I wouldn't like future people to get the wrong idea of what this is.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, will do

Copy link
Contributor

@chrisr-diffblue chrisr-diffblue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this is a bit of feature creep - it is indeed cute, but also really helpful to new users (and old users that typo :-) ) so I'm happy for it to go in.

@hannes-steffenhagen-diffblue hannes-steffenhagen-diffblue merged commit 1426dc0 into diffblue:develop Aug 27, 2020
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.

4 participants