diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index efe2a43258..d5ace5d0da 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -181,3 +181,15 @@ jobs: ${{ runner.os }}-build- ${{ runner.os }}- - run: maturin build -b bin + + typos: + name: Spell Check with Typos + runs-on: ubuntu-latest + steps: + - name: Checkout Actions Repository + uses: actions/checkout@v2 + + - name: Check spelling of file.txt + uses: crate-ci/typos@master + with: + files: . diff --git a/resources/test/fixtures/isort/combine_import_froms.py b/resources/test/fixtures/isort/combine_import_from.py similarity index 100% rename from resources/test/fixtures/isort/combine_import_froms.py rename to resources/test/fixtures/isort/combine_import_from.py diff --git a/resources/test/fixtures/pydocstyle/sections.py b/resources/test/fixtures/pydocstyle/sections.py index b493260685..419dacd958 100644 --- a/resources/test/fixtures/pydocstyle/sections.py +++ b/resources/test/fixtures/pydocstyle/sections.py @@ -376,7 +376,7 @@ class TestGoogle: # noqa: D203 Etiam at tellus a tellus faucibus maximus. Curabitur tellus mauris, semper id vehicula ac, feugiat ut tortor. verbose (bool): - If True, print out as much infromation as possible. + If True, print out as much information as possible. If False, print out concise "one-liner" information. """ diff --git a/resources/test/fixtures/pylint/consider_merging_isinstance.py b/resources/test/fixtures/pylint/consider_merging_isinstance.py index 52b196999b..7555d997f2 100644 --- a/resources/test/fixtures/pylint/consider_merging_isinstance.py +++ b/resources/test/fixtures/pylint/consider_merging_isinstance.py @@ -18,8 +18,8 @@ def isinstances(): result = isinstance(var[5], int) or True or isinstance(var[5], float) # [consider-merging-isinstance] - infered_isinstance = isinstance - result = infered_isinstance(var[6], int) or infered_isinstance(var[6], float) or infered_isinstance(var[6], list) and False # [consider-merging-isinstance] + inferred_isinstance = isinstance + result = inferred_isinstance(var[6], int) or inferred_isinstance(var[6], float) or inferred_isinstance(var[6], list) and False # [consider-merging-isinstance] result = isinstance(var[10], str) or isinstance(var[10], int) and var[8] * 14 or isinstance(var[10], float) and var[5] * 14.4 or isinstance(var[10], list) # [consider-merging-isinstance] result = isinstance(var[11], int) or isinstance(var[11], int) or isinstance(var[11], float) # [consider-merging-isinstance] diff --git a/resources/test/fixtures/pyupgrade/UP012.py b/resources/test/fixtures/pyupgrade/UP012.py index d930bedc42..50edb51930 100644 --- a/resources/test/fixtures/pyupgrade/UP012.py +++ b/resources/test/fixtures/pyupgrade/UP012.py @@ -45,8 +45,8 @@ f"foo{bar}".encode(encoding) "unicode text©".encode() "unicode text©".encode(encoding="UTF8") # "unicode text©".encode() -r"fo\o".encode("utf-8") # br"fo\o" +r"foo\o".encode("utf-8") # br"foo\o" u"foo".encode("utf-8") # b"foo" -R"fo\o".encode("utf-8") # br"fo\o" +R"foo\o".encode("utf-8") # br"foo\o" U"foo".encode("utf-8") # b"foo" print("foo".encode()) # print(b"foo") diff --git a/src/checkers/ast.rs b/src/checkers/ast.rs index 58611670de..93cfb016b1 100644 --- a/src/checkers/ast.rs +++ b/src/checkers/ast.rs @@ -3079,7 +3079,7 @@ impl<'a> Checker<'a> { } } - // If we're about to lose the binding, store it as overriden. + // If we're about to lose the binding, store it as overridden. if let Some((scope_index, binding_index)) = overridden { self.scopes[scope_index] .overridden diff --git a/src/isort/mod.rs b/src/isort/mod.rs index ea854a6cad..3cad6e5d5a 100644 --- a/src/isort/mod.rs +++ b/src/isort/mod.rs @@ -11,7 +11,7 @@ use rustpython_ast::{Stmt, StmtKind}; use crate::isort::categorize::{categorize, ImportType}; use crate::isort::comments::Comment; use crate::isort::helpers::trailing_comma; -use crate::isort::sorting::{cmp_import_froms, cmp_members, cmp_modules}; +use crate::isort::sorting::{cmp_import_from, cmp_members, cmp_modules}; use crate::isort::track::{Block, Trailer}; use crate::isort::types::{ AliasData, CommentSet, ImportBlock, ImportFromData, Importable, OrderedImportBlock, @@ -483,7 +483,7 @@ fn sort_imports(block: ImportBlock) -> OrderedImportBlock { }) .sorted_by( |(import_from1, _, _, aliases1), (import_from2, _, _, aliases2)| { - cmp_import_froms(import_from1, import_from2).then_with(|| { + cmp_import_from(import_from1, import_from2).then_with(|| { match (aliases1.first(), aliases2.first()) { (None, None) => Ordering::Equal, (None, Some(_)) => Ordering::Less, @@ -650,7 +650,7 @@ mod tests { #[test_case(Path::new("add_newline_before_comments.py"))] #[test_case(Path::new("combine_as_imports.py"))] - #[test_case(Path::new("combine_import_froms.py"))] + #[test_case(Path::new("combine_import_from.py"))] #[test_case(Path::new("comments.py"))] #[test_case(Path::new("deduplicate_imports.py"))] #[test_case(Path::new("fit_line_length.py"))] diff --git a/src/isort/snapshots/ruff__isort__tests__combine_import_froms.py.snap b/src/isort/snapshots/ruff__isort__tests__combine_import_from.py.snap similarity index 100% rename from src/isort/snapshots/ruff__isort__tests__combine_import_froms.py.snap rename to src/isort/snapshots/ruff__isort__tests__combine_import_from.py.snap diff --git a/src/isort/sorting.rs b/src/isort/sorting.rs index 22cd98006f..6d8b3d4192 100644 --- a/src/isort/sorting.rs +++ b/src/isort/sorting.rs @@ -54,7 +54,7 @@ pub fn cmp_levels(level1: Option<&usize>, level2: Option<&usize>) -> Ordering { } /// Compare two `StmtKind::ImportFrom` blocks. -pub fn cmp_import_froms(import_from1: &ImportFromData, import_from2: &ImportFromData) -> Ordering { +pub fn cmp_import_from(import_from1: &ImportFromData, import_from2: &ImportFromData) -> Ordering { cmp_levels(import_from1.level, import_from2.level).then_with(|| { match (&import_from1.module, import_from2.module) { (None, None) => Ordering::Equal, diff --git a/src/pyupgrade/fixes.rs b/src/pyupgrade/fixes.rs index 4d4901a188..90f429d725 100644 --- a/src/pyupgrade/fixes.rs +++ b/src/pyupgrade/fixes.rs @@ -141,7 +141,7 @@ pub fn remove_unnecessary_future_import( parent: Option<&Stmt>, deleted: &[&Stmt], ) -> Result { - // TODO(charlie): DRY up with pyflakes::fixes::remove_unused_import_froms. + // TODO(charlie): DRY up with pyflakes::fixes::remove_unused_import_from. let module_text = locator.slice_source_code_range(&Range::from_located(stmt)); let mut tree = match_module(&module_text)?; diff --git a/src/pyupgrade/plugins/os_error_alias.rs b/src/pyupgrade/plugins/os_error_alias.rs index 955cbe73c7..2922daa285 100644 --- a/src/pyupgrade/plugins/os_error_alias.rs +++ b/src/pyupgrade/plugins/os_error_alias.rs @@ -77,7 +77,7 @@ fn handle_name_or_attribute( } } -/// Handles one block of an except (use a loop if there are multile blocks) +/// Handles one block of an except (use a loop if there are multiple blocks) fn handle_except_block(checker: &mut Checker, handler: &Located) { let ExcepthandlerKind::ExceptHandler { type_, .. } = &handler.node; let Some(error_handlers) = type_.as_ref() else { diff --git a/src/pyupgrade/snapshots/ruff__pyupgrade__tests__UP012_UP012.py.snap b/src/pyupgrade/snapshots/ruff__pyupgrade__tests__UP012_UP012.py.snap index 6cbe0faa5f..2f43e2f818 100644 --- a/src/pyupgrade/snapshots/ruff__pyupgrade__tests__UP012_UP012.py.snap +++ b/src/pyupgrade/snapshots/ruff__pyupgrade__tests__UP012_UP012.py.snap @@ -168,15 +168,15 @@ expression: checks column: 0 end_location: row: 48 - column: 23 + column: 24 fix: - content: "br\"fo\\o\"" + content: "br\"foo\\o\"" location: row: 48 column: 0 end_location: row: 48 - column: 23 + column: 24 parent: ~ - kind: UnnecessaryEncodeUTF8 location: @@ -200,15 +200,15 @@ expression: checks column: 0 end_location: row: 50 - column: 23 + column: 24 fix: - content: "bR\"fo\\o\"" + content: "bR\"foo\\o\"" location: row: 50 column: 0 end_location: row: 50 - column: 23 + column: 24 parent: ~ - kind: UnnecessaryEncodeUTF8 location: