fix: Rename to typos

This commit is contained in:
Ed Page 2019-07-03 19:22:36 -06:00
parent 9692f7cd46
commit 377c911328
10 changed files with 91 additions and 91 deletions

View file

@ -1,4 +1,4 @@
# Contributing to defenestrate # Contributing to `typos`
Thanks for wanting to contribute! There are many ways to contribute and we Thanks for wanting to contribute! There are many ways to contribute and we
appreciate any level you're willing to do. appreciate any level you're willing to do.
@ -61,7 +61,7 @@ When we're ready to release, a project owner should do the following
- `git push upstream master --tag v<X>.<Y>.<Z>` - `git push upstream master --tag v<X>.<Y>.<Z>`
- Run `cargo publish` (run `cargo login` first if needed) - Run `cargo publish` (run `cargo login` first if needed)
[issues]: https://github.com/crate-ci/defenestrate/issues [issues]: https://github.com/epage/typos/issues
[new issue]: https://github.com/crate-ci/defenestrate/issues/new [new issue]: https://github.com/epage/typos/issues/new
[all issues]: https://github.com/crate-ci/defenestrate/issues?utf8=%E2%9C%93&q=is%3Aissue [all issues]: https://github.com/epage/typos/issues?utf8=%E2%9C%93&q=is%3Aissue
[travis]: https://github.com/crate-ci/defenestrate/blob/master/.travis.yml [travis]: https://github.com/epage/typos/blob/master/.travis.yml

44
Cargo.lock generated
View file

@ -143,28 +143,6 @@ dependencies = [
"memchr 2.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "defenestrate"
version = "0.1.0"
dependencies = [
"assert_fs 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
"csv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"grep-searcher 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"ignore 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"phf 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_codegen 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)",
"structopt 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "difference" name = "difference"
version = "2.0.0" version = "2.0.0"
@ -783,6 +761,28 @@ name = "treeline"
version = "0.1.0" version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "typos"
version = "0.1.0"
dependencies = [
"assert_fs 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
"csv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"grep-searcher 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"ignore 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"phf 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_codegen 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)",
"structopt 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "ucd-util" name = "ucd-util"
version = "0.1.3" version = "0.1.3"

View file

@ -1,10 +1,10 @@
[package] [package]
name = "defenestrate" name = "typos"
version = "0.1.0" version = "0.1.0"
authors = ["Ed Page <eopage@gmail.com>"] authors = ["Ed Page <eopage@gmail.com>"]
description = "Source Code Spelling Correction" description = "Source Code Spelling Correction"
repository = "https://github.com/crate-ci/defenestrate" repository = "https://github.com/epage/typos"
documentation = "https://docs.rs/defenestrate" documentation = "https://docs.rs/typos"
readme = "README.md" readme = "README.md"
categories = ["development-tools", "text-processing"] categories = ["development-tools", "text-processing"]
keywords = ["development", "spelling"] keywords = ["development", "spelling"]
@ -12,8 +12,8 @@ license = "MIT"
edition = "2018" edition = "2018"
[badges] [badges]
travis-ci = { repository = "crate-ci/defenestrate" } travis-ci = { repository = "epage/typos" }
appveyor = { repository = "epage/defenestrate" } appveyor = { repository = "epage/typos" }
[features] [features]
# Support quickly iterating # Support quickly iterating

View file

@ -1,12 +1,12 @@
# defenestrate # typos
> **Throw spelling errors out the window** > **Source code spell checker**
[![Travis Status](https://travis-ci.org/crate-ci/defenestrate.svg?branch=master)](https://travis-ci.org/crate-ci/defenestrate) [![Travis Status](https://travis-ci.org/epage/typos.svg?branch=master)](https://travis-ci.org/epage/typos)
[![Appveyor Status](https://ci.appveyor.com/api/projects/status/ngaynop65qg5sqpq/branch/master?svg=true)](https://ci.appveyor.com/project/epage/defenestrate/branch/master) [![Appveyor Status](https://ci.appveyor.com/api/projects/status/ngaynop65qg5sqpq/branch/master?svg=true)](https://ci.appveyor.com/project/epage/typos/branch/master)
[![Documentation](https://img.shields.io/badge/docs-master-blue.svg)][Documentation] [![Documentation](https://img.shields.io/badge/docs-master-blue.svg)][Documentation]
![License](https://img.shields.io/crates/l/defenestrate.svg) ![License](https://img.shields.io/crates/l/typos.svg)
[![Crates Status](https://img.shields.io/crates/v/defenestrate.svg)](https://crates.io/crates/defenestrate) [![Crates Status](https://img.shields.io/crates/v/typos.svg)](https://crates.io/crates/typos)
## [Install](docs/install.md) ## [Install](docs/install.md)
@ -23,5 +23,5 @@ Licensed under either of
at your option. at your option.
[Crates.io]: https://crates.io/crates/defenestrate [Crates.io]: https://crates.io/crates/typos
[Documentation]: https://docs.rs/defenestrate [Documentation]: https://docs.rs/typos

View file

@ -4,13 +4,13 @@ extern crate test;
#[bench] #[bench]
fn load_corrections(b: &mut test::Bencher) { fn load_corrections(b: &mut test::Bencher) {
b.iter(|| defenestrate::Dictionary::new()); b.iter(|| typos::Dictionary::new());
} }
#[bench] #[bench]
fn correct_word_hit(b: &mut test::Bencher) { fn correct_word_hit(b: &mut test::Bencher) {
let corrections = defenestrate::Dictionary::new(); let corrections = typos::Dictionary::new();
let input = defenestrate::tokens::Word::new("successs", 0).unwrap(); let input = typos::tokens::Word::new("successs", 0).unwrap();
assert_eq!( assert_eq!(
corrections.correct_word(input), corrections.correct_word(input),
Some(std::borrow::Cow::Borrowed("successes")) Some(std::borrow::Cow::Borrowed("successes"))
@ -20,8 +20,8 @@ fn correct_word_hit(b: &mut test::Bencher) {
#[bench] #[bench]
fn correct_word_miss(b: &mut test::Bencher) { fn correct_word_miss(b: &mut test::Bencher) {
let corrections = defenestrate::Dictionary::new(); let corrections = typos::Dictionary::new();
let input = defenestrate::tokens::Word::new("success", 0).unwrap(); let input = typos::tokens::Word::new("success", 0).unwrap();
assert_eq!(corrections.correct_word(input), None); assert_eq!(corrections.correct_word(input), None);
b.iter(|| corrections.correct_word(input)); b.iter(|| corrections.correct_word(input));
} }

View file

@ -12,12 +12,12 @@ fn process_empty(b: &mut test::Bencher) {
let sample_path = temp.child("sample"); let sample_path = temp.child("sample");
sample_path.write_str(data::EMPTY).unwrap(); sample_path.write_str(data::EMPTY).unwrap();
let corrections = defenestrate::Dictionary::new(); let corrections = typos::Dictionary::new();
b.iter(|| { b.iter(|| {
defenestrate::process_file( typos::process_file(
sample_path.path(), sample_path.path(),
&corrections, &corrections,
defenestrate::report::print_silent, typos::report::print_silent,
) )
}); });
@ -30,12 +30,12 @@ fn process_no_tokens(b: &mut test::Bencher) {
let sample_path = temp.child("sample"); let sample_path = temp.child("sample");
sample_path.write_str(data::NO_TOKENS).unwrap(); sample_path.write_str(data::NO_TOKENS).unwrap();
let corrections = defenestrate::Dictionary::new(); let corrections = typos::Dictionary::new();
b.iter(|| { b.iter(|| {
defenestrate::process_file( typos::process_file(
sample_path.path(), sample_path.path(),
&corrections, &corrections,
defenestrate::report::print_silent, typos::report::print_silent,
) )
}); });
@ -48,12 +48,12 @@ fn process_single_token(b: &mut test::Bencher) {
let sample_path = temp.child("sample"); let sample_path = temp.child("sample");
sample_path.write_str(data::SINGLE_TOKEN).unwrap(); sample_path.write_str(data::SINGLE_TOKEN).unwrap();
let corrections = defenestrate::Dictionary::new(); let corrections = typos::Dictionary::new();
b.iter(|| { b.iter(|| {
defenestrate::process_file( typos::process_file(
sample_path.path(), sample_path.path(),
&corrections, &corrections,
defenestrate::report::print_silent, typos::report::print_silent,
) )
}); });
@ -66,12 +66,12 @@ fn process_sherlock(b: &mut test::Bencher) {
let sample_path = temp.child("sample"); let sample_path = temp.child("sample");
sample_path.write_str(data::SHERLOCK).unwrap(); sample_path.write_str(data::SHERLOCK).unwrap();
let corrections = defenestrate::Dictionary::new(); let corrections = typos::Dictionary::new();
b.iter(|| { b.iter(|| {
defenestrate::process_file( typos::process_file(
sample_path.path(), sample_path.path(),
&corrections, &corrections,
defenestrate::report::print_silent, typos::report::print_silent,
) )
}); });
@ -84,12 +84,12 @@ fn process_code(b: &mut test::Bencher) {
let sample_path = temp.child("sample"); let sample_path = temp.child("sample");
sample_path.write_str(data::CODE).unwrap(); sample_path.write_str(data::CODE).unwrap();
let corrections = defenestrate::Dictionary::new(); let corrections = typos::Dictionary::new();
b.iter(|| { b.iter(|| {
defenestrate::process_file( typos::process_file(
sample_path.path(), sample_path.path(),
&corrections, &corrections,
defenestrate::report::print_silent, typos::report::print_silent,
) )
}); });
@ -102,12 +102,12 @@ fn process_corpus(b: &mut test::Bencher) {
let sample_path = temp.child("sample"); let sample_path = temp.child("sample");
sample_path.write_str(data::CORPUS).unwrap(); sample_path.write_str(data::CORPUS).unwrap();
let corrections = defenestrate::Dictionary::new(); let corrections = typos::Dictionary::new();
b.iter(|| { b.iter(|| {
defenestrate::process_file( typos::process_file(
sample_path.path(), sample_path.path(),
&corrections, &corrections,
defenestrate::report::print_silent, typos::report::print_silent,
) )
}); });

View file

@ -6,60 +6,60 @@ mod data;
#[bench] #[bench]
fn symbol_parse_empty(b: &mut test::Bencher) { fn symbol_parse_empty(b: &mut test::Bencher) {
b.iter(|| defenestrate::tokens::Identifier::parse(data::EMPTY.as_bytes()).last()); b.iter(|| typos::tokens::Identifier::parse(data::EMPTY.as_bytes()).last());
} }
#[bench] #[bench]
fn symbol_parse_no_tokens(b: &mut test::Bencher) { fn symbol_parse_no_tokens(b: &mut test::Bencher) {
b.iter(|| defenestrate::tokens::Identifier::parse(data::NO_TOKENS.as_bytes()).last()); b.iter(|| typos::tokens::Identifier::parse(data::NO_TOKENS.as_bytes()).last());
} }
#[bench] #[bench]
fn symbol_parse_single_token(b: &mut test::Bencher) { fn symbol_parse_single_token(b: &mut test::Bencher) {
b.iter(|| { b.iter(|| {
defenestrate::tokens::Identifier::parse(data::SINGLE_TOKEN.as_bytes()).last(); typos::tokens::Identifier::parse(data::SINGLE_TOKEN.as_bytes()).last();
}); });
} }
#[bench] #[bench]
fn symbol_parse_sherlock(b: &mut test::Bencher) { fn symbol_parse_sherlock(b: &mut test::Bencher) {
b.iter(|| defenestrate::tokens::Identifier::parse(data::SHERLOCK.as_bytes()).last()); b.iter(|| typos::tokens::Identifier::parse(data::SHERLOCK.as_bytes()).last());
} }
#[bench] #[bench]
fn symbol_parse_code(b: &mut test::Bencher) { fn symbol_parse_code(b: &mut test::Bencher) {
b.iter(|| defenestrate::tokens::Identifier::parse(data::CODE.as_bytes()).last()); b.iter(|| typos::tokens::Identifier::parse(data::CODE.as_bytes()).last());
} }
#[bench] #[bench]
fn symbol_parse_corpus(b: &mut test::Bencher) { fn symbol_parse_corpus(b: &mut test::Bencher) {
b.iter(|| defenestrate::tokens::Identifier::parse(data::CORPUS.as_bytes()).last()); b.iter(|| typos::tokens::Identifier::parse(data::CORPUS.as_bytes()).last());
} }
#[bench] #[bench]
fn symbol_split_lowercase_short(b: &mut test::Bencher) { fn symbol_split_lowercase_short(b: &mut test::Bencher) {
let input = "abcabcabcabc"; let input = "abcabcabcabc";
let symbol = defenestrate::tokens::Identifier::new(input, 0).unwrap(); let symbol = typos::tokens::Identifier::new(input, 0).unwrap();
b.iter(|| symbol.split().last()); b.iter(|| symbol.split().last());
} }
#[bench] #[bench]
fn symbol_split_lowercase_long(b: &mut test::Bencher) { fn symbol_split_lowercase_long(b: &mut test::Bencher) {
let input = "abcabcabcabc".repeat(90); let input = "abcabcabcabc".repeat(90);
let symbol = defenestrate::tokens::Identifier::new(&input, 0).unwrap(); let symbol = typos::tokens::Identifier::new(&input, 0).unwrap();
b.iter(|| symbol.split().last()); b.iter(|| symbol.split().last());
} }
#[bench] #[bench]
fn symbol_split_mixed_short(b: &mut test::Bencher) { fn symbol_split_mixed_short(b: &mut test::Bencher) {
let input = "abcABCAbc123"; let input = "abcABCAbc123";
let symbol = defenestrate::tokens::Identifier::new(input, 0).unwrap(); let symbol = typos::tokens::Identifier::new(input, 0).unwrap();
b.iter(|| symbol.split().last()); b.iter(|| symbol.split().last());
} }
#[bench] #[bench]
fn symbol_split_mixed_long(b: &mut test::Bencher) { fn symbol_split_mixed_long(b: &mut test::Bencher) {
let input = "abcABCAbc123".repeat(90); let input = "abcABCAbc123".repeat(90);
let symbol = defenestrate::tokens::Identifier::new(&input, 0).unwrap(); let symbol = typos::tokens::Identifier::new(&input, 0).unwrap();
b.iter(|| symbol.split().last()); b.iter(|| symbol.split().last());
} }

View file

@ -1,4 +1,4 @@
# About defenestrate # About `typos`
## Design Requirements ## Design Requirements
@ -20,7 +20,7 @@ Quick feedback and resolution for developer:
## Design Trade Offs ## Design Trade Offs
### defenestrate uses a blacklist ### typos uses a blacklist
Blacklist: Known typos that map to their corresponding word Blacklist: Known typos that map to their corresponding word
- Ignores unknown typos - Ignores unknown typos
@ -32,8 +32,8 @@ Whitelist: A confidence rating is given for how close a word is to one in the wh
## Related Spell Checkers ## Related Spell Checkers
| | defenestrate | [scspell3k] | [bloom42/misspell][misspell-rs] | [client9/misspell][misspell-go] | | | typos | [scspell3k] | [bloom42/misspell][misspell-rs] | [client9/misspell][misspell-go] |
|---------------|----------------------|-------------|---------------------------------|---------------------------------| |---------------|-----------------------|-------------|---------------------------------|---------------------------------|
| "Runtime" | Rust ([#18][def-18]) | Python | Rust | None | | "Runtime" | Rust ([#18][def-18]) | Python | Rust | None |
| Dictionary | Blacklist | Whitelist | Blacklist | Blacklist | | Dictionary | Blacklist | Whitelist | Blacklist | Blacklist |
| Custom Dict | No ([#9][def-9]) | Yes | No | ? | | Custom Dict | No ([#9][def-9]) | Yes | No | ? |
@ -50,9 +50,9 @@ Whitelist: A confidence rating is given for how close a word is to one in the wh
[scspell3k]: https://github.com/myint/scspell [scspell3k]: https://github.com/myint/scspell
[misspell-rs]: https://gitlab.com/bloom42/misspell [misspell-rs]: https://gitlab.com/bloom42/misspell
[misspell-go]: https://github.com/client9/misspell [misspell-go]: https://github.com/client9/misspell
[def-9]: https://github.com/epage/defenestrate/issues/9 [def-9]: https://github.com/epage/typos/issues/9
[def-14]: https://github.com/epage/defenestrate/issues/14 [def-14]: https://github.com/epage/typos/issues/14
[def-17]: https://github.com/epage/defenestrate/issues/17 [def-17]: https://github.com/epage/typos/issues/17
[def-18]: https://github.com/epage/defenestrate/issues/18 [def-18]: https://github.com/epage/typos/issues/18
[def-19]: https://github.com/epage/defenestrate/issues/19 [def-19]: https://github.com/epage/typos/issues/19
[def-3]: https://github.com/epage/defenestrate/issues/3 [def-3]: https://github.com/epage/typos/issues/3

View file

@ -3,6 +3,6 @@
For now, `rust` is required for install: For now, `rust` is required for install:
```bash ```bash
cargo install defenestrate cargo install typos
``` ```

View file

@ -15,12 +15,12 @@ arg_enum! {
} }
impl Format { impl Format {
fn report(self) -> defenestrate::report::Report { fn report(self) -> typos::report::Report {
match self { match self {
Format::Silent => defenestrate::report::print_silent, Format::Silent => typos::report::print_silent,
Format::Brief => defenestrate::report::print_brief, Format::Brief => typos::report::print_brief,
Format::Long => defenestrate::report::print_long, Format::Long => typos::report::print_long,
Format::Json => defenestrate::report::print_json, Format::Json => typos::report::print_json,
} }
} }
} }
@ -62,7 +62,7 @@ impl Options {
fn run() -> Result<(), failure::Error> { fn run() -> Result<(), failure::Error> {
let options = Options::from_args().infer(); let options = Options::from_args().infer();
let dictionary = defenestrate::Dictionary::new(); let dictionary = typos::Dictionary::new();
let first_path = &options let first_path = &options
.path .path
@ -77,7 +77,7 @@ fn run() -> Result<(), failure::Error> {
for entry in walk.build() { for entry in walk.build() {
let entry = entry?; let entry = entry?;
if entry.file_type().map(|t| t.is_file()).unwrap_or(true) { if entry.file_type().map(|t| t.is_file()).unwrap_or(true) {
defenestrate::process_file(entry.path(), &dictionary, options.format.report())?; typos::process_file(entry.path(), &dictionary, options.format.report())?;
} }
} }