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.
- {typos-1.36.1 → typos-1.36.3}/Cargo.lock +2 -2
- {typos-1.36.1 → typos-1.36.3}/PKG-INFO +1 -1
- {typos-1.36.1/crates/typos-dict → typos-1.36.3/crates/typos}/README.md +1 -1
- {typos-1.36.1 → typos-1.36.3}/crates/typos-cli/Cargo.toml +1 -1
- {typos-1.36.1/crates/typos → typos-1.36.3/crates/typos-cli}/README.md +1 -1
- {typos-1.36.1 → typos-1.36.3}/crates/typos-cli/src/bin/typos-cli/report.rs +39 -15
- {typos-1.36.1 → typos-1.36.3}/crates/typos-dict/Cargo.toml +1 -1
- {typos-1.36.1/crates/typos-vars → typos-1.36.3/crates/typos-dict}/README.md +1 -1
- {typos-1.36.1 → typos-1.36.3}/crates/typos-dict/src/word_codegen.rs +119167 -119169
- {typos-1.36.1/crates/typos-cli → typos-1.36.3/crates/typos-vars}/README.md +1 -1
- typos-1.36.3/crates/varcon/README.md +190 -0
- typos-1.36.3/crates/varcon-core/README.md +190 -0
- typos-1.36.1/crates/varcon/README.md +0 -190
- typos-1.36.1/crates/varcon-core/README.md +0 -190
- {typos-1.36.1 → typos-1.36.3}/Cargo.toml +0 -0
- {typos-1.36.1 → typos-1.36.3}/crates/dictgen/Cargo.toml +0 -0
- {typos-1.36.1 → typos-1.36.3}/crates/dictgen/src/aho_corasick.rs +0 -0
- {typos-1.36.1 → typos-1.36.3}/crates/dictgen/src/gen.rs +0 -0
- {typos-1.36.1 → typos-1.36.3}/crates/dictgen/src/insensitive.rs +0 -0
- {typos-1.36.1 → typos-1.36.3}/crates/dictgen/src/lib.rs +0 -0
- {typos-1.36.1 → typos-1.36.3}/crates/dictgen/src/map.rs +0 -0
- {typos-1.36.1 → typos-1.36.3}/crates/dictgen/src/match.rs +0 -0
- {typos-1.36.1 → typos-1.36.3}/crates/dictgen/src/ordered_map.rs +0 -0
- {typos-1.36.1 → typos-1.36.3}/crates/dictgen/src/trie.rs +0 -0
- {typos-1.36.1 → typos-1.36.3}/crates/typos/Cargo.toml +0 -0
- {typos-1.36.1 → typos-1.36.3}/crates/typos/src/check.rs +0 -0
- {typos-1.36.1 → typos-1.36.3}/crates/typos/src/dict.rs +0 -0
- {typos-1.36.1 → typos-1.36.3}/crates/typos/src/lib.rs +0 -0
- {typos-1.36.1 → typos-1.36.3}/crates/typos/src/tokens.rs +0 -0
- {typos-1.36.1 → typos-1.36.3}/crates/typos-cli/src/bin/typos-cli/args.rs +0 -0
- {typos-1.36.1 → typos-1.36.3}/crates/typos-cli/src/bin/typos-cli/main.rs +0 -0
- {typos-1.36.1 → typos-1.36.3}/crates/typos-cli/src/config.rs +0 -0
- {typos-1.36.1 → typos-1.36.3}/crates/typos-cli/src/default_types.rs +0 -0
- {typos-1.36.1 → typos-1.36.3}/crates/typos-cli/src/dict.rs +0 -0
- {typos-1.36.1 → typos-1.36.3}/crates/typos-cli/src/file.rs +0 -0
- {typos-1.36.1 → typos-1.36.3}/crates/typos-cli/src/file_type.rs +0 -0
- {typos-1.36.1 → typos-1.36.3}/crates/typos-cli/src/file_type_specifics.rs +0 -0
- {typos-1.36.1 → typos-1.36.3}/crates/typos-cli/src/lib.rs +0 -0
- {typos-1.36.1 → typos-1.36.3}/crates/typos-cli/src/policy.rs +0 -0
- {typos-1.36.1 → typos-1.36.3}/crates/typos-cli/src/report.rs +0 -0
- {typos-1.36.1 → typos-1.36.3}/crates/typos-cli/tests/cmd/en-us.in/README.md +0 -0
- {typos-1.36.1 → typos-1.36.3}/crates/typos-cli/tests/cmd/false-positives.in/README.md +0 -0
- {typos-1.36.1 → typos-1.36.3}/crates/typos-cli/tests/cmd/filename-typo.in/README.md +0 -0
- {typos-1.36.1 → typos-1.36.3}/crates/typos-dict/src/lib.rs +0 -0
- {typos-1.36.1 → typos-1.36.3}/crates/typos-vars/Cargo.toml +0 -0
- {typos-1.36.1 → typos-1.36.3}/crates/typos-vars/src/lib.rs +0 -0
- {typos-1.36.1 → typos-1.36.3}/crates/typos-vars/src/vars_codegen.rs +0 -0
- {typos-1.36.1 → typos-1.36.3}/crates/varcon/Cargo.toml +0 -0
- {typos-1.36.1 → typos-1.36.3}/crates/varcon/src/codegen.rs +0 -0
- {typos-1.36.1 → typos-1.36.3}/crates/varcon/src/lib.rs +0 -0
- {typos-1.36.1 → typos-1.36.3}/crates/varcon-core/Cargo.toml +0 -0
- {typos-1.36.1 → typos-1.36.3}/crates/varcon-core/src/borrowed.rs +0 -0
- {typos-1.36.1 → typos-1.36.3}/crates/varcon-core/src/lib.rs +0 -0
- {typos-1.36.1 → typos-1.36.3}/crates/varcon-core/src/parser.rs +0 -0
- {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.
|
|
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.
|
|
1624
|
+
version = "0.13.4"
|
|
1625
1625
|
dependencies = [
|
|
1626
1626
|
"codegenrs",
|
|
1627
1627
|
"csv",
|
|
@@ -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 =
|
|
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(
|
|
170
|
+
append_corrections(span, snippet, group)
|
|
170
171
|
}
|
|
171
172
|
Some(Context::Path(context)) => {
|
|
172
|
-
let
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
let
|
|
178
|
-
|
|
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(
|
|
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
|
-
|
|
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 {
|