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

Add onDone or onClose or something, just to allow to do some clean up after the analyzer done processing #247

Open
Abdelazeem777 opened this issue Apr 30, 2024 · 9 comments
Assignees
Labels
enhancement New feature or request

Comments

@Abdelazeem777
Copy link

Description:
Like we have the createPlugin entryPoint we need another function that allow us to do some clean up after the analyzer finish his job

// This is the entrypoint of our custom linter
PluginBase createPlugin() => _ExampleLinter();

// This should be called after the analyzer done
void onDone() {
//Doing some clean up here.
};
@Abdelazeem777 Abdelazeem777 added the enhancement New feature or request label Apr 30, 2024
@rrousselGit
Copy link
Collaborator

What sort of thing do you want to cleanup?

That's doable. Although it'd likely instead be a dispose method on PluginBase

@Abdelazeem777
Copy link
Author

Abdelazeem777 commented Apr 30, 2024

@rrousselGit

We had to have a global Set that we filled with some strings on addMethodInvocation and then recheck this Set on another addMethodInvocation

This lint has been working fine till now but when we remove any method that added to this Set on the lint
the lint never worked because this string is still on the Set from the previous analyzer check

So we need to call .clear() after the analyzer done

@rrousselGit
Copy link
Collaborator

Oh, you mean you want a per execution disposal?

That's tricky. I'm not sure whether that's something I'd want to add.
It means your lint is stateful, which is likely a bad idea.

Why do you have a global Set? Can't you make this non-global?

@Abdelazeem777
Copy link
Author

@rrousselGit
Unfortunately not,

Because each DartLintRule is running per Single File, so that we can't have a lint that can check the whole project files at once.

That's why we add this global static Set to fill from one addMethodInvocation and then check code from another addMethodInvocation using this Set

@rrousselGit
Copy link
Collaborator

Checking the entire project at once is not something supported.

If you need this for the sake of checking the entire project at once, then it is not a reasonable use-case. We'd first need to officially support project-wide analysis before trying to support special cases for it.

@Abdelazeem777
Copy link
Author

Abdelazeem777 commented Apr 30, 2024

@rrousselGit

But it would be nice to have this feature, even for File-Level regardless our workaround to handle this case.

What do you think?

@Abdelazeem777
Copy link
Author

@rrousselGit
Any updates?
Or at least could you guide me where should I ask for this feature or If I want to contribute then where should I start?

@rrousselGit
Copy link
Collaborator

Well I don't really have a plan to include this is in the package at the moment.

@Abdelazeem777
Copy link
Author

Okay, thanks for your response 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants