Commit Graph
38 Commits
Author SHA1 Message Date
Ed Page 0c05b217d4 style: Make clippy happy 2023-09-01 10:20:03 -05:00
Ed Page 8be21b28e7 fix(cli): Improve error when args aren't present 2023-08-21 10:20:16 -05:00
Ed Page c927717f2d fix(cli): Report more errors through report system 2023-08-18 16:28:53 -05:00
Ed Page 104ebdcb6b fix(cli): Report paths with errors 2023-08-18 16:28:00 -05:00
Ed Page e003ac8f1e fix(cli): Improve error on missing config 2023-08-18 16:08:25 -05:00
Ed Page 0becfbf6cf fix: Accidentally ran typos on typos 2023-08-14 15:55:39 -05:00
Ed Page 8f65f4802b chore: Adopt '_rust/main' template 2023-08-14 15:06:53 -05:00
Ed Page ef8bf24e7e fix: Dont check pnpm lockfiles
Fixes #802
2023-08-14 09:36:53 -05:00
Ed Page e12fe9b20b Merge pull request #799 from epage/code
fix(cli): Report bad exit code on disallowed
2023-08-09 08:34:17 -05:00
Ed Page 3bae999225 fix(cli): Report bad exit code on disallowed 2023-08-09 08:21:53 -05:00
Martin Fischer d3e48b202b fix(cli): Allow ot and stap in sh 2023-08-08 18:24:44 +02:00
Martin Fischer e5e8f25c8e fix(cli): Allow nd in css 2023-08-08 18:24:44 +02:00
Martin Fischer 5181c42c57 fix(cli): Allow Nd in man pages 2023-08-08 18:24:44 +02:00
Ed Page 6f0c32c802 Merge pull request #793 from not-my-profile/refactor-file-type-specifics
refactor(cli): Introduce file_type_specifics module
2023-08-08 11:22:10 -05:00
Martin Fischer d9a1085018 refactor(cli): Abstract away regex ignores
This isn't perfect as this only helps when doing checks and not in the
parsing impls.

This supersedes #797
2023-08-08 10:40:22 -05:00
Martin Fischer 5dbe0948d3 docs(cli): Add comments to file-type specific ignores 2023-08-08 06:22:34 +02:00
Martin Fischer fa39bca152 refactor(cli): Introduce file_type_specifics module
This makes the definition of file-type specifics less repetitive.

Resolves #759.
2023-08-08 06:22:34 +02:00
Ed Page d4258b1aa0 fix(cli): Remove stray character on disallowed words 2023-08-07 16:24:51 -05:00
Ed Page f69eec1ce3 Merge pull request #729 from scop/feat/trim-in-extension
feat(cli): Strip `.in` suffix(es) before attempting filename match
2023-07-10 09:59:19 -05:00
Ville Skyttä d6ac36f057 fix(cli): Make .in stripping work with non-UTF-8 filenames 2023-07-09 12:01:53 +03:00
Ed Page 5f1d3c23bc fix(config): Force-skip config files
This doesn't use `extend-exclude` which means that `typos typos.toml`
will stil be skipped

This doesn't just skip the currently loaded config but any file name
that looks like a config, which might be a big aggressive but allows us
to do layered config in the future....  We've been saying that for a
while.

Fixes #711
2023-06-22 12:20:07 -05:00
Ed Page 9e293916d2 fix(config): Always apply type defaults
Fixes #760
2023-06-22 09:57:15 -05:00
Ed Page fce92e4e5f fix(config): User file types override default file types
This also ensures `typos --type-list` will report the glob in only one
place.

Fixes #754
2023-06-21 14:31:04 -05:00
Ed Page 427d127e8a fix: Ensure stdout is locked
In 3a29410c1b, we switched to anstream
which doesn't seem to be locking properly (rust-lang/cargo#12289).  For
now, we are working around it.

Fixes #749
2023-06-20 09:04:31 -05:00
Ville Skyttä 9c74d015f3 feat(cli): Strip .in suffix(es) only on non-match
Makes user assigned `.in` work.
2023-05-25 15:24:04 +03:00
Ville Skyttä 90d4676dd7 feat(cli): Strip .in suffix(es)
`.in` is typically used for build system template input files,
containing some placeholders to replace. In some cases, multiple rounds
of replacements are used, each with their own `.in`, so remove all
trailing instances of it before attempting a filename match.

Closes https://github.com/crate-ci/typos/issues/727
2023-05-24 22:54:45 +03:00
Ed Page 9433f016bb style: Fix formatting 2023-04-24 00:11:34 -05:00
Ed Page 5145767575 chore: Update anstyle 2023-04-12 21:52:15 -05:00
Ed Page ae7f313230 fix(cli): Actually decode UTF-16
Two problems
- I thought we had a UTF-16 test but apparently we didn't
- I didn't read enough fine print in the `encoding_rs` API

These combined meant the last release completely broke UTF-16 support.
2023-03-30 07:27:55 -05:00
Ed Page 98be58dbc9 refactor: Switch out the UTF-16 encoding impl
Fixes #702
2023-03-29 20:42:48 -05:00
Ed Page ac46a6ba54 feat(config): Custom ignores
Typos primarily works off of identifiers and words.  We have built-in
support to detect constructs that span identifiers that should not be
spell checked, like UUIDs, emails, domains, etc.  This opens it up for
for user-defined identifier-spanning constructs using regexes via
`extend-ignore-re`.

This works differently than any of the previous ways of ignoring thing
because the regexes require extra parse passes.  Under the assumption
that (1) actual typos are rare and (2) number of files relying on
`extend-ignore-re` are rare, we only do these extra parse passes when a
typo is found, causing almost no performance hit in the expected case.

While this could be used for more generic types of ignores, it isn't the
most maintainable because it is separate from the source files in
question.  Ideally, we'd implement document settings / directives for
these cases (#316).
2023-03-18 01:25:39 -05:00
Ed Page e4d2d0e54d fix: Actuall ignore ignored identifiers 2023-03-17 23:47:25 -05:00
Ed Page af90817e50 feat(dict): extend-ignore-identifiers-re support
This opens the door for users to provide patterns for identifiers that
are always valid.  The key limitation is "identifiers".  Run `typos
--identifiers` to verify what you are trying to write the regex for.

Fixes #651
2023-03-17 22:40:55 -05:00
Ed Page 52e1743c58 chore: Update to anstream 2023-03-16 05:07:38 -05:00
Ed Page 9504315f7e chore: Update Styled pattern 2023-03-14 08:22:10 -05:00
Ed Page 3a29410c1b fix: Improve color env variable support
- `CLICOLOR=1` now works correctly
- `NO_COLOR=` now works correctly
- Auto-enable colors in CI


For running `typos` on the Linux kernel (176,210 typos to be printed), we went from 20.082s to
<20.450s.  Where in that range is unclear due to jitter in my system.
```console
$ hyperfine -L typos ./typos-main,./typos-anstream "{typos} ../../../linux" -i
Benchmark 1: ./typos-main ../../../linux
  Time (mean ± σ):     20.082 s ±  0.111 s    [User: 39.668 s, System: 0.474 s]
  Range (min … max):   19.961 s … 20.331 s    10 runs

  Warning: Ignoring non-zero exit code.

Benchmark 2: ./typos-anstream ../../../linux
  Time (mean ± σ):     20.426 s ±  0.104 s    [User: 40.301 s, System: 0.523 s]
  Range (min … max):   20.316 s … 20.661 s    10 runs

  Warning: Ignoring non-zero exit code.

Summary
  './typos-main ../../../linux' ran
    1.02 ± 0.01 times faster than './typos-anstream ../../../linux'

$ CLICOLOR_FORCE=1 hyperfine -L typos ./typos-anstream "{typos} ../../../linux" -i
Benchmark 1: ./typos-anstream ../../../linux
  Time (mean ± σ):     20.262 s ±  0.075 s    [User: 39.961 s, System: 0.542 s]
  Range (min … max):   20.154 s … 20.420 s    10 runs

  Warning: Ignoring non-zero exit code.

$ CLICOLOR=0 hyperfine -L typos ./typos-anstream "{typos} ../../../linux" -i
Benchmark 1: ./typos-anstream ../../../linux
  Time (mean ± σ):     20.296 s ±  0.065 s    [User: 40.003 s, System: 0.565 s]
  Range (min … max):   20.169 s … 20.383 s    10 runs

  Warning: Ignoring non-zero exit code.
```
2023-03-13 23:01:45 -05:00
Eric Fu 4eeb460bb7 fix: ignore go.mod by default 2023-03-13 23:53:05 +08:00
Ed Page 13dbffcf7c fix(pre-commit): Separate cli from pre-commit package
Fixes #682
2023-03-08 10:19:20 -06:00