Commit graph

45 commits

Author SHA1 Message Date
Sam Rawlins
49a3fb4f96 [analyzer] Separate the HTML parser utility from the DOM
With the parser code in the same library as the DOM classes, the
`pkg/analyzer/tool/messages/generate.dart` program, which generates all
of the diagnostic classes and diagnostics, _depends_ on a library
with a `parse` method which depends on these diagnostic classes (in
order to report errors while parsing HTML). This means that if
there is any existing error (like an unknown identifier) in the
existing error codes, it is impossible to generate the error codes.

Since we don't need the `parse` method to generate diagnostics, we
split up the library and remove the indirect dependency.

Separating the parser code out removes the loop.

Change-Id: Ifb9e9fd979e341ae64a1ed49aaf3758d3dcf1dee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287220
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-03-08 03:06:19 +00:00
Brian Wilkerson
c021746bc4 Automate checking for solo tests
Change-Id: Iba0134f4b31b64d3bf3eb622c57d0e40121494f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286944
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-03-06 22:53:37 +00:00
pq
ad2da86f18 linter 1.33.0 rc
Some notes.

* There are a number of tests that should get decoupled from the linter being pulled into `DEPS`.  Instead of depending on the state of lints there, we should update the tests instead to use a more hermetic environment.  (See for example `options_rule_validator_test.dart` for how that might look.)


Downstream (blocking) fixes:

* https://github.com/flutter/flutter/pull/119736
* https://github.com/flutter/gallery/pull/878


Change-Id: I5671b0abde3eeda75513abaaf9fef3bcd5115f9b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280054
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2023-02-07 20:56:35 +00:00
Brian Wilkerson
d9482e35ce Remove some unnecessary ignore comments in analyzer packages
Change-Id: I578285132f0d3f200cb2e9069750a1391940711d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274721
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-12-09 21:33:18 +00:00
Sam Rawlins
eaff33f439 analyzer_utilities: tidy static analysis
* Stop using `implicit-casts: false`
* Don't list rules which are found in package:lints
* Fix strict-inference issues

Change-Id: Ibe350548e3d6bef486ef2ef82430cda23d684baf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271780
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2022-11-28 18:11:03 +00:00
Sam Rawlins
5f8ef7be53 Enable new linter rules in analyzer packages
Change-Id: Id0182648a347a05cbf6e1483a0afe94219268853
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271000
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2022-11-21 23:02:38 +00:00
Konstantin Shcheglov
dd63e54e2c Remove fluent check().
Change-Id: I6f41efb2432ebd4a6a03638d5db0937f20386200
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261440
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-09-27 19:15:55 +00:00
Ahmed Ashour
5fe480b788 Fix typos
Fix #49864

TEST=ci

Change-Id: I9a7e06d604cd0b4f56f2ac229ab3fc9f01cb9d76
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256824
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2022-09-16 19:35:00 +00:00
Devon Carew
cb5b66f694 [analysis_server] minor cleanups to analysis server spec generation
Change-Id: I9fd780fb627eaab24731d426e5a0f51b9608f189
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249734
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-27 17:21:02 +00:00
Devon Carew
057d0baaf9 Add a lightweight parser for the analyzer spec (remove sdk deps on package:html).
Change-Id: Ia8776c8aea845a7dde089d5ac9f3dab82e984f4f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249721
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-25 00:34:40 +00:00
Konstantin Shcheglov
aa0d0c56cb Make Cache.get() just return the value.
Change-Id: I816a1c28569011215ad6cba9a7559513a7900386
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/246880
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-02 15:45:45 +00:00
Konstantin Shcheglov
8ded7af5f5 Add LibraryOrAugmentationFileKind.exports/imports
These will replace eventually FileState.exported/importedFiles,
because only libraries or augmentation can have them. Also, we will
build Export/ImportElement(s) from them, when google3 switches to
using AnalysisDriver.buildPackageBundle(), so we are free to make
changes to the way linker works.

Change-Id: I66674dc7720aa704cfc36d16fc78e17dd05a8b93
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/246681
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-01 06:35:14 +00:00
Devon Carew
f7c46f145c [pkg] prefer 'any' deps for package dev dependencies
Tested: CI validation
Change-Id: If65cc156130a65ffe00c6f1660ac320e2921afae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/246053
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2022-05-27 01:34:59 +00:00
Ahmed Ashour
466202bb34 [analyzer] remove lints ignore in generated files
Fixes #49039

Change-Id: I14e98fc5ab9c1f7b7e69f99dc1c97178b56c624d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/245020
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-05-19 05:17:00 +00:00
Nate Bosch
6ebd2633cd Use any deps for all unpublished packages
It should not be necessary to ever run `pub get` for a package which is
not published. All packages used in the SDK are controlled by a single
package config, so it's not necessary to declare versions or paths for
any packages.

Remove all dependency overrides.

R=devoncarew@google.com

Change-Id: Icb328813b471f35ee4c99995f4e90aac4d8ed438
Tested: Covered by existing static analysis.
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/244767
Commit-Queue: Nate Bosch <nbosch@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2022-05-17 01:22:25 +00:00
Sam Rawlins
531e6e175f analyzer: Prefer string interpolations
ignore prefer_interpolation_to_compose_strings and
constant_identifier_names in generated files.

Change-Id: I963504e298f8e439734522fed9ac09911750f419
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243646
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-05-04 20:45:25 +00:00
Konstantin Shcheglov
76387a9c5b Support for google3 locations in 'packageRoot' and KernelCompilationService.
Change-Id: I90910bc3c966f648ade107d10d4c7f593c67c7a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242162
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-04-25 19:46:13 +00:00
Devon Carew
9637ef7205 Move pkg/analyzer_utilities to package:lints
Change-Id: I1ff5a123065f6b500cfc4cb12ce5dfd387c6cfaa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240912
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2022-04-14 22:31:04 +00:00
Konstantin Shcheglov
3d69c3c0c4 Restore sync file methods in AnalysisSession.
There are clients, like `built_value` that cannot be updated.

Change-Id: I27371018039f22cd7ca2cb82b30ec33469aa6e4e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238002
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-21 23:27:57 +00:00
Konstantin Shcheglov
0b7b70b758 Deprecate synchronous methods in AnalysisSession.
Change-Id: I9bd3bf2d3d6dbc74ffefde1c06f83e9200b0f552
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235100
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
2022-03-07 18:17:41 +00:00
Alexander Thomas
30beab0f43 [infra] Add OWNERS to the Dart SDK
* Add team "groups" in tools/OWNERS_<group name>.
* Add top-level OWNERS as a fallback.
* Add OWNERS for all top-level directories.
* Add OWNERS to all packages.

For additional background information see go/dart-sdk-owners.

TEST=No op until code-owners is enabled.
Bug: b/200915407
Change-Id: I7fe6116cc599c749cd50ca16151d6d6a801d99d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/229147
Reviewed-by: Jonas Termansen <sortie@google.com>
2022-02-14 14:06:34 +00:00
Konstantin Shcheglov
44698e8c62 Add includesAllInOrder() check.
Change-Id: Iaf35dfc49119df58b7d5789bdf60afb0bfefcb18
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/230100
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-01-28 04:28:31 +00:00
Konstantin Shcheglov
601fecb36a Use use check() for the new completion request suggestion tests.
Change-Id: Ied03c89b0a898f16739be5e669f1602355ef3a6c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/227423
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-01-11 16:31:24 +00:00
Konstantin Shcheglov
2f222990dc Rewrite remaining named argument tests to checks.
Change-Id: Iedab51f44bf17512f5aa7d7270a5f7f880cba90c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/226600
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-01-05 22:16:51 +00:00
Konstantin Shcheglov
996eb0583a Rewrite ArgListContributorTest tests that call _tryParametersArguments() using check().
Specifically, to include replacement ranges, which we did not test
consistently, and to merge all check that we have into one matcher
instead of having two limited methods looking for suggestions.

I started initially looking at https://github.com/dart-lang/sdk/issues/34672,
and realized that it is somewhat scary to make more invasive changes
without checks for replacement ranges.

Change-Id: I303cd066989f2a137013ac8dac0614b24e52071d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/225800
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2021-12-29 19:15:18 +00:00
Konstantin Shcheglov
5738ab2eb6 Sort extension members.
Change-Id: I7538ea08fe414c3fc6ad69bafb4e665214003d30
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/224960
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-12-20 18:35:03 +00:00
Konstantin Shcheglov
e3e44ea410 Add which() for multi checks.
Change-Id: I07dff9db3c7870b8799477d949b23a45ba689130
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/223920
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-12-14 19:31:35 +00:00
Konstantin Shcheglov
7b31338938 Add isNotNull and isNull checks.
Change-Id: Ib8fb64e15dcc2458667d48cd6c86c83f6b45d25c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/223840
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-12-14 17:11:34 +00:00
Michael Thomsen
71e3dac037 Remove deprecated packageRoot API, which doesn't work in Dart 2
Bug: https://github.com/dart-lang/sdk/issues/47769
Change-Id: I1cbd7761e7119c07f2697d7624bec703ba4c4641
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/221340
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
2021-12-07 14:44:49 +00:00
Konstantin Shcheglov
9703f4ae9f Fix the failing isA test.
TBR

Change-Id: I0582a5c39356a9b5f099b1cb438dd230eec0485e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219754
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-11-09 06:31:13 +00:00
Konstantin Shcheglov
dab9d70e97 Tests for check() and extensions.
Change-Id: Ie58dee09e24f0cbcba149d2ef6abae8185753403
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219621
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-11-08 17:31:52 +00:00
Konstantin Shcheglov
217367abd1 Add support for writing fluent value checks.
Change-Id: Id3bab09fdfd0531ca02c42883159482240a3dfde
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219581
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-11-05 22:37:58 +00:00
Brian Wilkerson
396e58e0f2 Improve test that error codes were generated
It appears that invoking exit with a value other than either zero (0) or
254 causes the test infrastructure to interpret the failure as a failure
in the infrastructure, turning the bot purple rather than red. Thowing
an exception is interpreted correctly, so I believe that this change will
cause a need to regenerate to show up as a red bot.

Change-Id: I01e9fc2bfe09fac3da2a9aade69fabf3abd17179
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216260
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-10-12 14:47:20 +00:00
Paul Berry
4ad7928ed2 Fix race condition in formatText.
When running tests using `test.py`, multiple tests are run in parallel
by different processes, which means multiple processes may be trying
to format text at the same time.  To avoid them clobbering each
others' data, we need to ensure that formatText uses a different
temporary file path each time it runs.  The easiest way to do this is
with the `Directory.createTempSync` method.

I have an upcoming CL that increases the amount of code generation
done by the analyzer; this fix is necessary to ensure that it passes
trybots reliably.

Change-Id: I92e2f2fcaec9032da90e8c271371d3e4cea59ab3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214780
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-09-28 19:06:41 +00:00
Konstantin Shcheglov
cac96f7f8d Rename AnalysisSession.getXyz2() into getXyz().
Change-Id: Ia76aafc6a1190dcdca026097c364270389f2860a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/206565
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-07-12 22:42:58 +00:00
Devon Carew
6815d1922a Move off of a use of 'dartfmt'.
Bug: https://github.com/dart-lang/sdk/issues/46046
Change-Id: Idcced5b7c25c9d5414b073f6ecb2abcc7ba62e68
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200300
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2021-05-18 23:09:53 +00:00
Konstantin Shcheglov
5dd02f0583 Add getParsedLibrary2(), deprecate getParsedLibrary() and other parse related
Change-Id: I585fa1f01b71522dc99ba86c2b9e20da256b2d27
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195880
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-04-19 15:52:39 +00:00
Alexander Thomas
c88171c8af [sdk] Bump version to 2.13
TEST=Presubmit tests and local builds
Change-Id: I1b15d60eced0cf3f422548eda75706609f6640cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182624
Commit-Queue: Alexander Thomas <athom@google.com>
Auto-Submit: Alexander Thomas <athom@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-04 12:10:17 +00:00
Konstantin Shcheglov
9f986d2501 Migrate package:analyzer to null safety.
Change-Id: Iffe4370431587e46a141ddc72a86ceec29c163b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176486
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2021-02-01 18:56:04 +00:00
Konstantin Shcheglov
75a5e771be Remove unnecessary type annotation.
It seems that after switching to null safe version of package:html
we don't need it anymore.

Change-Id: I599ffb2e1b716358e07e4884544b62a2dfa72216
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181461
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-01-27 23:55:15 +00:00
Nate Bosch
6e1a0b08c7 Update to null safe package:html
Change-Id: I667efbe0f895628130bc695e96a7f95a991c2e9d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181040
Commit-Queue: Nate Bosch <nbosch@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
2021-01-27 18:41:10 +00:00
Konstantin Shcheglov
f71639daa1 Enable package:pedantic/analysis_options.1.9.0.yaml and fixes.
Change-Id: I44a8236cb4569c8cec03a016c4861e32b0356aa6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177201
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-12-29 23:41:45 +00:00
Konstantin Shcheglov
ebbe6abdca Migrate package:analyzer_utilities to null safety.
Note that it uses package:analyzer that is not migrated yet, but is
being migrated. But it also uses package:html that we did not have
plans to migrate yet. Anyway, this CL will move us forward.

Change-Id: I6210c6baef8c20c0803a304d7bd99acc1f8ccd37
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177200
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-12-29 20:58:35 +00:00
Devon Carew
8cba879f46 Add additional validations to the pkg/ package pubspecs.
TEST=these are additional validations that we run on the bots

Redux of https://dart-review.googlesource.com/c/sdk/+/161040

Change-Id: Ia32ced5d48fbfeafacfa9e51dc4774d2e9425091
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174601
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2020-12-02 17:27:18 +00:00
Paul Berry
7d3bc4862d Rename pkg/analysis_tool to pkg/analyzer_utilities.
It's no longer just for the tools in the `tool` directory; it also
contains test utilities for use by the analyzer and related packages.

Change-Id: I0f8cf57f24ea7aad8e2177e43ee2bcb2ab3030da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171704
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-11-13 17:46:30 +00:00