Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new lints #8849

Merged
merged 19 commits into from
May 7, 2019
Merged

new lints #8849

merged 19 commits into from
May 7, 2019

Conversation

dnfield
Copy link
Contributor

@dnfield dnfield commented May 4, 2019

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
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
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -194,7 +194,7 @@ class Offset extends OffsetBase {
// This is included for completeness, because [Size.infinite] exists.
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
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
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
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
Copy link
Contributor Author

dnfield commented May 5, 2019

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
Member

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

lib/ui/painting.dart Outdated Show resolved Hide resolved
lib/ui/painting.dart Outdated Show resolved Hide resolved
lib/ui/window.dart Outdated Show resolved Hide resolved
lib/ui/window.dart Outdated Show resolved Hide resolved
@@ -159,7 +159,7 @@ void main() {
};
});

final ByteData testData = new ByteData.view(new Uint8List(0).buffer);
final ByteData testData = ByteData.view(new Uint8List(0).buffer);
Copy link
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
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.

testing/dart/window_test.dart Outdated Show resolved Hide resolved
tools/licenses/lib/main.dart Outdated Show resolved Hide resolved
tools/licenses/lib/main.dart Outdated Show resolved Hide resolved
tools/licenses/lib/main.dart Outdated Show resolved Hide resolved
@dnfield
Copy link
Contributor Author

dnfield commented May 6, 2019

@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
Member

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
Copy link
Contributor Author

dnfield commented May 6, 2019

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
Member

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
Copy link
Contributor Author

dnfield commented May 7, 2019

Also reverted web_sdk folder from these changes.

@dnfield
Copy link
Contributor Author

dnfield commented May 7, 2019

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.

Copy link
Contributor

@a14n a14n left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@jonahwilliams jonahwilliams left a comment

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: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/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/engine#8888)
0b406c3 Copy the Flutter Runner from //topaz into the engine. (flutter/engine#8886)
2b1f992 new lints (flutter/engine#8849)
0c7a3f2 Copy //dart-pkg/zircon|fuchsia from Topaz into the engine. (flutter/engine#8884)
ba82ea2 Roll src/third_party/skia 056944747072..51e15a69ce5b (8 commits) (flutter/engine#8885)
d717044 Copy //runtime/dart/utils from Topaz into the engine. (flutter/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 (chinmaygarde@google.com), 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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants