Erik Ernst
e6f81dfbc3
Add new lints {omit_,specify_non}obvious_property_types
...
See https://github.com/dart-lang/linter/issues/5101 for some background information.
Change-Id: I51b6988f08585b7b4863ae8858d44de831615177
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387960
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Erik Ernst <eernst@google.com >
2024-10-21 08:08:37 +00:00
Parker Lougheed
e032779a86
[linter] Deprecate package_api_docs lint
...
The lint hasn't been functional for a long time. Rather than try to fix it and start introducing a lot of warnings on packages that include it, let's deprecate it and prepare for removal. Keeping it around in its current state results in the analyzer not meeting the expectations of developers that include the rule, potentially even causing misconceptions that an element isn't public when it is.
A replacement, with a new name, can be introduced in the future if there is the desire and time to implement it.
Bug: https://github.com/dart-lang/linter/issues/5107
Change-Id: Ied113e4c98be2253cb938277cfd6ea1c96bcac4a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389585
Reviewed-by: Phil Quitslund <pquitslund@google.com >
Auto-Submit: Parker Lougheed <parlough@gmail.com >
Reviewed-by: Samuel Rawlins <srawlins@google.com >
Commit-Queue: Samuel Rawlins <srawlins@google.com >
2024-10-16 21:13:27 +00:00
Samuel Rawlins
dac5fa8567
Revert "lint rule: Remove the avoid_null_checks_in_equality_operators rule"
...
This reverts commit 5572900016 .
Reason for revert: broke the assorted_layout_widgets customer tests.
Original change's description:
> lint rule: Remove the avoid_null_checks_in_equality_operators rule
>
> Fixes https://github.com/dart-lang/linter/issues/5063
>
> Change-Id: I85a3c9e1a568d55ce1e21d0f1fee4ce1c83292f4
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389300
> Commit-Queue: Samuel Rawlins <srawlins@google.com >
> Reviewed-by: Phil Quitslund <pquitslund@google.com >
Change-Id: I3ff1448088f4d5163dc66f6e181a97302c4d137a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/390300
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com >
Reviewed-by: Phil Quitslund <pquitslund@google.com >
Commit-Queue: Phil Quitslund <pquitslund@google.com >
Auto-Submit: Samuel Rawlins <srawlins@google.com >
2024-10-15 20:25:28 +00:00
Sam Rawlins
5572900016
lint rule: Remove the avoid_null_checks_in_equality_operators rule
...
Fixes https://github.com/dart-lang/linter/issues/5063
Change-Id: I85a3c9e1a568d55ce1e21d0f1fee4ce1c83292f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389300
Commit-Queue: Samuel Rawlins <srawlins@google.com >
Reviewed-by: Phil Quitslund <pquitslund@google.com >
2024-10-14 20:57:04 +00:00
Erik Ernst
46cff10fc7
Add lint avoid_futureor_void
...
This CL adds support for a new lint, `avoid_futureor_void`, that reports on every occurrence of the type `FutureOr<void>` in a covariant or invariant position. More details can be found at https://github.com/dart-lang/linter/issues/4622 .
Change-Id: I1b86e04921d1fb0b3661be091ea1f4ad72089e8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382403
Commit-Queue: Erik Ernst <eernst@google.com >
Reviewed-by: Samuel Rawlins <srawlins@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
2024-09-12 10:49:48 +00:00
Erik Ernst
5b7c600d8b
Implement the lint 'specify_nonobvious_local_variable_types'
...
This lint is the complement of 'omit_obvious_local_variable_types'
in that it flags every declaration that does _not_ specify the type
of a local variable, when it has an initializing expression whose type
is not obvious (defined as in 'omit_obvious_local_variable_types').
Change-Id: If80a961e47fed0412d0ea0bac5ac010e26fea7bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/379160
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Erik Ernst <eernst@google.com >
Reviewed-by: Phil Quitslund <pquitslund@google.com >
2024-08-13 09:43:49 +00:00
Sam Rawlins
b946c47ec9
new lint rule: use_truncating_division
...
Fixes https://github.com/dart-lang/linter/issues/3930
This allows us to remove (softly) the DIVISION_OPTIMIZATION HintCode,
which was not deemed a good candidate for a Warning.
Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: Iac48c94687d0b6b32c971e9f366ccb96adf34429
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/378543
Reviewed-by: Phil Quitslund <pquitslund@google.com >
Commit-Queue: Samuel Rawlins <srawlins@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
2024-08-02 22:31:19 +00:00
Erik Ernst
002bcd022b
Add lint omit_obvious_local_variable_types
...
This CL adds an implementation of a lint named
'omit_obvious_local_variable_types' which is a variant of
'omit_local_variable_types' that only flags type annotations
of local variables when the static type of the initializing
expression is obvious, as defined in
https://github.com/dart-lang/linter/issues/3480 .
Change-Id: I7e9b5adde5839ad8f9dfa88833da82d7bc1b65de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/374601
Commit-Queue: Erik Ernst <eernst@google.com >
Reviewed-by: Phil Quitslund <pquitslund@google.com >
2024-07-16 15:36:40 +00:00
Sam Rawlins
607b3f5ddb
linter: new rule for documenting ignore comments
...
In order to land this new rule, I add a new `IgnoredElement` subclass,
`IgnoredDiagnosticComment`, for any trailing comment text. This seems
like a pretty clean implementation. The text and offset are not used,
but it seems like it would be inconsistent to not offer them.
I also make a few IgnoreInfo fields private that are unused outside
the library.
Fixes https://github.com/dart-lang/linter/issues/4860
Change-Id: Id6f949a317929dae8833e404d4c9f3c8e4f7bc90
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365488
Commit-Queue: Samuel Rawlins <srawlins@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Reviewed-by: Phil Quitslund <pquitslund@google.com >
2024-05-10 14:24:58 +00:00
Srujan Gaddam
b0a34dbccb
[linter/analyzer] Add lint for runtime type tests of JS types
...
Closes https://github.com/dart-lang/linter/issues/4841
Adds a lint to verify and report whether an is check or a cast
may result in platform-inconsistent behavior. In order to do so,
adds necessary additions to canBeSubtypeOf and extends the mock
SDK. Also adds this to the list of default rules.
Change-Id: I7f235ee698419d9f253cc96f08322bedca271825
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/361722
Reviewed-by: Sigmund Cherem <sigmund@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
2024-05-08 20:57:59 +00:00
Kallen Tu
cd4b418628
[linter] Add unintended_html_in_doc_comment lint.
...
This CL adds a lint that reports when a user uses a pair of angled brackets which are not in a code block, nor a code span, and is not an autolink.
Updated the `rules.json` for the new lint as well.
Bug: https://github.com/dart-lang/linter/issues/4793
Change-Id: I1ca762b5e62678b8c6fba60206f3465154696b6c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359900
Reviewed-by: Morgan :) <davidmorgan@google.com >
Commit-Queue: Kallen Tu <kallentu@google.com >
Reviewed-by: Samuel Rawlins <srawlins@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
2024-04-02 21:09:51 +00:00
pq
200e6d987d
rename to unnecessary_library_name
...
As noted by Lasse, we're not really consistent and the singular is more "correct".
See: https://github.com/dart-lang/sdk/commit/71456592d0268238ac0f8a5c7d3fd8bf2c096752#r140033857
Change-Id: I55afeab8c42d9f20999e263682f71d54a2302ea5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358682
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Phil Quitslund <pquitslund@google.com >
2024-03-20 19:28:52 +00:00
pq
71456592d0
+ unnecessary_library_names
...
Fixes: https://github.com/dart-lang/linter/issues/3882
(I'll follow-up with a quick-fix.)
Change-Id: Ice88bfb59a16163b003ce94c73e057d2fd968a9d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358561
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Phil Quitslund <pquitslund@google.com >
2024-03-20 16:54:59 +00:00
Kallen Tu
7e12dddee6
Add 'missing_code_block_language_in_doc_comment' lint.
...
This CL adds a lint that warns you if you are missing a language info string after the first code block fence.
This should replace Dartdoc's in-house `missingCodeBlockLanguage` warning.
Bug: https://github.com/dart-lang/linter/issues/4904
Change-Id: Ie7279a8a0c041de6937ab0841c4a207b16064307
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/356282
Reviewed-by: Samuel Rawlins <srawlins@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Kallen Tu <kallentu@google.com >
Reviewed-by: Phil Quitslund <pquitslund@google.com >
2024-03-11 18:25:40 +00:00
Brian Wilkerson
8356cfeb8f
Deprecate avoid_unstable_final_fields
...
Change-Id: I1d47dfcef9d910875833823aaf304f2945bb3254
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/340285
Reviewed-by: Phil Quitslund <pquitslund@google.com >
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com >
2023-12-07 21:55:18 +00:00
Erik Ernst
cdc16e7d3d
Create lint PR 3578 as Gerrit CL
...
This CL transfers the changes made by
https://github.com/dart-lang/linter/pull/3578
to Gerrit.
Change-Id: Ib1eae56d2112e25bcf9916abf27b05bd3de15735
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326342
Commit-Queue: Erik Ernst <eernst@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
2023-10-12 10:09:10 +00:00
pq
d1b6ea9f4d
+annotate_redeclares
...
Fixes: https://github.com/dart-lang/linter/issues/4747
Change-Id: I7bf3e83dbe279f5b1a03dc5e5806c7c0fe3e3486
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326263
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Phil Quitslund <pquitslund@google.com >
2023-09-18 02:41:29 +00:00
William Hesse
86c86d638a
Add linter repository to sdk, preserving its commit history
...
Added using git-subtree command git subtree add -P pkg/linter linter/main
Bug: https://github.com/dart-lang/linter/issues/4411
2023-08-23 14:05:34 +02:00