Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

new lints - #8849

Merged
dnfield merged 19 commits into
flutter-team-archive:masterfrom
dnfield:lint
May 7, 2019
Merged

dnfield merged 19 commits into
flutter-team-archive:masterfrom
dnfield:lint

Conversation

@dnfield

@dnfield dnfield commented May 4, 2019

Copy link
Copy Markdown
Contributor

Adds lints for:

  • unnecessary_new
  • unnecessary_const

Updates a bunch of files that were not conforming to other lints as well.

Updates some miscellaneous formatting issues.

Updates a test that wasn't using the variable it declared.

@jonahwilliams can you validate the changes in web_sdk for me? I can pull those out if we're worried about them. Some of those files seem completely wrong right now.

}
if (name != null) {
arguments.add(new NamedExpression('name', new StringLiteral(name)));
arguments.add( NamedExpression('name', StringLiteral(name)));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove space after parenthesis (here and at several place in the diff)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread lib/stub_ui/lib/geometry.dart Outdated
static const Offset infinite = const Offset(double.infinity, double.infinity);

/// Returns a new offset with the x component scaled by `scaleX` and the y
/// Returns a offset with the x component scaled by `scaleX` and the y

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new should not be removed inside comments :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah thanks. There were a few places where it made sense in the comments for sample code, guess I was overzealous

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving stub_ui as is, since there's another PR to remove all those comments anyway

@dnfield

dnfield commented May 5, 2019

Copy link
Copy Markdown
Contributor Author

To support analysis/testing with set literals, this involved updating the pre-built Dart SDK we use. I've dumped the python hook for a cipd package and bumped the version.

@jonahwilliams

Copy link
Copy Markdown
Contributor

For a similar reason as I posted on the other review: please add exclude to stub_ui for this analysis code, as it will make syncing + unforking more difficult

Comment thread lib/ui/painting.dart Resolved
Comment thread lib/ui/painting.dart Resolved
Comment thread lib/ui/window.dart Resolved
Comment thread lib/ui/window.dart Resolved
});

final ByteData testData = new ByteData.view(new Uint8List(0).buffer);
final ByteData testData = ByteData.view(new Uint8List(0).buffer);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unnecessary new?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder why the analyzer misses that.

Comment thread testing/dart/window_test.dart Resolved
Comment thread tools/licenses/lib/main.dart Resolved
Comment thread tools/licenses/lib/main.dart Resolved
Comment thread tools/licenses/lib/main.dart Resolved
@dnfield

dnfield commented May 6, 2019

Copy link
Copy Markdown
Contributor Author

@jonahwilliams I think I don't understand what stub_ui is then. Is it really better to let it drift further out of sync with ui?

@jonahwilliams

Copy link
Copy Markdown
Contributor

Only the API conformance matters. Everything else will be owned by the web team and I leave it up to them how to lint their codebase.

stub_ui is going to be replaced wholesale within a short period of time with the real implementation. The replacement may not conform to all of these lints, and asking for a sync and fix in the same commit is too much I think.

@dnfield

dnfield commented May 6, 2019

Copy link
Copy Markdown
Contributor Author

I've reverted stub_ui portions of this PR.

I suspect what we really want here though is a set of interface/abstract classes that both implementations have to conform to...

@jonahwilliams

Copy link
Copy Markdown
Contributor

Ideally yes, but that is not currently possible with dart:* libraries. We could declare a set of interfaces and compile them out, though it would complicate the native ui implementation.

The way the SDK handles different implementations is via patch files (https://github.com/dart-lang/sdk/blob/master/sdk/lib/_internal/js_runtime/lib/io_patch.dart). The problems are that you can no longer read the code to figure out what it does, and it requires designing the interface to be patched. In our case it would be breaking.

@dnfield

dnfield commented May 7, 2019

Copy link
Copy Markdown
Contributor Author

Also reverted web_sdk folder from these changes.

@dnfield

dnfield commented May 7, 2019

Copy link
Copy Markdown
Contributor Author

If it helps I could try splitting some of these out - it's a little tricky but can be done. The optional new is going to be a larger one no matter what though.

@a14n a14n left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jonahwilliams jonahwilliams left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dnfield
dnfield merged commit 2b1f992 into flutter-team-archive:master May 7, 2019
@dnfield
dnfield deleted the lint branch May 7, 2019 23:10
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 8, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 8, 2019
engine-flutter-autoroll added a commit to flutter/flutter that referenced this pull request May 8, 2019
flutter-team-archive/engine@149b7b8...0fc6efb

git log 149b7b8..0fc6efb --no-merges --oneline
0fc6efb Roll src/third_party/dart a8b6e18b62..8143450941 (11 commits)
93d1c37 Remove absolute path in new Fuchsia SDK based runner target dependency. (flutter-team-archive/engine#8888)
0b406c3 Copy the Flutter Runner from //topaz into the engine. (flutter-team-archive/engine#8886)
2b1f992 new lints (flutter-team-archive/engine#8849)
0c7a3f2 Copy //dart-pkg/zircon|fuchsia from Topaz into the engine. (flutter-team-archive/engine#8884)
ba82ea2 Roll src/third_party/skia 056944747072..51e15a69ce5b (8 commits) (flutter-team-archive/engine#8885)
d717044 Copy //runtime/dart/utils from Topaz into the engine. (flutter-team-archive/engine#8871)

The AutoRoll server is located here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+/master/autoroll/README.md

If the roll is causing failures, please contact the current sheriff ([email protected]), and stop
the roller if necessary.
huqiuser pushed a commit to huqiuser/engine that referenced this pull request Jun 12, 2019
Dart lints added:
* Avoid optional new
* Avoid optional const
* Prefer single quotes
* Prefer default assignment `=`
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Development

Successfully merging this pull request may close these issues.

4 participants