mirror of
https://github.com/crate-ci/typos.git
synced 2024-12-22 23:52:12 -05:00
commit
2073c3a4fc
10 changed files with 91 additions and 91 deletions
|
@ -1,4 +1,4 @@
|
|||
# Contributing to defenestrate
|
||||
# Contributing to `typos`
|
||||
|
||||
Thanks for wanting to contribute! There are many ways to contribute and we
|
||||
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>`
|
||||
- Run `cargo publish` (run `cargo login` first if needed)
|
||||
|
||||
[issues]: https://github.com/crate-ci/defenestrate/issues
|
||||
[new issue]: https://github.com/crate-ci/defenestrate/issues/new
|
||||
[all issues]: https://github.com/crate-ci/defenestrate/issues?utf8=%E2%9C%93&q=is%3Aissue
|
||||
[travis]: https://github.com/crate-ci/defenestrate/blob/master/.travis.yml
|
||||
[issues]: https://github.com/epage/typos/issues
|
||||
[new issue]: https://github.com/epage/typos/issues/new
|
||||
[all issues]: https://github.com/epage/typos/issues?utf8=%E2%9C%93&q=is%3Aissue
|
||||
[travis]: https://github.com/epage/typos/blob/master/.travis.yml
|
||||
|
|
44
Cargo.lock
generated
44
Cargo.lock
generated
|
@ -143,28 +143,6 @@ dependencies = [
|
|||
"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]]
|
||||
name = "difference"
|
||||
version = "2.0.0"
|
||||
|
@ -783,6 +761,28 @@ name = "treeline"
|
|||
version = "0.1.0"
|
||||
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]]
|
||||
name = "ucd-util"
|
||||
version = "0.1.3"
|
||||
|
|
10
Cargo.toml
10
Cargo.toml
|
@ -1,10 +1,10 @@
|
|||
[package]
|
||||
name = "defenestrate"
|
||||
name = "typos"
|
||||
version = "0.1.0"
|
||||
authors = ["Ed Page <eopage@gmail.com>"]
|
||||
description = "Source Code Spelling Correction"
|
||||
repository = "https://github.com/crate-ci/defenestrate"
|
||||
documentation = "https://docs.rs/defenestrate"
|
||||
repository = "https://github.com/epage/typos"
|
||||
documentation = "https://docs.rs/typos"
|
||||
readme = "README.md"
|
||||
categories = ["development-tools", "text-processing"]
|
||||
keywords = ["development", "spelling"]
|
||||
|
@ -12,8 +12,8 @@ license = "MIT"
|
|||
edition = "2018"
|
||||
|
||||
[badges]
|
||||
travis-ci = { repository = "crate-ci/defenestrate" }
|
||||
appveyor = { repository = "epage/defenestrate" }
|
||||
travis-ci = { repository = "epage/typos" }
|
||||
appveyor = { repository = "epage/typos" }
|
||||
|
||||
[features]
|
||||
# Support quickly iterating
|
||||
|
|
16
README.md
16
README.md
|
@ -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)
|
||||
[![Appveyor Status](https://ci.appveyor.com/api/projects/status/ngaynop65qg5sqpq/branch/master?svg=true)](https://ci.appveyor.com/project/epage/defenestrate/branch/master)
|
||||
[![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/typos/branch/master)
|
||||
[![Documentation](https://img.shields.io/badge/docs-master-blue.svg)][Documentation]
|
||||
![License](https://img.shields.io/crates/l/defenestrate.svg)
|
||||
[![Crates Status](https://img.shields.io/crates/v/defenestrate.svg)](https://crates.io/crates/defenestrate)
|
||||
![License](https://img.shields.io/crates/l/typos.svg)
|
||||
[![Crates Status](https://img.shields.io/crates/v/typos.svg)](https://crates.io/crates/typos)
|
||||
|
||||
## [Install](docs/install.md)
|
||||
|
||||
|
@ -23,5 +23,5 @@ Licensed under either of
|
|||
|
||||
at your option.
|
||||
|
||||
[Crates.io]: https://crates.io/crates/defenestrate
|
||||
[Documentation]: https://docs.rs/defenestrate
|
||||
[Crates.io]: https://crates.io/crates/typos
|
||||
[Documentation]: https://docs.rs/typos
|
||||
|
|
|
@ -4,13 +4,13 @@ extern crate test;
|
|||
|
||||
#[bench]
|
||||
fn load_corrections(b: &mut test::Bencher) {
|
||||
b.iter(|| defenestrate::Dictionary::new());
|
||||
b.iter(|| typos::Dictionary::new());
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn correct_word_hit(b: &mut test::Bencher) {
|
||||
let corrections = defenestrate::Dictionary::new();
|
||||
let input = defenestrate::tokens::Word::new("successs", 0).unwrap();
|
||||
let corrections = typos::Dictionary::new();
|
||||
let input = typos::tokens::Word::new("successs", 0).unwrap();
|
||||
assert_eq!(
|
||||
corrections.correct_word(input),
|
||||
Some(std::borrow::Cow::Borrowed("successes"))
|
||||
|
@ -20,8 +20,8 @@ fn correct_word_hit(b: &mut test::Bencher) {
|
|||
|
||||
#[bench]
|
||||
fn correct_word_miss(b: &mut test::Bencher) {
|
||||
let corrections = defenestrate::Dictionary::new();
|
||||
let input = defenestrate::tokens::Word::new("success", 0).unwrap();
|
||||
let corrections = typos::Dictionary::new();
|
||||
let input = typos::tokens::Word::new("success", 0).unwrap();
|
||||
assert_eq!(corrections.correct_word(input), None);
|
||||
b.iter(|| corrections.correct_word(input));
|
||||
}
|
||||
|
|
|
@ -12,12 +12,12 @@ fn process_empty(b: &mut test::Bencher) {
|
|||
let sample_path = temp.child("sample");
|
||||
sample_path.write_str(data::EMPTY).unwrap();
|
||||
|
||||
let corrections = defenestrate::Dictionary::new();
|
||||
let corrections = typos::Dictionary::new();
|
||||
b.iter(|| {
|
||||
defenestrate::process_file(
|
||||
typos::process_file(
|
||||
sample_path.path(),
|
||||
&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");
|
||||
sample_path.write_str(data::NO_TOKENS).unwrap();
|
||||
|
||||
let corrections = defenestrate::Dictionary::new();
|
||||
let corrections = typos::Dictionary::new();
|
||||
b.iter(|| {
|
||||
defenestrate::process_file(
|
||||
typos::process_file(
|
||||
sample_path.path(),
|
||||
&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");
|
||||
sample_path.write_str(data::SINGLE_TOKEN).unwrap();
|
||||
|
||||
let corrections = defenestrate::Dictionary::new();
|
||||
let corrections = typos::Dictionary::new();
|
||||
b.iter(|| {
|
||||
defenestrate::process_file(
|
||||
typos::process_file(
|
||||
sample_path.path(),
|
||||
&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");
|
||||
sample_path.write_str(data::SHERLOCK).unwrap();
|
||||
|
||||
let corrections = defenestrate::Dictionary::new();
|
||||
let corrections = typos::Dictionary::new();
|
||||
b.iter(|| {
|
||||
defenestrate::process_file(
|
||||
typos::process_file(
|
||||
sample_path.path(),
|
||||
&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");
|
||||
sample_path.write_str(data::CODE).unwrap();
|
||||
|
||||
let corrections = defenestrate::Dictionary::new();
|
||||
let corrections = typos::Dictionary::new();
|
||||
b.iter(|| {
|
||||
defenestrate::process_file(
|
||||
typos::process_file(
|
||||
sample_path.path(),
|
||||
&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");
|
||||
sample_path.write_str(data::CORPUS).unwrap();
|
||||
|
||||
let corrections = defenestrate::Dictionary::new();
|
||||
let corrections = typos::Dictionary::new();
|
||||
b.iter(|| {
|
||||
defenestrate::process_file(
|
||||
typos::process_file(
|
||||
sample_path.path(),
|
||||
&corrections,
|
||||
defenestrate::report::print_silent,
|
||||
typos::report::print_silent,
|
||||
)
|
||||
});
|
||||
|
||||
|
|
|
@ -6,60 +6,60 @@ mod data;
|
|||
|
||||
#[bench]
|
||||
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]
|
||||
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]
|
||||
fn symbol_parse_single_token(b: &mut test::Bencher) {
|
||||
b.iter(|| {
|
||||
defenestrate::tokens::Identifier::parse(data::SINGLE_TOKEN.as_bytes()).last();
|
||||
typos::tokens::Identifier::parse(data::SINGLE_TOKEN.as_bytes()).last();
|
||||
});
|
||||
}
|
||||
|
||||
#[bench]
|
||||
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]
|
||||
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]
|
||||
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]
|
||||
fn symbol_split_lowercase_short(b: &mut test::Bencher) {
|
||||
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());
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn symbol_split_lowercase_long(b: &mut test::Bencher) {
|
||||
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());
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn symbol_split_mixed_short(b: &mut test::Bencher) {
|
||||
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());
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn symbol_split_mixed_long(b: &mut test::Bencher) {
|
||||
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());
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# About defenestrate
|
||||
# About `typos`
|
||||
|
||||
## Design Requirements
|
||||
|
||||
|
@ -20,7 +20,7 @@ Quick feedback and resolution for developer:
|
|||
|
||||
## Design Trade Offs
|
||||
|
||||
### defenestrate uses a blacklist
|
||||
### typos uses a blacklist
|
||||
|
||||
Blacklist: Known typos that map to their corresponding word
|
||||
- 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
|
||||
|
||||
| | 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 |
|
||||
| Dictionary | Blacklist | Whitelist | Blacklist | Blacklist |
|
||||
| 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
|
||||
[misspell-rs]: https://gitlab.com/bloom42/misspell
|
||||
[misspell-go]: https://github.com/client9/misspell
|
||||
[def-9]: https://github.com/epage/defenestrate/issues/9
|
||||
[def-14]: https://github.com/epage/defenestrate/issues/14
|
||||
[def-17]: https://github.com/epage/defenestrate/issues/17
|
||||
[def-18]: https://github.com/epage/defenestrate/issues/18
|
||||
[def-19]: https://github.com/epage/defenestrate/issues/19
|
||||
[def-3]: https://github.com/epage/defenestrate/issues/3
|
||||
[def-9]: https://github.com/epage/typos/issues/9
|
||||
[def-14]: https://github.com/epage/typos/issues/14
|
||||
[def-17]: https://github.com/epage/typos/issues/17
|
||||
[def-18]: https://github.com/epage/typos/issues/18
|
||||
[def-19]: https://github.com/epage/typos/issues/19
|
||||
[def-3]: https://github.com/epage/typos/issues/3
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
For now, `rust` is required for install:
|
||||
|
||||
```bash
|
||||
cargo install defenestrate
|
||||
cargo install typos
|
||||
```
|
||||
|
||||
|
|
14
src/main.rs
14
src/main.rs
|
@ -15,12 +15,12 @@ arg_enum! {
|
|||
}
|
||||
|
||||
impl Format {
|
||||
fn report(self) -> defenestrate::report::Report {
|
||||
fn report(self) -> typos::report::Report {
|
||||
match self {
|
||||
Format::Silent => defenestrate::report::print_silent,
|
||||
Format::Brief => defenestrate::report::print_brief,
|
||||
Format::Long => defenestrate::report::print_long,
|
||||
Format::Json => defenestrate::report::print_json,
|
||||
Format::Silent => typos::report::print_silent,
|
||||
Format::Brief => typos::report::print_brief,
|
||||
Format::Long => typos::report::print_long,
|
||||
Format::Json => typos::report::print_json,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ impl Options {
|
|||
fn run() -> Result<(), failure::Error> {
|
||||
let options = Options::from_args().infer();
|
||||
|
||||
let dictionary = defenestrate::Dictionary::new();
|
||||
let dictionary = typos::Dictionary::new();
|
||||
|
||||
let first_path = &options
|
||||
.path
|
||||
|
@ -77,7 +77,7 @@ fn run() -> Result<(), failure::Error> {
|
|||
for entry in walk.build() {
|
||||
let entry = entry?;
|
||||
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())?;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue