Commit Graph

264 Commits

Author SHA1 Message Date
Anders Kaseorg f2fd7335ce
Use a platform-appropriate location for user configuration (#215) 2022-09-17 13:29:17 -06:00
Anders Kaseorg b8f878df5e
Find user configuration even if there’s no project directory (#216) 2022-09-16 21:47:15 -06:00
Anders Kaseorg 9bdb922c75
Detect multi-target assignment as unpacking if *any* target is unpacking (#217) 2022-09-16 21:45:44 -06:00
Anders Kaseorg edecc1bba6
Fix find_project_root with relative paths (#214) 2022-09-16 18:04:35 -06:00
Charlie Marsh 24de97d951 Create cache directory prior to writing .gitignore 2022-09-16 04:56:58 -04:00
Charlie Marsh 9d4a4478f7
Improve exclusion syntax to match exact files (#209) 2022-09-15 21:40:49 -04:00
Charlie Marsh 6bbf3f46c4
Add .gitignore to .ruff_cache (#208) 2022-09-15 20:40:06 -04:00
Charlie Marsh 4ac4e8c991
Exclude .ruff_cache by default (#207) 2022-09-15 20:39:39 -04:00
Dmitry Dygalo 0091a3ae5f
chore: Do not read the same file twice (#206) 2022-09-15 16:05:29 -04:00
Charlie Marsh 71520213c1
Allow __path__ in __init__.py (#201) 2022-09-15 09:44:03 -04:00
Charlie Marsh f24e7a0052 Add trailing period to help message 2022-09-15 09:43:51 -04:00
Patrick Haller 507e9f7ec3
Fix: Structured output Issue Fix (#186) 2022-09-15 09:43:10 -04:00
Charlie Marsh 592c53c8bf
Use binding location when reporting F821 errors (#200) 2022-09-14 22:51:07 -04:00
Charlie Marsh b8f12d2e79
Raise error when failing to parse (#199) 2022-09-14 22:37:55 -04:00
Charlie Marsh 67b1d0463a
Pull in pycodestyle tests for E checks (#195) 2022-09-14 22:22:53 -04:00
Charlie Marsh d008a181ec
Improve default exclusions and support extend-exclude (#188) 2022-09-14 22:21:17 -04:00
Charlie Marsh 6d612a428a
Migrate linter tests to insta (#194) 2022-09-14 21:52:44 -04:00
Charlie Marsh c0cb73ab16
Implement E721 (#193) 2022-09-14 21:10:29 -04:00
Charlie Marsh 2e1eb84cbf
Implement F632 (#190) 2022-09-14 18:22:35 -04:00
Charlie Marsh b03a8728b5
Add support for from __future__ import annotations (#189) 2022-09-14 18:22:19 -04:00
Charlie Marsh 1dd3350a30
Revert "Adding flag and logic for different output format" (#187) 2022-09-14 14:20:02 -04:00
Patrick Haller bda34945a5
Adding flag and logic for different output format (#185) 2022-09-14 10:43:32 -04:00
Dmitry Dygalo 85dcaa8d3c
chore: Avoid `collect` in `inner_main` (#184) 2022-09-14 08:16:04 -04:00
Dmitry Dygalo b7e2a4b9a9
feat: Implement `InvalidPrintSyntax` (`F633`) (#182) 2022-09-13 21:10:20 -04:00
Dmitry Dygalo 53a7758248
Avoid some allocations (#179) 2022-09-13 10:07:22 -04:00
Dmitry Dygalo 2ba767957d
refactor: Use `while let Some` instead of calling `is_empty` (#180) 2022-09-13 10:06:49 -04:00
Dmitry Dygalo 08152787e1
chore: Use `once_cell` instead of `lazy_static` (#178) 2022-09-13 10:06:21 -04:00
Charlie Marsh 90f9e60517
Implement F722 (#175) 2022-09-12 21:34:27 -04:00
Charlie Marsh dfba1416b2
Implement F406 (#172) 2022-09-12 16:47:30 -04:00
Charlie Marsh 2ca3f35bd1 Remove one match from checks.rs 2022-09-12 16:32:27 -04:00
Charlie Marsh 40c1e7e005
Implement F701 and F702 (#169) 2022-09-12 11:16:08 -04:00
Harutaka Kawamura 9414090617
Implement E722 (#166) 2022-09-12 09:04:39 -04:00
Harutaka Kawamura 825777edc1
Add test case for assignment expression in `E741.py` (#168) 2022-09-12 09:03:36 -04:00
Charlie Marsh 4e0807e908
Include line length in E501 messages (#165) 2022-09-11 22:54:11 -04:00
Charlie Marsh 43e1f20b28
Allow unused assignments in for loops and unpacking (#163) 2022-09-11 21:53:45 -04:00
Harutaka Kawamura 97388cefda
Implement E743 (#162) 2022-09-11 21:27:33 -04:00
Harutaka Kawamura 63ce579989
Implement E742 (#160) 2022-09-11 20:27:48 -04:00
Charlie Marsh 02ab52b3e2
Implement F407 (#158) 2022-09-11 18:05:28 -04:00
Charlie Marsh 549732b1da
Implement F404 (#159) 2022-09-11 18:05:00 -04:00
Harutaka Kawamura c4565fe0f5
Implement E741 (#137) 2022-09-11 12:30:28 -04:00
Charlie Marsh 62e6feadc7
Handle accesses within inner functions (#156) 2022-09-11 10:44:27 -04:00
Charlie Marsh 18a26e8f0b
Allow setting --exclude on the command-line (#157) 2022-09-11 10:44:23 -04:00
Charlie Marsh 2371de3895
Make late imports more permissive (#155) 2022-09-11 10:44:06 -04:00
Charlie Marsh e3c8f61340
Ignore deletes in conditional branches (#154) 2022-09-11 10:28:07 -04:00
Harutaka Kawamura f6628ae100
Fix `Message.cmp` (#152) 2022-09-11 10:18:27 -04:00
Charlie Marsh dfd8a4158d
Parse function annotations within the ClassDef scope (#144) 2022-09-10 15:20:39 -04:00
Charlie Marsh c247730bf5 Avoid treating keys as annotations in TypedDict 2022-09-10 15:19:11 -04:00
Charlie Marsh 024472d578
Implement F621 and F622 (#143) 2022-09-10 15:04:33 -04:00
Charlie Marsh 7d69a153e8
Support remaining typing module members (#141) 2022-09-10 14:51:43 -04:00
Charlie Marsh 6a24351202 Add support for TypedDict 2022-09-10 13:03:29 -04:00
Charlie Marsh 11234ea555 Add await to YieldOutsideFunction 2022-09-08 22:54:11 -04:00
Charlie Marsh b536159541
Pull check logic out of check_ast.rs (#135) 2022-09-08 22:46:42 -04:00
Charlie Marsh f1acd28f08 Skip slice error for invalid TypeVar calls 2022-09-08 11:40:55 -04:00
Charlie Marsh c61ff9a947
Adjust location when parsing deferred type annotations (#133) 2022-09-08 11:37:19 -04:00
Charlie Marsh 2c64cf3149
Add support for Literal, Type, and TypeVar (#131) 2022-09-08 11:07:45 -04:00
Charlie Marsh fc5f34c76f
Use scope-tracking logic for parents (#130) 2022-09-08 09:14:58 -04:00
Charlie Marsh a8f4faa6e4 Fix crash on missing parent 2022-09-07 22:40:25 -04:00
Charlie Marsh 2ac5c830c1
Parse assignment annotations prior to targets (#127) 2022-09-07 22:35:39 -04:00
Charlie Marsh 994f12050d
Support 'ignore' in pyproject.toml (#126) 2022-09-07 22:34:51 -04:00
Charlie Marsh fad4e4c51d
Defer checking of function bodies (#125) 2022-09-07 22:34:43 -04:00
Charlie Marsh c0042a3ca4 Use Mode::None for --no-cache 2022-09-07 21:47:07 -04:00
Charlie Marsh 5deb63a05f
Implement F601 and F602 (#122) 2022-09-07 12:57:50 -04:00
Colin J. Fuller 74ecdc73ac
Handle E731 in type-annotated assignment (#116) 2022-09-06 20:18:46 -04:00
Charlie Marsh 2749660b1f
Disable update-informer on linux-cross (#113) 2022-09-06 14:19:38 -04:00
Charlie Marsh 27025055ee
Implement E713 and E714 (#111) 2022-09-06 10:23:20 -04:00
Charlie Marsh e306fe0765
Implement E711 and E712 (#110) 2022-09-06 10:14:36 -04:00
Harutaka Kawamura 5ffb9c08d5
Implement E731 (#109) 2022-09-06 09:48:51 -04:00
Charlie Marsh 1a8940f015
Implement E902 (IOError) (#107) 2022-09-05 13:15:12 -04:00
Charlie Marsh 198e5cf27f
Implement R002 (NoAssertEquals) (#98) 2022-09-05 12:27:47 -04:00
Charlie Marsh f902d25dc7
Implement ESLint-style fix for R0205 (#97) 2022-09-05 12:16:06 -04:00
Charlie Marsh a3fb0d6c20
Remove custom serialization for Location (#104) 2022-09-04 17:54:45 -04:00
Charlie Marsh 3cf9e3b201
Implement E402 (ModuleImportNotAtTopOfFile) (#102) 2022-09-04 16:20:36 -04:00
Charlie Marsh cf45d520e6 Fix failing test 2022-09-04 12:02:21 -04:00
Harutaka Kawamura b86414dc7a
Implement F707 (DefaultExceptNotLast) (#101) 2022-09-04 11:55:06 -04:00
Charlie Marsh 8f6ab8b37a Fix formatting of some rule messages 2022-09-04 09:52:31 -04:00
Harutaka Kawamura 312bfd8d2b
Implement F631 (AssertTuple) (#99) 2022-09-04 08:39:49 -04:00
Harutaka Kawamura e2f46537fd
Fix false positive for `IfTuple` (#96) 2022-09-03 22:56:55 -04:00
Charlie Marsh 97cc30768d Fix typo in enforce_line_too_long 2022-09-03 16:32:15 -04:00
Grachev Mikhail d580f2eb90
Check for updates (#90) 2022-09-03 16:31:44 -04:00
Dmitry Dygalo 507fecfd9a
perf: Avoid `Vec<&str>` allocation during line length checking (#95) 2022-09-03 16:27:18 -04:00
Charlie Marsh 6bb6cb1783
Implement F822 (#94) 2022-09-03 12:08:26 -04:00
Charlie Marsh e9412c9452
Generate a list of supported lint rules (#93) 2022-09-03 11:56:11 -04:00
Charlie Marsh 94faa7f301
Rename resources/test/src to resources/test/fixtures (#92) 2022-09-03 11:49:03 -04:00
Charlie Marsh 5041f6530c
Implement R0205 (#91) 2022-09-03 11:33:54 -04:00
Narawit Rakket 3c7716ef27
refactor: run `cargo clippy --fix` (#88) 2022-09-02 17:01:24 -04:00
Charlie Marsh 17c08523dc Remove rogue println 2022-09-02 10:18:12 -04:00
Charlie Marsh 221f4304ad
Add support for __all__ export bindings (#87) 2022-09-02 10:17:31 -04:00
Charlie Marsh c0131e65e5
Avoid putting decorators in the function scope (#86) 2022-09-02 09:13:06 -04:00
Charlie Marsh bf4722a62f
Fix future-to-__future__ typo (#85) 2022-09-02 08:56:26 -04:00
Dmitry Dygalo 5a3092e805
perf: Compile `Regex` once (#77) 2022-09-01 12:49:29 -04:00
Charlie Marsh 0318406535 Re-sort lint rules 2022-09-01 12:39:25 -04:00
Sekky61 0c99b5aac5
Fix F832 --> F823 typo (#73) 2022-09-01 12:37:34 -04:00
Charlie Marsh d55651d470 Rename cache to .ruff_cache 2022-09-01 09:19:32 -04:00
Charlie Marsh 0c110bcecf Add some user-visible logging when pyproject.toml fails to parse 2022-09-01 09:18:47 -04:00
Patrick Haller 9bf8a0d0f1
Check if toml file is parsed correctly (#71) 2022-09-01 09:15:07 -04:00
Eric Hagman 888cfeba35
Remove .to_string() from F634 error message (#67) 2022-09-01 09:08:48 -04:00
Charlie Marsh 2bac3027a5
Implement F704 (#66) 2022-08-31 19:11:59 -04:00
Charlie Marsh c28ac75591
Implement F841 (for functions) (#65) 2022-08-31 19:11:26 -04:00
Charlie Marsh 59f009b52d
Enable globs in excludes list (#64) 2022-08-31 18:53:13 -04:00
Charlie Marsh b5edcee9f2
Implement F841 (for exception handlers) (#63) 2022-08-31 18:40:34 -04:00
Charlie Marsh 3f739214b4
Bind excepthandler names (#62) 2022-08-31 18:16:37 -04:00
Charlie Marsh 0b9e3f8b47 Minor formatting changes 2022-08-31 12:38:23 -04:00
Charlie Marsh adad214619
Handle submodule imports for F401 (#58) 2022-08-31 11:24:25 -04:00
Charlie Marsh 0ebed13e67
Sort messages prior to display (#56) 2022-08-31 10:53:35 -04:00
Charlie Marsh 3afedcd48b
Upgrade parser to handle more F821 cases (#57) 2022-08-31 10:52:54 -04:00
Charlie Marsh 80f3cd0ef7 Don't assume errors appear in-order with line contents 2022-08-31 08:40:38 -04:00
Dmitry Dygalo 9e3c35e6dc
Improve search for duplicates (#53) 2022-08-31 08:23:43 -04:00
Charlie Marsh 643797d922
Support builtins (#50) 2022-08-30 14:41:17 -04:00
Charlie Marsh e9a3484edf
Implement F821 (#49) 2022-08-30 14:37:06 -04:00
Charlie Marsh 7ed5b3d3a2
Avoid re-reading + iterating over lines for ignores (#48) 2022-08-30 13:19:22 -04:00
Charlie Marsh 0cbcb982eb
Implement F823 (#44) 2022-08-29 23:04:44 -04:00
Charlie Marsh 832c3ebbd2 Change clap description 2022-08-29 22:00:03 -04:00
Charlie Marsh 16b6859e94 Remove trailing newline 2022-08-29 21:59:32 -04:00
Charlie Marsh 37401bdfb0
Build wheels for Linux (#42) 2022-08-29 17:13:08 -04:00
Charlie Marsh 847cbd0880 Fix forward annotations (#41) 2022-08-29 12:44:32 -04:00
Charlie Marsh 2e83f7b124 Restructure binary 2022-08-29 11:54:40 -04:00
Charlie Marsh 69d193d066 Add benchmark graph 2022-08-29 10:16:09 -04:00
Charlie Marsh 2cd15c3349 Fix select and ignore 2022-08-28 14:35:29 -04:00
Charlie Marsh 91e24ebd73 More README 2022-08-28 14:32:35 -04:00
Charlie Marsh ea9fde14f6 Fix pyproject.toml key 2022-08-28 14:22:19 -04:00
Charlie Marsh 816bb88e3b
Use complete symbol for `import from` (#35) 2022-08-28 10:02:07 -04:00
Charlie Marsh 9686676710 Add --select and --ignore 2022-08-27 20:56:55 -04:00
Charlie Marsh c52fdfa748
Rename to ruff (#29) 2022-08-27 18:30:30 -04:00
Charlie Marsh 618915f09e
Implement experimental binding support (#28) 2022-08-27 18:16:19 -04:00
Charlie Marsh 6129d5bbba Add help messages 2022-08-27 18:16:09 -04:00
Charlie Marsh 8b1c4fce6b Add exit-zero 2022-08-27 18:11:49 -04:00
Charlie Marsh 1fb3db92f1 Add --quiet flag 2022-08-27 18:04:02 -04:00
Charles Marsh ab0144ca5b Upgrade rustpython-parser 2022-08-23 12:40:23 -04:00
Charlie Marsh 95ee62448b
Add support for match case (#24) 2022-08-21 14:51:48 -04:00
Charlie Marsh f3fd95572e
Upgrade RustPython (#23) 2022-08-21 14:45:16 -04:00
Charlie Marsh d7ee58c17a
Add scope tracking (and F706) (#22) 2022-08-20 22:17:21 -04:00
Charlie Marsh 6f8144e6c2
Implement F901 (#21) 2022-08-20 21:25:04 -04:00
Charlie Marsh b63d66fc3e
Add settings hash to cache (#20) 2022-08-20 13:37:21 -04:00
Charlie Marsh 4c62e1e22e
Add ability to selectively enable errors (#19) 2022-08-20 13:12:17 -04:00
Charlie Marsh b11a7eefa3
Enable excludes (#18) 2022-08-20 13:00:58 -04:00
Charlie Marsh 7359e862c1
Add pyproject.toml support (#17) 2022-08-20 13:00:34 -04:00
Charlie Marsh b7d7c50b2b
Add benchmarking (#16) 2022-08-19 15:38:43 -04:00
Charles Marsh 623152768e Ignore some 'long line' errors 2022-08-18 20:59:44 -04:00
Charlie Marsh ddd554f9de
Implement F541 (#12) 2022-08-16 10:47:13 -04:00
Charlie Marsh 3b1b53dacf
Add support for noqa pragmas (#11) 2022-08-15 22:00:50 -04:00
Charles Marsh f01707b2ae Use absolute paths for cache 2022-08-15 13:16:03 -04:00
Charles Marsh 1768c4b7d3 Use raw watcher 2022-08-13 18:29:10 -04:00
Charlie Marsh 611037bbd4
Add a check for long lines (#10) 2022-08-13 18:02:30 -04:00
Charlie Marsh 4a67c8d44b
Add unit tests for linter (#9) 2022-08-13 17:32:40 -04:00
Charles Marsh 52afc02023 Add a constructor 2022-08-13 17:03:52 -04:00
Charlie Marsh 290b0091c5
Add duplicate arguments check (#8) 2022-08-13 14:20:19 -04:00
Charles Marsh d5d9dec5ff Reorder imports 2022-08-13 14:19:28 -04:00
Charles Marsh 8b2a5f94ae Rename to iter_python_files 2022-08-13 13:53:31 -04:00
Charles Marsh 53905f6af3 Remove unused structs 2022-08-13 12:07:09 -04:00
Charles Marsh 70f1677c8e Include version in cache key 2022-08-13 11:57:27 -04:00