Skip to content

Conversation

@rm3l
Copy link
Member

@rm3l rm3l commented Jan 12, 2026

Description

Exclude testdata from SonarCloud analysis

Which issue(s) does this PR fix or relate to

Fixes the warnings reported in #2067 (comment)

PR acceptance criteria

  • Tests
  • Documentation

How to test changes / Special notes to the reviewer

@openshift-ci
Copy link

openshift-ci bot commented Jan 12, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign nickboldt for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@rhdh-qodo-merge
Copy link

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
🔒 No security concerns identified
⚡ Recommended focus areas for review

Scope Overlap

Adding **/testdata/**/* to both sonar.test.inclusions and sonar.exclusions may create ambiguous classification or effectively exclude those files from both source and test scopes depending on SonarCloud precedence. Confirm the intended outcome (fully excluded from analysis vs treated as tests) and adjust patterns accordingly.

sonar.test.inclusions = tests/**/*, integration_tests/**/*, **/*_test.go, **/testdata/**/*

# Exclude test subdirectories from source scope
sonar.exclusions = tests/**/*, integration_tests/**/*, **/*_test.go, **/zz_generated.deepcopy.go, **/testdata/**/*
Exclusion Breadth

The glob **/testdata/**/* excludes any directory named testdata anywhere in the repo. Validate that this won’t hide relevant non-test fixtures or embedded assets that should still be analyzed, and consider narrowing the pattern if needed (e.g., only under specific modules).

sonar.test.inclusions = tests/**/*, integration_tests/**/*, **/*_test.go, **/testdata/**/*

# Exclude test subdirectories from source scope
sonar.exclusions = tests/**/*, integration_tests/**/*, **/*_test.go, **/zz_generated.deepcopy.go, **/testdata/**/*
📄 References
  1. redhat-developer/rhdh-operator/Makefile [210-211]
  2. redhat-developer/rhdh-operator/best_practices.md [116-165]
  3. redhat-developer/rhdh-operator/docs/developer.md [20-31]
  4. redhat-developer/rhdh-operator/integration_tests/README.md [1-46]
  5. redhat-developer/rhdh-operator/tests/e2e/README.md [1-12]
  6. redhat-developer/rhdh-operator/docs/developer.md [32-55]
  7. redhat-developer/rhdh-operator/README.md [78-84]
  8. redhat-developer/rhdh-operator/tests/e2e/README.md [112-122]

@sonarqubecloud
Copy link

@rhdh-qodo-merge rhdh-qodo-merge bot added Review effort 1/5 enhancement New feature or request labels Jan 12, 2026
@rhdh-qodo-merge
Copy link

PR Type

Enhancement


Description

  • Exclude testdata directories from SonarCloud analysis

  • Add testdata to both test inclusions and exclusions patterns

  • Prevents SonarCloud warnings from test data files


File Walkthrough

Relevant files
Configuration changes
.sonarcloud.properties
Add testdata exclusion patterns to SonarCloud config         

.sonarcloud.properties

  • Added **/testdata/**/* pattern to sonar.test.inclusions to include
    testdata in test scope
  • Added **/testdata/**/* pattern to sonar.exclusions to exclude testdata
    from source scope
  • Prevents SonarCloud from analyzing test data files as production code
+2/-2     

@rhdh-qodo-merge
Copy link

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
General
Remove contradictory test data inclusion rule

Remove the /testdata//* pattern from sonar.test.inclusions to resolve the
contradiction of also having it in sonar.exclusions.

.sonarcloud.properties [6]

-sonar.test.inclusions = tests/**/*, integration_tests/**/*, **/*_test.go, **/testdata/**/*
+sonar.test.inclusions = tests/**/*, integration_tests/**/*, **/*_test.go
  • Apply / Chat
Suggestion importance[1-10]: 5

__

Why: The suggestion correctly identifies a contradictory configuration where testdata is both included as a test source and excluded from analysis, which improves configuration clarity.

Low
  • More

@rm3l
Copy link
Member Author

rm3l commented Jan 12, 2026

/cc @gazarenkov

@openshift-ci openshift-ci bot requested a review from gazarenkov January 12, 2026 09:17
Copy link
Member Author

@rm3l rm3l left a comment

Choose a reason for hiding this comment

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

Merging to see the results in SonarCloud.

@rm3l rm3l merged commit f6f8319 into main Jan 16, 2026
8 of 9 checks passed
@rm3l rm3l deleted the chore/exclude-testdata-sonarcloud branch January 16, 2026 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request Review effort 1/5

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant