Commit Graph

159 Commits

Author SHA1 Message Date
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
Eric Traut
10a122ccd6 Fixed error in documentation for reportInvalidTypeVarUse. 2022-01-29 07:54:18 -08:00
Eric Traut
6776c0ce86 Fixed bug in documentation for reportMissingImports. 2022-01-29 00:05:40 -08:00
Eric Traut
b740ddfae5 Added new diagnostic check "reportMatchNotExhaustive" which reports cases where a match statement doesn't exhaustively cover all cases. 2022-01-23 12:49:27 -08:00
Eric Traut
163ef21c3c Changed "reportMissingSuperCall" to be off by default in strict mode. 2022-01-14 14:13:49 -08:00
Eric Traut
62ac83694e Implemented a new diagnostic check "reportMissingSuperCall" that checks for __init__, __init_subclass__, __enter__ and __exit__ methods that fail to call through to their parent class(es) methods of the same name. This is a common source of bugs. The check is disabled by default in basic mode but enabled by default in strict mode. 2022-01-14 11:55:23 -08:00
Eric Traut
4934e906d5 Added new diagnostic check reportInconsistentConstructor that checks for inconsistent input signatures between __new__ and __init__ methods. 2022-01-12 11:31:33 -08:00
Eric Traut
f9f4c34b5e Added new diagnostic check reportUnnecessaryTypeIgnoreComment that emits a diagnostic when a # type: ignore comment has no effect. 2022-01-09 11:16:22 -07:00
Eric Traut
ed84eb7b36 Changed reportPropertyTypeMismatch to be disabled by default in all diagnostic modes. 2021-11-27 17:08:01 -08:00
Eric Traut
280d95cd80 Updated documentation for reportUnusedVariable. 2021-11-24 16:05:53 -08:00
Elijah K
c70cee87ea
Update configuration.md (#2519)
Links the description of the `executionEnvironment` option. Would have partially prevented a question in #2518.
2021-10-30 11:09:25 -07:00
Eric Traut
5f0317229c Updated documentation for pythonPlatform to include "All". 2021-10-15 09:43:28 -07:00
Eric Traut
9976ff0436 Fixed a misleading statement in the documentation about the strict config setting. 2021-10-14 14:56:49 -07:00
Eric Traut
ff55b895f9 Added new diagnostic check "reportMissingParameterType" that checks for function and method input parameters that are missing a type annotation. 2021-10-06 21:55:12 -07:00
Eric Traut
14ad02575f Extended reportCallInDefaultInitializer diagnostic check to disallow list, set or dict expressions in default argument expression. 2021-09-16 21:22:31 -07:00
Eric Traut
9035f64c71 Added reportPrivateImportUsage diagnostic rule, which reports usage of a symbol from a py.typed library that is not intended to be re-exported by the library's author. The rule is on by default in basic type checking mode but can be disabled. Completion provider no longer offers these symbols as completion suggestions. 2021-09-12 01:10:57 -07:00