Commit graph

247 commits

Author SHA1 Message Date
Ed Page
e70667ebae fix: Ignore lock files by default
First, this centralizes the concept of lock files, focusing on intent,
rather than syntax.  We are assuming `requirements.txt` for Python is
being used like a regular lock file and not as a dependency
specification.

Second, we then ignore the content.  Though a lock file will generally
contain things that could show up in a dependency specification, the
large dependency trees make that harder to manage.  We still have the
dependency specification file which will match with the users code.

Fixes #445
2022-03-09 08:45:55 -06:00
Ed Page
560de68f58 refactor: Move default config to default types 2022-03-09 08:37:22 -06:00
Ed Page
8cb2d44284 refactor: Pull out custom default types
This is
https://github.com/BurntSushi/ripgrep/blob/master/crates/ignore/src/default_types.rs
at 418d048.
2022-03-09 08:28:23 -06:00
Ed Page
cf20628f28 refactor: Resolve deprecations 2022-03-01 08:38:31 -06:00
Ed Page
4971ea89c9 style: Make clippy happy 2022-01-24 12:14:15 -06:00
Ed Page
9b6b0dee5c test: Ensure extend-words also works
This was fixed in the previous commit when dealing with
deny_unknown_fields.

Fixes #407
2022-01-24 12:01:00 -06:00
Ed Page
55114b3777 fix(config): Allow check-file to work
Looks like `deny_unknown_fields` doesn't work with `flatten`.  See serde-rs/serde#1547.

Fixes #406
2022-01-24 12:01:00 -06:00
Ed Page
9134bec15e refactor(config): Line per attribute 2022-01-24 12:01:00 -06:00
Ed Page
900619be86 docs: Fix typo in example config
Fixes #404
2022-01-24 12:00:59 -06:00
Ed Page
91281038aa fix(config): Update to TOML 1.0
Fixes #405
2022-01-24 12:00:52 -06:00
Ed Page
3d33e7e888 chore: Upgrade concolor 2022-01-11 15:55:20 -06:00
Ed Page
9c5b84d5fe feat: Upgrate to clap3 2021-12-31 15:52:39 -06:00
Ed Page
5c83dec07b style: Remove unused variable 2021-12-14 15:41:52 -06:00
Ed Page
05edccea2e style: Make clippy happy 2021-11-08 11:28:34 -06:00
Ed Page
1046b89208 fix(config): Avoid correcting Rust names
Part of #362
2021-10-23 09:24:37 -05:00
Ed Page
b7812e616c fix(config): Check project files with language
For `rg`, keeping the file types strict makes sense,  For spell
checking, `Cargo.toml` is a lot more closely related in handling to
`*.rs` than it is to `pyproject.toml` due to ecosystem package names.

Part of #362
2021-10-23 09:24:31 -05:00
Ed Page
29ebe5ab48 fix(config): Skip lock files by default
Part of #362
2021-10-23 09:24:25 -05:00
Ed Page
83dc9dcb5f fix(config): Overlay default/overrides with type-config 2021-10-23 09:24:25 -05:00
Ed Page
b17b811ec1 feat(cli): Smarter color control 2021-10-06 10:08:42 -05:00
Ed Page
27bd817498 fix(config): Skip checking cert contents
Fixes #327
2021-08-04 07:12:10 -05:00
Ed Page
7ce0438a70 refactor(config): Allow defaulting type patterns 2021-08-04 07:12:10 -05:00
Ed Page
10a2486163 perf(diff): Don't lock on every line 2021-07-06 09:27:31 -05:00
Ed Page
1b3f1f6b46 fix(diff): Handle broken pipe 2021-07-06 09:26:08 -05:00
Ed Page
c8d1058a71 refactor(dict): Change typos-dict to trie
This is +/- 15%, depending on the benchmark.
2021-07-01 10:41:56 -05:00
Ed Page
bbbf985777 perf(dict): Switch varcon to a burst-trie
This cuts varcon lookup times in half but I still suspect slower than
phf.  Like with bsearch and unlike, the cost is consistent between hits
and misses.

At least this doesn't have the compile hit of PHF + unicase.  Maybe I
should experiment with integrating a non-const-fn variant of unicase
with PHF and give up on all of this extra complexity.
2021-06-30 21:03:57 -05:00
Ed Page
a1e95bc7c0 refactor(dict): Pull out table-lookup logic
Before, only some dicts did we guarentee were pre-sorted.  Now, all are
for-sure pre-sorted.

This also gives each dict the size-check to avoid lookup.

But this is really about refactoring in prep for playing with other
lookup options, like tries.
2021-06-30 10:12:17 -05:00
Ed Page
32f5e6c682 refactor(typos)!: Bake ignores into parser
This is prep for other items to be ignored

BREAKING CHANGE: `TokenizerBuilder` no longer takes config for ignoring
tokens.  Related, we now ignore token-ignore config flags.
2021-06-29 11:41:25 -05:00
Ed Page
655b6571bd fix(cli): Don't crash on races
I misused `compare_exchange` when I didn't even really need it.

Fixes #284
2021-06-15 16:50:12 -05:00
Brian Teeman
4caddb6a80
Typo
The irony of a typo in typos is not missing
2021-06-08 08:35:08 +01:00
Ed Page
20f4e5de75 fix(cli): Don't panic
Fixes #277
2021-06-07 07:44:21 -05:00
Ed Page
60fe94c292 fix(cli): Ensure we can run on files 2021-06-05 13:52:44 -05:00
Ed Page
0aaa2c0d60
Merge pull request #272 from epage/phf1
refactor(varcon): Remove reliance on const-fn
2021-06-05 11:50:35 -05:00
Ed Page
b1cf03c7eb refactor(varcon): Move away from PHF
This is mostly to give implementation flexibility for changing out how
we store the data to reduce compilation memory usage.

This does have performance impact, jumping from ~220ns to ~320ns for a
dict lookup, according to our micro benchmarks.
2021-06-04 14:59:46 -05:00
Ed Page
6365eeb0ce docs(cli): Clarify help string for 'exclude'
Fixes #269
2021-06-03 20:04:46 -05:00
Ed Page
d45e7cf5a3 fix(cli): Don't crash on stdin
Fixes #264
2021-05-28 19:02:27 -05:00
Ed Page
9859e60077 fix(cli): Don't panic when finding column
When rendering typos, we look up what visual column the typoe starts on
but I mixed a raw byte offset with the offset into a lossy string.  This
caused panics when dealing with non-ascii content.

Fixes #258
2021-05-27 21:28:42 -05:00
Ed Page
2b5699180c fix: Count lines correctly
I didn't count on how `buffer.lines().count()` would handle different
corner cases, like slices with no `\n`, slices with trailing `\n`, etc.

Fixes #259
2021-05-27 13:24:38 -05:00
Ed Page
327a84a242 feat(ignore): Typos=specific ignores
We want both CLI and config ignores.  The question then is what we make
them relative to.  I decided to favor CLI with `.`.  We'll see how this
works out

Fixes #134
2021-05-20 21:00:28 -05:00
Ed Page
b99f32dea8 perf(dict): Bypass vars when possible
Variant support slows us down by 10-50$.  I assume most people will run
with `en` and so most of this overhead is to waste.  So instead of
merging vars with dict, let's instead get a quick win by just skipping
vars when we don't need to.  If the assumptions behind this change over
time or if there is need for speeding up a specific locale, we can
re-address this.

Before:
```
check_file/Typos/code   time:   [35.860 us 36.021 us 36.187 us]
                        thrpt:  [8.0117 MiB/s 8.0486 MiB/s 8.0846 MiB/s]
check_file/Typos/corpus time:   [26.966 ms 27.215 ms 27.521 ms]
                        thrpt:  [21.127 MiB/s 21.365 MiB/s 21.562 MiB/s]
```
After:
```
check_file/Typos/code   time:   [33.837 us 33.928 us 34.031 us]
                        thrpt:  [8.5191 MiB/s 8.5452 MiB/s 8.5680 MiB/s]
check_file/Typos/corpus time:   [17.521 ms 17.620 ms 17.730 ms]
                        thrpt:  [32.794 MiB/s 32.999 MiB/s 33.184 MiB/s]
```

This puts us inline with `--no-default-features --features dict`

Fixes #253
2021-05-19 13:55:41 -05:00
Ed Page
d65fa79d0e refactor(dict): Make feature flag paths clearer 2021-05-18 19:45:11 -05:00
Ed Page
639e65b88a fix(dict): Handle cases from Linux
These were found while running `typos` on Linux and inspecting a
sampling of the results.  #249 represents additional changes to make.
There were some identifiers, that looked like hardware registers, that
I'm unsure of what can be done for them.
2021-05-18 12:02:03 -05:00
Ed Page
fb0dac4297 refactor(dict): Allow 0..n corrections in BuiltIn
The main use case is taking `ther` -> `there` and adding `the` and
`their`.
2021-05-18 12:02:03 -05:00
Ed Page
04e55e4e85 fix(dict): Correctly connect dict with varcon
We had a bug where `finallizes` with EnGb would not correct to
`finalises`
2021-05-17 21:23:12 -05:00
Ed Page
e3c191e07e fix(cli): Display shortened paths to users
Before, we always displayed absolute paths and now we'll display
relative ones.

The main issue was loading the config correctly.  We just have to
cannonicalize whenever doing so.
2021-05-14 20:39:08 -05:00
Ed Page
1a1ff20f40 fix(cli): Discover config in parent dirs
My only guess is that in a76ddd42, I lost track of different parts of my
change and never re-implemented this logic.
2021-05-14 14:06:20 -05:00
Ed Page
a0c592ff81 feat(cli): Provide traceability on config loading 2021-05-14 14:02:58 -05:00
Ed Page
c4050b41a2 fix(cli): Clarify API stabiliy
For now, I'm just punting on `typos_cli`s API.

Fixes #171
2021-05-13 13:34:27 -05:00
Ed Page
b830872ad0 chore: Update enumflags2 2021-05-13 10:20:15 -05:00
Ed Page
60950d02bb feat(cli): Colored output
This supports
- Basic capability detection
- NO_COLOR env variable
- tty detection
- CLI overrides

This does not yet support CLICOLOR.  I'll be trying to upstream all of
this into `yansi` and get it taken care of there.

This only supports Windows Anniversary edition and later which I think
is a fine compromise due to the ergonomic difference between `yansi` and
`termcolor`.

Fixes #30
2021-05-12 21:11:52 -05:00
Ed Page
943ae7f490 refactor(cli)!: Shift Report impls to bin
This way we can add dependencies on things like `yansi` without worrying
about compatibility.
2021-05-12 19:51:41 -05:00