Skip to content

fix(QTDI-3124): [Refactoring] Merge sonar fixes#1248

Open
undx wants to merge 60 commits into
masterfrom
ouf/QTDI-3124-sonar-fixes
Open

fix(QTDI-3124): [Refactoring] Merge sonar fixes#1248
undx wants to merge 60 commits into
masterfrom
ouf/QTDI-3124-sonar-fixes

Conversation

@undx

@undx undx commented Jun 26, 2026

Copy link
Copy Markdown
Member

Requirements

This issue includes all the following refactoring issues rebased and merged on each others:

  • S6201 Pattern instanceof
  • S6204 Stream.toList()
  • S6126 Text blocks
  • S6208 Switch case merging
  • S1068 / S1481 Unused declarations
  • S1124 Modifier order
  • S2095 Resource leaks

Will be tested as a full non regression campaign test cycle.

Why this PR is needed?

Clear some sonar warnings

What does this PR adds (design/code thoughts)?

AI generated code

  • this PR has been written with the help of GitHub Copilot or another generative AI tool for checking risks and possible regressions.

undx and others added 30 commits May 21, 2026 17:56
Replace `instanceof` + manual cast patterns with Java 17 pattern
matching for instanceof to reduce Sonar warnings (java:S6201).

Both `(X) value` and `X.class.cast(value)` cast forms are handled.

Excluded cases:
- Conditions combined with `||` (pattern matching incompatible with
  alternation): AvroSchemaCache, SchemaConverter (Double||Float).
- ParameterSetter#set: target variable declared outside the `if`
  block (would require restructuring).
- Casts to a type different from the `instanceof` check (not S6201).
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
- used intellij inspection as it is...
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
undx and others added 18 commits May 29, 2026 16:07
# Conflicts:
#	component-runtime-beam/src/main/java/org/talend/sdk/component/runtime/beam/spi/record/AvroRecord.java
#	component-studio/component-runtime-di/src/main/java/org/talend/sdk/component/runtime/di/OutputsHandler.java
#	component-studio/component-runtime-di/src/main/java/org/talend/sdk/component/runtime/di/schema/TaCoKitGuessSchema.java
#	component-studio/component-runtime-di/src/main/java/org/talend/sdk/component/runtime/di/studio/ParameterSetter.java
…' into ouf/QTDI-3124-sonar-fixes

# Conflicts:
#	component-runtime-manager/src/main/java/org/talend/sdk/component/runtime/manager/xbean/converter/SchemaConverter.java
…o ouf/QTDI-3124-sonar-fixes

# Conflicts:
#	component-runtime-beam/src/main/java/org/talend/sdk/component/runtime/beam/spi/record/AvroRecord.java
#	component-runtime-impl/src/main/java/org/talend/sdk/component/runtime/record/json/RecordJsonGenerator.java
#	component-runtime-impl/src/test/java/org/talend/sdk/component/runtime/record/RecordConvertersTest.java
#	component-runtime-manager/src/test/java/org/talend/sdk/component/runtime/manager/service/RecordServiceImplTest.java
#	component-runtime-testing/component-runtime-beam-junit/src/main/java/org/talend/sdk/component/junit/beam/Data.java
…g' into ouf/QTDI-3124-sonar-fixes

# Conflicts:
#	component-form/component-form-core/src/main/java/org/talend/sdk/component/form/internal/validation/spi/ext/BaseValidation.java
#	component-runtime-manager/src/main/java/org/talend/sdk/component/runtime/manager/util/DefaultValueInspector.java
#	singer-parent/component-kitap/src/main/java/org/talend/sdk/component/singer/kitap/Kitap.java
…' into ouf/QTDI-3124-sonar-fixes

# Conflicts:
#	component-runtime-impl/src/test/java/org/talend/sdk/component/runtime/record/RecordBuilderImplTest.java
#	component-studio/component-runtime-di/src/test/java/org/talend/sdk/component/runtime/di/beam/components/DIBatchSimulationTest.java
#	component-studio/component-runtime-di/src/test/java/org/talend/sdk/component/runtime/di/beam/components/DIBulkAutoChunkTest.java
#	component-studio/component-runtime-di/src/test/java/org/talend/sdk/component/runtime/di/studio/DynamicColumnsTest.java
#	component-tools/src/test/java/org/talend/sdk/component/tools/SvgValidatorTest.java
…to ouf/QTDI-3124-sonar-fixes

# Conflicts:
#	component-studio/component-runtime-di/src/test/java/org/talend/sdk/component/runtime/di/schema/TaCoKitGuessSchemaTest.java
…to ouf/QTDI-3124-sonar-fixes

# Conflicts:
#	component-tools/src/main/java/org/talend/sdk/component/tools/AsciidoctorExecutor.java
@undx undx requested a review from Copilot June 26, 2026 09:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@undx undx changed the title Ouf/qtdi 3124 sonar fixes fix(QTDI-3124): [Refactoring] Merge sonar fixes Jun 26, 2026
@undx undx requested a review from Copilot June 29, 2026 14:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@undx undx requested a review from ozhelezniak-talend June 29, 2026 14:45
@ozhelezniak-talend

Copy link
Copy Markdown
Contributor

Hello @undx
Was this changes done by Static analyzer tool or by AI?

@sonar-rnd

sonar-rnd Bot commented Jul 1, 2026

Copy link
Copy Markdown

Failed Quality Gate failed

  • 0.00% Coverage on New Code (is less than 80.00%)
  • 138 New Issues (is greater than 0)

Project ID: org.talend.sdk.component:component-runtime

View in SonarQube

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants