I’m writing a custom class that follows the ML Pipelines API in PySpark. For an example of one of the provided classes see
LogisticRegression here. You’ll see that the
setParams() methods have many type-hinted arguments with default values.
Unfortunately, when I write my own class that follows this pattern, SQ flags the keyword args that are re-used across
setParams() as duplicate code and fails the Quality Gate. I can use
sonar.cpd.exclusions to exclude my entire class from duplicate code detection but I don’t really want to do this as it has proved useful in the past to flag areas that should be refactored.
So can the duplicate code detection algorithm for Python be configured to exclude keyword args for methods?