You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Many popular python libraries support an API for call chaining, also known as fluent interface. Examples are pandas, pyspark and pytorch.
Using the fluent interface increases readability and has more than once helped in spotting bugs early.
The core pattern of reassigning to the same variable is missing.
Rather than creating a stand-alone lint for this, I would like to propose to include a rule to refurb that detects multiple assignments to the same variable that could be chained.
Are you open to adding this rule to the library?
The text was updated successfully, but these errors were encountered:
Thank you @sbrugman for opening this! I think this is a good thing to add. There are probably a bunch of edge cases in how people use (or misuse) fluent API's, meaning it might be hard to detect all cases where chaining could be used instead. I don't think that is much of an issue though, so long as we can detect the trivial/basic cases.
I will go ahead and review the PR you opened sometime tomorrow!
Overview
Many popular python libraries support an API for call chaining, also known as fluent interface. Examples are pandas, pyspark and pytorch.
Using the fluent interface increases readability and has more than once helped in spotting bugs early.
The core pattern of reassigning to the same variable is missing.
In existing linters and formatters, I have found partial functionality to enforce this pattern. :
Proposal
Rather than creating a stand-alone lint for this, I would like to propose to include a rule to
refurb
that detects multiple assignments to the same variable that could be chained.Are you open to adding this rule to the library?
The text was updated successfully, but these errors were encountered: