Skip to content

RUM-16478: UnsafeThirdPartyFunctionCall improvements#3557

Open
satween wants to merge 1 commit into
developfrom
tvaleev/feature/RUM-16478
Open

RUM-16478: UnsafeThirdPartyFunctionCall improvements#3557
satween wants to merge 1 commit into
developfrom
tvaleev/feature/RUM-16478

Conversation

@satween

@satween satween commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

  • Adds generics support for the UnsafeThirdPartyFunctionCall detekt rule. * means any non-null type, ? means any nullable type.
  • Adds configuration self-checks: verifies that all records in each config are unique.
  • Adds configuration self-checks: prevents the same method from being added to controversial (safe and unsafe) configs at the same time.
  • UnsafeThirdPartyFunctionCall is now divided into three subclasses: CodeParser for Kotlin code parsing, and DetektConfigValidator and DetektConfigParser for YAML config parsing and validation.
  • detekt_custom_unsafe_calls.yml and detekt_custom_safe_calls.yml have been cleaned up according to the new rules.

Motivation

An approach to reduce time to green build for each ticket. Fewer retries means less time and lower resource consumption.

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)

@satween satween requested review from a team as code owners June 18, 2026 16:16
@codecov-commenter

codecov-commenter commented Jun 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.56%. Comparing base (c6e8fe9) to head (19360e7).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3557      +/-   ##
===========================================
+ Coverage    72.52%   72.56%   +0.04%     
===========================================
  Files          978      978              
  Lines        36052    36045       -7     
  Branches      6038     6040       +2     
===========================================
+ Hits         26146    26155       +9     
+ Misses        8234     8220      -14     
+ Partials      1672     1670       -2     
Files with missing lines Coverage Δ
...lin/com/datadog/android/rum/resource/ContextExt.kt 83.33% <ø> (ø)

... and 36 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hamorillo hamorillo 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.

Looks good to me. Just leaving a question before approving.

@sbarrio sbarrio requested review from hamorillo and jonathanmos June 19, 2026 12:58
Comment thread detekt_custom_unsafe_calls.yml Outdated
Comment thread detekt_custom_unsafe_calls.yml Outdated
Comment thread detekt_custom_unsafe_calls.yml Outdated
Comment thread detekt_custom_unsafe_calls.yml Outdated
Comment thread detekt_custom_unsafe_calls.yml
Comment thread detekt_custom_unsafe_calls.yml
Add validateSortedWithinClasses to DetektConfigValidator so knownSafeCalls
and knownThrowingCalls entries must be in alphabetical order within each
class group; sort both YAML config files accordingly.
Adds wildcard support and overlap detection to the rule, and splits it into focused modules.

Wildcards: YAML entries in knownSafeCalls/knownThrowingCalls now accept per-parameter wildcards — * (any non-nullable type) and ? (any nullable type). Valid only at generic parameter positions; misuse throws IllegalStateException.

Overlap detection: Rejects entries that are both safe and throwing, and catches duplicate/overlapping patterns within each list. Removed 17 pre-existing duplicates plus two genuine conflicts (Thread.interrupt(), Array.first(Function1)).

Config cleanup: Collapsed repeated generic-parameter entries to wildcards across safe-calls and detekt configs.

Refactor: RulesParser (YAML parsing), CodeParser (call-expression extraction), WildcardPattern (matching + validation); the rule now keeps only visitor wiring and the safe/throwing/unknown decision.
@satween satween force-pushed the tvaleev/feature/RUM-16478 branch from af9aead to 19360e7 Compare June 26, 2026 15:12

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 19360e721c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread detekt_custom_unsafe_calls.yml
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.

5 participants