Commit Graph

174 Commits

Author SHA1 Message Date
Federico Caselli
1f168130a7
Use a list for the configuration options (#7565) 2024-03-26 13:59:55 -06:00
Eric Traut
6a042f7b58
Added new reportUnhashable diagnostic rule. This addresses #7462. (#7464) 2024-03-12 00:34:58 -06:00
Eric Traut
e67047551e Improved consistency of documentation when talking about diagnostic settings. 2024-02-21 15:39:13 -07:00
Lucian Wischik
3f6e47f719
Clarify that "exclude" overrides include directories *and* files (#7216)
The exclude directive overrides include directories *and* include files.

I verified by experiment, and also by reading the source code https://github.com/ljw1004/pyright/blob/main/packages/pyright-internal/src/common/uri/uriUtils.ts#L54
2024-02-06 12:02:57 -08:00
Blake Naccarato
9fb26eb7a3
Clarify virtual environment language in exclude part (#7133) 2024-01-26 09:22:57 -08:00
Eric Traut
3ebcef2d90 Fixed minor doc bug. 2024-01-21 20:28:15 -08:00
Eric Traut
197ecd7bc4
Added three new diagnostic rules: reportArgumentType covers argument type compatibility checks, reportAssignmentType covers type compatibility checks for assignments, and reportReturnType covers type compatibility checks for return and yield statements. This partially addresses #6973. (#7077) 2024-01-21 02:20:52 -08:00
Eric Traut
6ac1a7eebf
Added new diagnostic rule reportCallIssue that covers issues relating to call expressions and arguments. This partially addresses #6973. (#7076) 2024-01-21 01:47:43 -08:00
Eric Traut
63637459ca
Added two new diagnostic rules: reportAttributeAccessIssue is related to attribute accesses and reportIndexIssue is related to index operations and expressions. This partially addresses #6973. (#7075) 2024-01-21 01:35:19 -08:00
Eric Traut
8270551bbe
Added two new diagnostic rules: reportAbstractUsage reports invalid use of abstract classes and methods and reportOperatorIssue covers diagnostics related to unary and binary operators. This partially addresses #6973. (#7074) 2024-01-21 01:07:49 -08:00
Eric Traut
ec6052ea9d
Added two new diagnostic rules: reportInvalidTypeArguments reports invalid type arg usage and reportRedeclaration reports attempts to redeclare the type of a symbol. This partially addresses #6973. (#7073) 2024-01-21 00:33:05 -08:00
Eric Traut
7a67f4fbdb
Added two new diagnostic rules: reportInconsistentOverload reports inconsistencies between overload signatures and/or implementation and reportNoOverloadImplementation reports an overloaded function with a missing implementation. This partially addresses #6973. (#7072) 2024-01-21 00:04:55 -08:00
Eric Traut
91960fba49
Added new diagnostic rule reportPossiblyUnboundVariable, which is split off from reportUnboundVariable. This addresses #6896. (#7071) 2024-01-20 23:34:11 -08:00
Eric Traut
aa64fc5dec
Added two new diagnostic rules: reportAssertTypeFailure for type mismatches detected by typing.assert_type and reportUnusedExcept for situations where an except statement is determined to be unreachable. (#7070) 2024-01-20 22:21:42 -08:00
Eric Traut
04e0536a52
Added new diagnostic rule reportInvalidTypeForm that controls reporting of invalid type expression forms. This partly addresses #6973. (#7069) 2024-01-20 21:56:10 -08:00
Yashraj Singh
05711a0794
corrected typo in configuration.md (#6950) 2024-01-09 23:30:29 -08:00
Eric Traut
4afd9a4295 Added documentation for overriding the locale via env variables. 2024-01-05 09:44:27 -07:00
Eric Traut
fd5900f7e7 Clarified that reportOptionalOperand applies only to the LHS operand for binary operators. This addresses #6687. 2023-12-08 19:56:43 -08:00
Eric Traut
f605c8fb24
Added a new typeCheckingMode called "standard". It's a subset of "strict" but a superset of "basic". It is the new default mode, and it should cover all of the required checks for conformance with the Python typing standard. This addresses #66607. (#6627) 2023-12-01 23:44:12 -08:00
Eric Traut
73ec51cb37 Updated docs to further de-emphasize "venv" config option. 2023-11-07 07:44:30 -08:00
klezm
851571c10f
Adds default value for reportImplicitOverride to docs/configuration.md (#6056) 2023-10-02 07:43:24 -07:00
Eric Traut
fe1e16ec1e
Added a new configuration switch disableBytesTypePromotions that controls whether bytearray and memoryview should be implicit subtypes of bytes. This switch defaults to false in basic type checking mode and true in strict mode. Eventually, we will probably have it default to true in all modes. (#6024)
Co-authored-by: Eric Traut <erictr@microsoft.com>
2023-09-25 12:00:40 -07:00
Eric Traut
4474b7d36b
Added a new configuration option deprecateTypingAliases that enables deprecation detection and reporting for symbols imported from the typing module that are deprecated according to PEP 585 and 604. The option is currently disabled by default (even in strict mode) but can be enabled manually. This addresses #3598. (#5812)
Co-authored-by: Eric Traut <erictr@microsoft.com>
2023-08-25 11:17:37 -07:00
Eric Traut
d81ffb7b5c Added a new configuration options flag called enableExperimentalFeatures that controls whether certain experimental features are enabled. Currently there are three features under this flag: StrictTypeGuard, ReadOnly fields for typed dicts, and inlined TypedDict definitions. This addresses https://github.com/microsoft/pyright/issues/5598. 2023-07-28 22:22:08 -06:00
Eric Traut
9f81564a46 Changed reportImportCycles so it is not on by default in "strict" type checking mode. It is highly opinionated and should be used only in cases where the developer opts into it. 2023-04-08 10:29:14 -07:00
Eric Traut
5d6eacd5e1
Changed the default of the useLibraryCodeForTypes from false to true to bring pylance and pyright into alignment. Also deprecated the "--lib" command-line option, which was previously used to enable useLibraryCodeForTypes from the command line. (#4903)
Co-authored-by: Eric Traut <erictr@microsoft.com>
2023-04-05 09:47:59 -06:00
Eric Traut
e2e3a5c9ff Added new diagnostic check reportImplicitOverride. This addresses https://github.com/microsoft/pyright/issues/4788. 2023-03-16 09:52:25 -06:00
Eric Traut
08b2cb4698 Did a consistency pass on documentation markdown. 2023-03-06 18:10:33 -07:00
Eric Traut
b3fd962116 Fixed bugs in documentation. 2023-03-06 15:45:51 -07:00
Eric Traut
4eb4397a90 Updated documentation for default exclude settings. 2023-02-08 13:09:55 -08:00
Eric Traut
b17f64ddcb A few more tweaks to the documentation for consistency. 2023-01-27 09:29:38 -08:00
Eric Traut
3829e8e32d Tweaked documentation for readability. 2023-01-27 09:26:30 -08:00
Eric Traut
53e8cd4145 Added provisional support for draft PEP 702 (marking deprecations using the type system). 2023-01-13 21:16:07 -08:00
Rich Chiodo
4897e993d5
Fix 'reportShadowedImports' link
Fixes https://github.com/microsoft/pylance-release/issues/3752
2022-12-12 09:51:37 -08:00
Eric Traut
5f48e39671 Exposed new configuration setting analyzeUnannotatedFunctions which corresponds to the --skipunannotated command-line option. Added an information diagnostic for skipped functions. This addresses https://github.com/microsoft/pyright/issues/4303. 2022-12-08 20:05:32 -08:00
Rich Chiodo
04a1058378
20221121 (#4174) 2022-11-09 16:00:25 -08:00
Rich Chiodo
8c0ba8a78a
Show a warning when a stdlib module is being overridden (#4132)
* Working for simple cases

* Fix localize

* Move logic to source mapper

* Add support for the current file

* Add rename file command

* Fix comments

* Closer to getting tests to work. Rename added

* Rework how stdlib modules are found. Fix tests

* Do the rename without bringing up a dialog

* Fix tests and add docs

* Fix tests on unix

* Review feedback

* Default shadowed imports to off

* Missed spot for execEnv not needing to be passed
2022-11-04 16:45:16 -07:00
Eric Traut
d5d27505ef Updated types in documentation to use PEP 604 syntax. 2022-10-24 20:06:21 -07:00
Eric Traut
8538998719 Extended the defineConstant mechanism to work with conditional statements that contain member access expressions that reference a defined member name. This addresses https://github.com/microsoft/pyright/issues/4060. 2022-10-18 15:28:17 -07:00
Eric Traut
285550c5ce Updated configuration documentation to include reportUnnecessaryContains in the table. 2022-07-17 23:42:44 -07:00
Eric Traut
7f3e7b0d2e Added support for new reportUnnecessaryContains diagnostic rule to catch potential bugs in in and not in containment checks. 2022-07-17 23:29:50 -07:00
Eric Traut
4ae8b9233e Made suggested improvements to documentation. 2022-06-18 23:00:11 -07:00
Eric Traut
484faf7ba3 Added support for new reportTypeCommentUsage diagnostic check. It flag the usage of # type: xxx comments for functions and variables. These are still supported for backward compatibility, but they are increasingly irrelevant and will likely be deprecated in the next few years. 2022-06-09 21:00:47 -07:00
Eric Traut
794d151050 Added new configuration setting called "defineConstant". It allows a configuration to specify one or more identifiers that should be assigned by pyright's binder to be constant anywhere they appear. Values can be boolean (true or false) or a string. If an identifier of this value is used within a conditional statement (like if not DEBUG:) it will affect pyright's reachability analysis for the guarded code blocks. 2022-06-08 22:01:33 -07:00
Eric Traut
ab1fbfc0d6 Enhanced reportUnnecessaryComparison diagnostic check so it also detects cases where a function appears within a condition expression. This is a common source of programming error. 2022-04-10 23:33:41 -07:00
Eric Traut
189f0314bb Another attempt at formatting 2022-03-20 14:35:38 -06:00
Eric Traut
fadeea36b4 Updated diagnostic rule table so it groups basic and strict diagnostics. 2022-03-20 14:34:42 -06:00
Eric Traut
d28c481535 Added new diagnostic check reportUnusedExpression to catch bugs like a == 4 when a = 4 was intended. 2022-03-13 15:25:18 -06:00
Eric Traut
4cbd352d39 Added support for per-line suppression of diagnostics using # pyright: ignore comment. This also supports rule-specific suppression using a list of diagnostic rules, as in # pyright: ignore [reportGeneralTypeIssues]. 2022-03-11 09:47:41 -07:00
Eric Traut
dc24fab779 Changed strictParameterNoneValue to default to true rather than false. This reflects the updated guidance in PEP 484, which indicates that type checkers should not assume that a default argument of None should imply an Optional type. 2022-02-21 17:54:31 -07:00