Closed GradedJestRisk closed 1 year ago
Thanks for reporting this! I'm not sure static code analysis is the best approach to solving this, but perhaps we could take a stab at it. Are you open to work on this?
A good name for this rule might be no-mixed-transactions
.
Well, in the code fix I mentioned, static code analysis wouldn't do it.
However, such a rule would be useful in most cases and no-mixed-transactions
sound a good name, as we don't talk about nested transactions.
I would love to work on this, but keep in mind:
I had a first look on a rule implementation and saw there's some documentation also.
What do you recommend ? Start implementing (test, then code) and read docs when stucked, or read docs first ?
Hey, sorry for not getting back to you. Did you get started on this?
Don't worry about this being your first time. It's not as hard as it might seem. A great tip is to use ASTExplorer (configured with espree and ESLint V4) to explore and experiment with the AST.
Let me know if I can help. If you don't have time, just let me know 😊
I didn't start yet, but with this feedback I can go on !
Two years went by, I'm better choosing an easier rule !
:unicorn: Problem
Knex implements explicit transactions, but allow to mix
Such a code would not be implemented purposefully, and may end up exhausting the connection pool
Such an issue has been raised in knex repo
:robot: Solution
Implement a rule that does not allow mixing transactions
:rainbow: Remarks
Such a behavior occurred in production in this repository yesterday, blocking hundred of thousand of users
FYI, the original fix is here