dart-lang / site-www

Source for Dart website
https://dart.dev
Other
936 stars 675 forks source link

Is the lib directory excluded by the analyzer per 'Customizing static analysis' #2831

Open Hesamedin opened 3 years ago

Hesamedin commented 3 years ago

Page URL: https://dart.dev/guides/language/analysis-options Page source: https://github.com/dart-lang/site-www/tree/master/src/_guides/language/analysis-options.md

Description of issue: lib/ is part of the path to the file that is going to be excluded according to your doc at here. However, I realized that my folder is still visible to the analyzer.

Fix/Solution: I removed the lib/ from the path and Analyser is able to ignore my folder.

Link to my question on Stackoverflow: https://stackoverflow.com/q/65566164/513413

kwalrath commented 3 years ago

@pq or @devoncarew, I believe @Hesamedin, but is that really the way analyzer: exclude: is supposed to work? It's counterintuitive to include test/ but not include lib/. Should anything else change in this doc?

Affected doc section: Excluding files.

pq commented 3 years ago

Hmmm. I agree that it feels odd but lib is kind of special and think we probably want to just update the docs to capture the gotcha.

fyi @bwilkerson who might be interested.

bwilkerson commented 3 years ago

I was unaware that lib was being handles differently, and I don't believe that it should be. We've had a fairly large number of reports claiming that exclude wasn't working; I'm wondering now how many of those cases were a result of this bug.

I think that we should

We can then send out a breaking change notice saying that we're going to remove support for patterns that are missing lib and remove it in the release following the next release.

devoncarew commented 3 years ago

I was unaware that lib was being handles differently, and I don't believe that it should be. We've had a fairly large number of reports claiming that exclude wasn't working; I'm wondering now how many of those cases were a result of this bug.

I was unaware of this a well. Are we definitely doing this? A very casual perusal of pkg/analysis_server/lib/src/context_manager.dart and pkg/analyzer/lib/src/source/path_filter.dart doesn't turn up any lib/ hardcoding.

pq commented 3 years ago

🤔

hrmmm. Not sure what I was thinking about but will dig a little and if I come up with anything will report back. Sorry for possibly muddying the waters!

atsansone commented 1 year ago

@bwilkerson : Is this still an active concern?

bwilkerson commented 1 year ago

I don't know the status of this issue. We should probably have someone look into it, but I'd probably give it a fairly low priority given how long it's been open and how few reports we've had, so I don't know how likely that is to happen. I'd be fine with closing this issue and inviting users to create an issue on the sdk repo if it's still causing problems.