Coder Social home page Coder Social logo

Comments (11)

bwilkerson avatar bwilkerson commented on June 17, 2024

Is use_super_parameters enabled for this code? I'm asking in order to determine whether the lint ought to be produced in the IDE but isn't, or whether it ought to not be produced on the bots.

from sdk.

kenzieschmoll avatar kenzieschmoll commented on June 17, 2024

Yes it is. We use package:flutter_lints, which is built on top of package:lints, which includes use_super_parameters: https://github.com/dart-lang/lints/blob/main/lib/recommended.yaml#L67

from sdk.

DanTup avatar DanTup commented on June 17, 2024

@kenzieschmoll are you able to get back to a state where this doesn't show up? I tried checking out latest code and reverting the change in flutter/devtools@25f0133 but it did show up for me:

Screenshot 2024-05-16 152015

If you can repro and provide a git hash (or git hash I can apply that change to) and exact SDK version I can debug.

from sdk.

DanTup avatar DanTup commented on June 17, 2024

Ignore that - I hadn't synced the Flutter SDK to the same version - it does repro now I'm on the same version.

from sdk.

DanTup avatar DanTup commented on June 17, 2024

Ok, so user_super_parameters was only added to flutter_lints in 3.0.0:

https://pub.dev/packages/flutter_lints/changelog#300

devtools_app is using v3.x:

https://github.com/flutter/devtools/blob/0547de50860c9913a76d30bfad6526938baee7b2/packages/devtools_app/pubspec.yaml#L76

But it's importing analysis_options from the parent folder which has its own pubspec that is using v2.x:

https://github.com/flutter/devtools/blob/0547de50860c9913a76d30bfad6526938baee7b2/packages/pubspec.yaml#L9

So my guess is that something changed recently (maybe related to the context changes?) that is causing v2 of flutter_lints to be used now for devtools_app where before, v3 was being used?

A quick fix for DevTools is to update flutter_lints in the parent pubspec.yaml alongside the analysis_options.yaml that's importing that file (it's probably an accident that it has an older version), but I think there might still be some bug here @bwilkerson?

from sdk.

bwilkerson avatar bwilkerson commented on June 17, 2024

I'm not sure I'm understanding the situation well enough to comment, but in case it's useful information, the expected behavior is for the resolution of URIs on the include line to always be based on the package configuration of the package in which the initial analysis options file is found, no matter where the analysis options file is found.

In other words, I would expect the resolution of flutter_lints to differ in the IDE and on the command line only if the package configuration being used differed in those two cases.

from sdk.

DanTup avatar DanTup commented on June 17, 2024

On the CI build here, analyze was run directly inside the devtools_app sub-folder:

/home/runner/work/devtools/devtools/packages/devtools_app > /home/runner/work/devtools/devtools/tool/flutter-sdk/bin/dart analyze --fatal-infos
Analyzing devtools_app...

   info - lib/src/shared/common_widgets.dart:1520:3 - Convert 'context' to a super parameter. - use_super_parameters

This (correctly IMO) flagged the issue.

However when I open the parent folder in VS Code, it seems like it might be using the version specified in the outer folder (at least, that's me theory for why it doesn't show up, since changing the version seemed to fix it). I'll make a small repro.

from sdk.

DanTup avatar DanTup commented on June 17, 2024

Here's a repro:

https://github.com/DanTup/repro-dart-sdk-55732

If I open the repository root, there is a nested folder "foo_package" which seems like it should trigger the lint (because it references v3 of flutter_lints), however it seems to be using flutter_lints v2 which is what is defined in the parent folders pubspec.yaml.

I suspect it's because of the import of anlaysis_options going through the parent folder. I tried removing that and it seemed to still be broken, however after restart VS Code the lint triggered again, so I think going through the outer analysis_options.yaml is relevant to the issue.

from sdk.

bwilkerson avatar bwilkerson commented on June 17, 2024

Just to clarify, the analyzer doesn't look for pubspec.yaml files, it looks for package_config.json files when deciding how to resolve URIs. I can't tell from the checked in example where pub had been run.

from sdk.

DanTup avatar DanTup commented on June 17, 2024

Oops, I didn't include them. I've pushed them now - but pub had been run in both folders and the innermost one does resolve to the correct version (v3) of flutter_lints.

There are two contexts created and the nested one shows both analysis options like this:

image

from sdk.

bwilkerson avatar bwilkerson commented on June 17, 2024

Ok, thanks. Then what I would expect, assuming that there weren't any flags on the command line that override the normal lookup, is that everything in foo_package would use the lints enabled in flutter_lints-3.0.2 when analyzed in either the IDE or from the command-line.

Given that that's not what we're seeing, it does look like a bug.

from sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.