Add Github Actions workflow to check for typos (#7892)

- Add Github Actions workflow to check typos
- Fix existing typos
This commit is contained in:
Hofer-Julian 2023-01-28 22:22:56 +01:00 committed by GitHub
parent 1f810cd26a
commit 8787ec9fe8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 31 additions and 6 deletions

13
.github/workflows/typos.yml vendored Normal file
View File

@ -0,0 +1,13 @@
name: Typos
on: [pull_request]
jobs:
run:
name: Spell Check with Typos
runs-on: ubuntu-latest
steps:
- name: Checkout Actions Repository
uses: actions/checkout@v2
- name: Check spelling of book
uses: crate-ci/typos@master

12
.typos.toml Normal file
View File

@ -0,0 +1,12 @@
[files]
extend-exclude = ["crates/nu-command/tests/commands/table.rs", "*.tsv", "*.json", "*.txt"]
[default.extend-words]
# Ignore false-positives
nd = "nd"
fo = "fo"
ons = "ons"
ba = "ba"
Plasticos = "Plasticos"
IIF = "IIF"
numer = "numer"

View File

@ -70,8 +70,8 @@ fn parse_range(range: Value, head: Span) -> Result<(isize, isize, Span), ShellEr
}
}
Value::String { val, span } => {
let splitted_result = val.split_once(',');
match splitted_result {
let split_result = val.split_once(',');
match split_result {
Some((start, end)) => (start.to_string(), end.to_string(), span),
None => {
return Err(ShellError::UnsupportedInput(

View File

@ -21,7 +21,7 @@ impl Command for SplitBy {
}
fn usage(&self) -> &str {
"Create a new table splitted."
"Create a new table split."
}
fn run(

View File

@ -190,7 +190,7 @@ impl UrlComponents {
if let Some(q) = self.query {
if q != qs {
// if query is present it means that also query_span is setted.
// if query is present it means that also query_span is set.
return Err(ShellError::IncompatibleParameters {
left_message: format!("Mismatch, qs from params is: {}", qs),
left_span: value.expect_span(),
@ -248,7 +248,7 @@ impl UrlComponents {
"query" => {
if let Some(q) = self.query {
if q != s {
// if query is present it means that also params_span is setted.
// if query is present it means that also params_span is set.
return Err(ShellError::IncompatibleParameters {
left_message: format!("Mismatch, query param is: {}", s),
left_span: value.expect_span(),

View File

@ -23,7 +23,7 @@ use nu_protocol::{ast::Call, ShellError};
pub fn grapheme_flags(call: &Call) -> Result<bool, ShellError> {
let g_flag = call.has_flag("grapheme-clusters");
// Check for the other flags and produce errors if they exist.
// Note that Nushell already prevents nonexistant flags from being used with commands,
// Note that Nushell already prevents nonexistent flags from being used with commands,
// so this function can be reused for both the --utf-8-bytes commands and the --code-points commands.
if g_flag && call.has_flag("utf-8-bytes") {
Err(ShellError::IncompatibleParametersSingle(