S6735 False positive when evaluating pandas.merge having right_on and left_on as parameters

  • Operating system: Windows
  • SonarLint plugin version:
  • Programming language you’re coding in: Python
  • Is connected mode used: Yes
    • Connected to SonarCloud

Sonarlint raises an issue (rule S6735) for not passing the parameter “on” when evaluating the following line of code that uses pandas.merge:

df = pd.merge(df, df_merge, left_on=col, right_on='cat', how='left', validate='m:m')

even though the parameters left_on and right_on were passed. In the description of the rule it says “This is why it is a good practice to provide the parameters how, on (or left_on and right_on) and validate to the pandas’ merge and join.”, so I believe this is a bug.

Hi Daniel,

Thanks a lot for bringing this to our attention. This is indeed a false positive, and I have implemented a fix to take care of this matter. This fix will be deployed as part of the next release of our Python analyzer.



This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.