-
Notifications
You must be signed in to change notification settings - Fork 335
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
Resolve cyclic imports #1794
Resolve cyclic imports #1794
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this. I think it is a good change. The main thing I am learning about this is that we have too much stuff in our util.ts
module. My thinking is that we should avoid generic util
modules and put code into smaller, more focused modules. It makes things easier to find, and also less likely to have circular dependencies.
I mostly agree, with the main caveat being when we need to reference a function from two files A and B where A depends on B or B depends on A, it's often easier to put it in Another thing I took from the PR was around layering. We have a bunch of functions that call the API somewhat opaquely via |
This further reinforces my point that
Yes. Though, it could make things somewhat awkward because we'll start to need to pass in the API Client into most functions in the action. It might be worth trying the refactoring to see how bad it gets. This would be a good use case for dependency injection (but that is a whole other can of worms). |
We ran into an issue during the rollout of the new analysis summary feature where the version check wasn't working properly. This resulted in us trying to pass a CLI argument to a CodeQL version that didn't understand it. This bug occurred due to a cyclic import affecting
codeql.ts
andfeature-flags.ts
.Since this isn't the first time we've ran into this sort of issue, I figured it was worth introducing some static checking to try to prevent this kind of problem from happening again.
This PR enables the "no cyclic imports" eslint rule, and fixes all the cyclic imports it reports. Commit-by-commit review strongly recommended as this took a lot of refactoring!
Merge / deployment checklist