Skip to content

Conversation

@github-actions
Copy link
Contributor

@github-actions github-actions bot commented Apr 8, 2025

You can preview this rule here (updated a few minutes after each push).

Review

A dedicated reviewer checked the rule description successfully for:

  • logical errors and incorrect information
  • information gaps and missing content
  • text style and tone
  • PR summary and labels follow the guidelines

@github-actions github-actions bot added the python label Apr 8, 2025
@thomas-serre-sonarsource thomas-serre-sonarsource changed the title Create rule S7472 Create rule S7472: Avoid the usage of unionAll() in favor of union() Apr 8, 2025
@sonarqube-next
Copy link

sonarqube-next bot commented Apr 8, 2025

Quality Gate passed Quality Gate passed for 'rspec-tools'

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

"sqKey": "S7472",
"scope": "All",
"defaultQualityProfiles": ["Sonar way"],
"quickfix": "unknown",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I can add a quick fix but I don't know how to do it 😢 Do you know what I should write here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So depending on how we can implement it you can put one of the key word present here

@sonarqube-next
Copy link

sonarqube-next bot commented Apr 8, 2025

Quality Gate passed Quality Gate passed for 'rspec-frontend'

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

Copy link
Contributor

@joke1196 joke1196 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really good! I have left really small comments about formatting.

df1 = spark.createDataFrame(data1, ["id", "name"])
df2 = spark.createDataFrame(data2, ["id", "name"])

# Noncompliant: unionAll() is deprecated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I think it would be best to put it on the same line as the issue raised. This way the diff view contains less changes on SQS.


== Why is this an issue?

When using Pyspark, it is recommended to avoid using the `unionAll()` method and instead use the `union()` method when combining two DataFrames. The unionAll() method is deprecated and has been replaced by union(), which provides the same functionality. Using union() ensures compatibility with future versions of PySpark and aligns with current best practices.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the sake of consistency, I would maybe put all unionAll() and union() in between backticks. WDYT?

"quickfix": "unknown",
"code": {
"impacts": {
"MAINTAINABILITY": "MEDIUM",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you have one extra , here...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants