typos 1.36.1__tar.gz → 1.36.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of typos might be problematic. Click here for more details.

Files changed (55) hide show
  1. {typos-1.36.1 → typos-1.36.3}/Cargo.lock +2 -2
  2. {typos-1.36.1 → typos-1.36.3}/PKG-INFO +1 -1
  3. {typos-1.36.1/crates/typos-dict → typos-1.36.3/crates/typos}/README.md +1 -1
  4. {typos-1.36.1 → typos-1.36.3}/crates/typos-cli/Cargo.toml +1 -1
  5. {typos-1.36.1/crates/typos → typos-1.36.3/crates/typos-cli}/README.md +1 -1
  6. {typos-1.36.1 → typos-1.36.3}/crates/typos-cli/src/bin/typos-cli/report.rs +39 -15
  7. {typos-1.36.1 → typos-1.36.3}/crates/typos-dict/Cargo.toml +1 -1
  8. {typos-1.36.1/crates/typos-vars → typos-1.36.3/crates/typos-dict}/README.md +1 -1
  9. {typos-1.36.1 → typos-1.36.3}/crates/typos-dict/src/word_codegen.rs +119167 -119169
  10. {typos-1.36.1/crates/typos-cli → typos-1.36.3/crates/typos-vars}/README.md +1 -1
  11. typos-1.36.3/crates/varcon/README.md +190 -0
  12. typos-1.36.3/crates/varcon-core/README.md +190 -0
  13. typos-1.36.1/crates/varcon/README.md +0 -190
  14. typos-1.36.1/crates/varcon-core/README.md +0 -190
  15. {typos-1.36.1 → typos-1.36.3}/Cargo.toml +0 -0
  16. {typos-1.36.1 → typos-1.36.3}/crates/dictgen/Cargo.toml +0 -0
  17. {typos-1.36.1 → typos-1.36.3}/crates/dictgen/src/aho_corasick.rs +0 -0
  18. {typos-1.36.1 → typos-1.36.3}/crates/dictgen/src/gen.rs +0 -0
  19. {typos-1.36.1 → typos-1.36.3}/crates/dictgen/src/insensitive.rs +0 -0
  20. {typos-1.36.1 → typos-1.36.3}/crates/dictgen/src/lib.rs +0 -0
  21. {typos-1.36.1 → typos-1.36.3}/crates/dictgen/src/map.rs +0 -0
  22. {typos-1.36.1 → typos-1.36.3}/crates/dictgen/src/match.rs +0 -0
  23. {typos-1.36.1 → typos-1.36.3}/crates/dictgen/src/ordered_map.rs +0 -0
  24. {typos-1.36.1 → typos-1.36.3}/crates/dictgen/src/trie.rs +0 -0
  25. {typos-1.36.1 → typos-1.36.3}/crates/typos/Cargo.toml +0 -0
  26. {typos-1.36.1 → typos-1.36.3}/crates/typos/src/check.rs +0 -0
  27. {typos-1.36.1 → typos-1.36.3}/crates/typos/src/dict.rs +0 -0
  28. {typos-1.36.1 → typos-1.36.3}/crates/typos/src/lib.rs +0 -0
  29. {typos-1.36.1 → typos-1.36.3}/crates/typos/src/tokens.rs +0 -0
  30. {typos-1.36.1 → typos-1.36.3}/crates/typos-cli/src/bin/typos-cli/args.rs +0 -0
  31. {typos-1.36.1 → typos-1.36.3}/crates/typos-cli/src/bin/typos-cli/main.rs +0 -0
  32. {typos-1.36.1 → typos-1.36.3}/crates/typos-cli/src/config.rs +0 -0
  33. {typos-1.36.1 → typos-1.36.3}/crates/typos-cli/src/default_types.rs +0 -0
  34. {typos-1.36.1 → typos-1.36.3}/crates/typos-cli/src/dict.rs +0 -0
  35. {typos-1.36.1 → typos-1.36.3}/crates/typos-cli/src/file.rs +0 -0
  36. {typos-1.36.1 → typos-1.36.3}/crates/typos-cli/src/file_type.rs +0 -0
  37. {typos-1.36.1 → typos-1.36.3}/crates/typos-cli/src/file_type_specifics.rs +0 -0
  38. {typos-1.36.1 → typos-1.36.3}/crates/typos-cli/src/lib.rs +0 -0
  39. {typos-1.36.1 → typos-1.36.3}/crates/typos-cli/src/policy.rs +0 -0
  40. {typos-1.36.1 → typos-1.36.3}/crates/typos-cli/src/report.rs +0 -0
  41. {typos-1.36.1 → typos-1.36.3}/crates/typos-cli/tests/cmd/en-us.in/README.md +0 -0
  42. {typos-1.36.1 → typos-1.36.3}/crates/typos-cli/tests/cmd/false-positives.in/README.md +0 -0
  43. {typos-1.36.1 → typos-1.36.3}/crates/typos-cli/tests/cmd/filename-typo.in/README.md +0 -0
  44. {typos-1.36.1 → typos-1.36.3}/crates/typos-dict/src/lib.rs +0 -0
  45. {typos-1.36.1 → typos-1.36.3}/crates/typos-vars/Cargo.toml +0 -0
  46. {typos-1.36.1 → typos-1.36.3}/crates/typos-vars/src/lib.rs +0 -0
  47. {typos-1.36.1 → typos-1.36.3}/crates/typos-vars/src/vars_codegen.rs +0 -0
  48. {typos-1.36.1 → typos-1.36.3}/crates/varcon/Cargo.toml +0 -0
  49. {typos-1.36.1 → typos-1.36.3}/crates/varcon/src/codegen.rs +0 -0
  50. {typos-1.36.1 → typos-1.36.3}/crates/varcon/src/lib.rs +0 -0
  51. {typos-1.36.1 → typos-1.36.3}/crates/varcon-core/Cargo.toml +0 -0
  52. {typos-1.36.1 → typos-1.36.3}/crates/varcon-core/src/borrowed.rs +0 -0
  53. {typos-1.36.1 → typos-1.36.3}/crates/varcon-core/src/lib.rs +0 -0
  54. {typos-1.36.1 → typos-1.36.3}/crates/varcon-core/src/parser.rs +0 -0
  55. {typos-1.36.1 → typos-1.36.3}/pyproject.toml +0 -0
@@ -1572,7 +1572,7 @@ dependencies = [
1572
1572
 
1573
1573
  [[package]]
1574
1574
  name = "typos-cli"
1575
- version = "1.36.1"
1575
+ version = "1.36.3"
1576
1576
  dependencies = [
1577
1577
  "ahash",
1578
1578
  "annotate-snippets",
@@ -1621,7 +1621,7 @@ dependencies = [
1621
1621
 
1622
1622
  [[package]]
1623
1623
  name = "typos-dict"
1624
- version = "0.13.3"
1624
+ version = "0.13.4"
1625
1625
  dependencies = [
1626
1626
  "codegenrs",
1627
1627
  "csv",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: typos
3
- Version: 1.36.1
3
+ Version: 1.36.3
4
4
  Classifier: Environment :: Console
5
5
  Classifier: Intended Audience :: Developers
6
6
  Classifier: Topic :: Software Development
@@ -43,7 +43,7 @@ Dual-licensed under [MIT](LICENSE-MIT) or [Apache 2.0](LICENSE-APACHE)
43
43
 
44
44
  Or use rust to install:
45
45
  ```console
46
- $ cargo install typos-cli
46
+ $ cargo install typos-cli --locked
47
47
  ```
48
48
 
49
49
  Or use [Homebrew](https://brew.sh/) to install:
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "typos-cli"
3
- version = "1.36.1"
3
+ version = "1.36.3"
4
4
  description = "Source Code Spelling Correction"
5
5
  readme = "README.md"
6
6
  categories = ["development-tools", "text-processing"]
@@ -43,7 +43,7 @@ Dual-licensed under [MIT](LICENSE-MIT) or [Apache 2.0](LICENSE-APACHE)
43
43
 
44
44
  Or use rust to install:
45
45
  ```console
46
- $ cargo install typos-cli
46
+ $ cargo install typos-cli --locked
47
47
  ```
48
48
 
49
49
  Or use [Homebrew](https://brew.sh/) to install:
@@ -2,6 +2,7 @@
2
2
 
3
3
  use std::borrow::Cow;
4
4
  use std::io::Write as _;
5
+ use std::ops::Range;
5
6
  use std::sync::{atomic, Mutex};
6
7
 
7
8
  use annotate_snippets::Annotation;
@@ -162,22 +163,24 @@ fn typo_to_group<'t>(msg: &'t Typo<'t>) -> Group<'t> {
162
163
  let group = match &msg.context {
163
164
  Some(Context::File(context)) => {
164
165
  let path = context.path.as_os_str().to_string_lossy();
165
- let line = String::from_utf8_lossy(msg.buffer.as_ref());
166
+ let (line, span) = to_string(&msg.buffer, msg.byte_offset, msg.typo.len());
166
167
  let snippet = Snippet::source(line)
167
168
  .path(path)
168
169
  .line_start(context.line_num);
169
- append_corrections(msg, 0, snippet, group)
170
+ append_corrections(span, snippet, group)
170
171
  }
171
172
  Some(Context::Path(context)) => {
172
- let path = context
173
- .path
174
- .parent()
175
- .unwrap_or(std::path::Path::new("."))
176
- .join("");
177
- let path = path.as_os_str().to_string_lossy();
178
- let line = context.path.as_os_str().to_string_lossy();
173
+ let parent = context.path.parent().unwrap_or(std::path::Path::new("."));
174
+ let parent = parent.as_os_str().to_string_lossy();
175
+ let mut line = parent.into_owned();
176
+ line.push(std::path::MAIN_SEPARATOR);
177
+ let parent_len = line.len();
178
+ let mut line = line.into_bytes();
179
+ line.extend(msg.buffer.iter());
180
+ let (line, span) = to_string(&line, parent_len + msg.byte_offset, msg.typo.len());
181
+ let line = line.into_owned();
179
182
  let snippet = Snippet::source(line);
180
- append_corrections(msg, path.len(), snippet, group)
183
+ append_corrections(span, snippet, group)
181
184
  }
182
185
  Some(_) | None => group,
183
186
  };
@@ -185,18 +188,39 @@ fn typo_to_group<'t>(msg: &'t Typo<'t>) -> Group<'t> {
185
188
  }
186
189
 
187
190
  fn append_corrections<'t>(
188
- msg: &'t Typo<'t>,
189
- offset: usize,
191
+ span: Range<usize>,
190
192
  snippet: Snippet<'t, Annotation<'t>>,
191
193
  group: Group<'t>,
192
194
  ) -> Group<'t> {
193
- let span_start = msg.byte_offset + offset;
194
- let span_end = span_start + msg.typo.len();
195
- let span = span_start..span_end;
196
195
  let snippet = snippet.annotation(AnnotationKind::Primary.span(span));
197
196
  group.element(snippet)
198
197
  }
199
198
 
199
+ fn to_string(line: &[u8], start: usize, len: usize) -> (Cow<'_, str>, Range<usize>) {
200
+ let end = start + len;
201
+
202
+ if let Ok(line) = std::str::from_utf8(line) {
203
+ return (Cow::Borrowed(line), start..end);
204
+ }
205
+
206
+ let prefix = &line[0..start];
207
+ let prefix = String::from_utf8_lossy(prefix);
208
+
209
+ let middle = &line[start..end];
210
+ let middle = String::from_utf8_lossy(middle);
211
+
212
+ let suffix = &line[end..];
213
+ let suffix = String::from_utf8_lossy(suffix);
214
+
215
+ let span_start = prefix.len();
216
+ let span_end = span_start + middle.len();
217
+
218
+ (
219
+ Cow::Owned(format!("{prefix}{middle}{suffix}")),
220
+ span_start..span_end,
221
+ )
222
+ }
223
+
200
224
  fn error_to_group<'e>(error: &'e Error<'e>) -> Group<'e> {
201
225
  let group = Group::with_title(Level::ERROR.primary_title(&error.msg));
202
226
  match &error.context {
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "typos-dict"
3
- version = "0.13.3"
3
+ version = "0.13.4"
4
4
  description = "Source Code Spelling Correction"
5
5
  readme = "README.md"
6
6
  categories = ["development-tools", "text-processing"]
@@ -43,7 +43,7 @@ Dual-licensed under [MIT](LICENSE-MIT) or [Apache 2.0](LICENSE-APACHE)
43
43
 
44
44
  Or use rust to install:
45
45
  ```console
46
- $ cargo install typos-cli
46
+ $ cargo install typos-cli --locked
47
47
  ```
48
48
 
49
49
  Or use [Homebrew](https://brew.sh/) to install: