Skip to content

chore: cleanup unused types and move anys to src/types - #4258

Merged
vinayteki95 merged 3 commits into
developfrom
chore.cleanup-unused-types
May 5, 2025
Merged

vinayteki95 merged 3 commits into
developfrom
chore.cleanup-unused-types

Conversation

@vinayteki95

Copy link
Copy Markdown
Contributor

What are the changes introduced in this PR?

  • Clean up of unused types
  • Moved any based types into src/types

What is the related Linear task?

Resolves INT-3539

Please explain the objectives of your changes below

Put down any required details on the broader aspect of your changes. If there are any dependent changes, mandatorily mention them here

Any changes to existing capabilities/behaviour, mention the reason & what are the changes ?

N/A

Any new dependencies introduced with this change?

N/A

Any new generic utility introduced or modified. Please explain the changes.

N/A

Any technical or performance related pointers to consider with the change?

N/A

@coderabbitai review


Developer checklist

  • My code follows the style guidelines of this project

  • No breaking changes are being introduced.

  • All related docs linked with the PR?

  • All changes manually tested?

  • Any documentation changes needed with this change?

  • Is the PR limited to 10 file changes?

  • Is the PR limited to one linear task?

  • Are relevant unit and component test-cases added in new readability format?

Reviewer checklist

  • Is the type of change in the PR title appropriate as per the changes?

  • Verified that there are no credentials or confidential data exposed with the changes.

@vinayteki95
vinayteki95 requested review from a team and sivashanmukh as code owners April 16, 2025 16:31
@vinayteki95
vinayteki95 requested review from a team, chandumlg and manish339k April 16, 2025 16:31
@coderabbitai

coderabbitai Bot commented Apr 16, 2025 •

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Refactor
    • Streamlined and consolidated type imports across multiple files for improved consistency and maintainability.
    • Removed redundant type definitions and centralized type aliases for easier management.
  • Chores
    • Deleted an obsolete utility types file to reduce duplication.
    • Added and exported type aliases in a central location for clarity.

Summary by CodeRabbit

  • Refactor

    • Improved organization of type imports across multiple files for greater consistency and simplicity.
    • Centralized commonly used type definitions by moving them to a single shared location.
    • Removed redundant type definition file to streamline codebase.
  • New Features

    • Added new type aliases to the shared types module to support consistent type usage across the application.

Walkthrough

This update centralizes and consolidates the type definitions for FixMe and CatchErr by moving them from the now-deleted src/util/types.ts to src/types/index.ts. All relevant import statements throughout the codebase have been updated to reference the new, unified location. Additionally, some import statements were reorganized for clarity and simplicity, merging multiple imports from different modules into single statements where appropriate. No changes were made to the logic, control flow, or public API of any modules; all modifications are limited to type organization and import path adjustments.

Changes

File(s) Change Summary
src/util/types.ts Deleted the file, removing type aliases (FixMe, CatchErr, ContextBodySimple) and interfaces (Config, IDestDefinition).
src/types/index.ts Added exported type aliases: FixMe and CatchErr (any).
src/cdk/v2/handler.ts
src/cdk/v2/utils.ts
src/controllers/eventTest.ts
src/services/eventTest/eventTester.ts
src/services/profile.ts
Updated import paths for FixMe and/or CatchErr from ../util/types to ../types. No logic changes.
src/controllers/delivery.ts
src/controllers/regulation.ts
src/helpers/serviceSelector.ts
src/services/destination/cdkV2Integration.ts
src/services/destination/postTransformation.ts
src/services/source/nativeIntegration.ts
src/services/source/postTransformation.ts
src/util/dynamicConfigParser.ts
Consolidated and simplified import statements for types, merging separate imports into single statements from ../types. Import paths for FixMe and/or CatchErr updated accordingly.
src/services/userTransform.ts Changed import source for FixMe and CatchErr from ../util/types to ../types; moved ESLint disable comment inline. No logic changes.
src/types/sourceTransformation.ts
src/types/userRegulation.ts
src/types/userTransformation.ts
Updated import paths for FixMe and/or CatchErr to reference ./index instead of ../util/types. No logic or type changes.

Sequence Diagram(s)

Not applicable: The changes are limited to type organization and import path updates, without affecting control flow or feature logic.


Suggestions for Improvement

  • Type Safety: Consider replacing the any type for FixMe and CatchErr with more descriptive or restrictive types to improve type safety and maintainability.
  • Documentation: Document the purpose and intended use cases for FixMe and CatchErr in src/types/index.ts to guide future contributors.
  • Type Cleanup: Review the codebase for any lingering usages of broad types like FixMe and gradually refactor them to more specific types as the codebase matures.
  • Automated Linting: Implement or update linting rules to prevent the proliferation of overly generic type aliases, encouraging more precise typings where feasible.

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d41d72e and 8ae3b99.

📒 Files selected for processing (1)
  • src/util/dynamicConfigParser.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/util/dynamicConfigParser.ts
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: Build User Transformer Docker Image - PR / Build Transformer Docker Image AMD64
  • GitHub Check: Build Transformer Docker Image - PR / Build Transformer Docker Image ARM64
  • GitHub Check: Build Transformer Docker Image - PR / Build Transformer Docker Image AMD64
  • GitHub Check: Code Coverage
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: UT Tests
  • GitHub Check: test_and_publish
  • GitHub Check: Analyze (go)
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@vinayteki95
vinayteki95 requested review from krishna2020 and utsabc and removed request for chandumlg and manish339k April 16, 2025 16:32

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 0

🧹 Nitpick comments (2)
src/types/index.ts (1)

8-10: Type exports are appropriately relocated.

The FixMe and CatchErr type aliases have been properly moved from the now-deleted src/util/types.ts to this centralized location, which aligns with the PR's objective of consolidating types and improving organization.

While this change is correct, consider adding JSDoc comments to these type aliases to explain their purpose and encourage eventual replacement with more specific types where possible:

+/**
+ * Temporary type alias for untyped values. 
+ * TODO: Replace with specific types where possible
+ */
 export type FixMe = any;
+/**
+ * Temporary type alias for untyped error handling.
+ * TODO: Replace with specific error types where possible
+ */
 export type CatchErr = any;
src/services/userTransform.ts (1)

12-15: Import source correctly updated to reflect type centralization

The import for FixMe and CatchErr types has been appropriately updated to use the new centralized location (../types instead of the previous ../util/types). This change aligns with the PR objective of consolidating type definitions.

However, I notice the ESLint disable comment is preserved for the CatchErr type even though it appears to be used in catch blocks at lines 153 and 243. Consider verifying if this ESLint exception is still needed.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f85e8ae and d41d72e.

📒 Files selected for processing (19)
  • src/cdk/v2/handler.ts (1 hunks)
  • src/cdk/v2/utils.ts (1 hunks)
  • src/controllers/delivery.ts (1 hunks)
  • src/controllers/eventTest.ts (1 hunks)
  • src/controllers/regulation.ts (1 hunks)
  • src/helpers/serviceSelector.ts (1 hunks)
  • src/services/destination/cdkV2Integration.ts (1 hunks)
  • src/services/destination/postTransformation.ts (1 hunks)
  • src/services/eventTest/eventTester.ts (1 hunks)
  • src/services/profile.ts (1 hunks)
  • src/services/source/nativeIntegration.ts (1 hunks)
  • src/services/source/postTransformation.ts (1 hunks)
  • src/services/userTransform.ts (1 hunks)
  • src/types/index.ts (1 hunks)
  • src/types/sourceTransformation.ts (1 hunks)
  • src/types/userRegulation.ts (1 hunks)
  • src/types/userTransformation.ts (1 hunks)
  • src/util/dynamicConfigParser.ts (1 hunks)
  • src/util/types.ts (0 hunks)
💤 Files with no reviewable changes (1)
  • src/util/types.ts
⏰ Context from checks skipped due to timeout of 90000ms (9)
  • GitHub Check: Build Transformer Docker Image - PR / Build Transformer Docker Image AMD64
  • GitHub Check: Build User Transformer Docker Image - PR / Build Transformer Docker Image ARM64
  • GitHub Check: Build User Transformer Docker Image - PR / Build Transformer Docker Image AMD64
  • GitHub Check: Code Coverage
  • GitHub Check: UT Tests
  • GitHub Check: ingestion-service-test
  • GitHub Check: test_and_publish
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (go)
🔇 Additional comments (16)
src/services/profile.ts (1)

11-11: Import path update for CatchErr is appropriate.

The change to import CatchErr from the centralized ../types module is correct and aligns with the project's type organization strategy. This enhances maintainability and clarity in the codebase.

src/cdk/v2/handler.ts (1)

8-8: Centralized import for FixMe improves maintainability.

Switching the import path for FixMe to the unified ../../types module is a positive step for type management and code clarity.

src/cdk/v2/utils.ts (1)

8-8: Import path for CatchErr updated for consistency.

The update to import CatchErr from the centralized ../../types module is consistent with the project's refactoring goals and enhances codebase organization.

src/controllers/eventTest.ts (1)

4-4: Type import path update is well executed.

Importing CatchErr and FixMe from the centralized ../types module streamlines type management and supports a cleaner codebase.

src/types/userRegulation.ts (1)

1-1: Import path for FixMe is now consistent with type centralization.

This update ensures that FixMe is imported from the correct, centralized location, supporting better type management across the codebase.

src/types/userTransformation.ts (1)

1-1: Import path updated correctly.

The import path for CatchErr has been updated from '../util/types' to './index' which aligns with the centralization of type definitions in the src/types directory.

src/types/sourceTransformation.ts (1)

1-1: Import path updated appropriately.

The import path for CatchErr has been correctly updated from '../util/types' to './index' as part of centralizing type definitions in the types directory.

src/services/eventTest/eventTester.ts (1)

2-2: Import path changed to use centralized types.

The import path for FixMe has been properly updated from '../../util/types' to '../../types' to align with the centralization of type definitions.

src/services/destination/cdkV2Integration.ts (1)

19-20: Type import consolidated appropriately.

The CatchErr type has been added to the existing import statement from '../../types', which improves code organization by consolidating related imports into a single statement.

src/services/destination/postTransformation.ts (1)

6-17: Import refactoring looks good.

The import changes maintain compatibility while improving organization by sourcing the FixMe type from the centralized types directory instead of the util directory. This aligns with the PR objective of consolidating type definitions.

src/services/source/postTransformation.ts (1)

1-7: Import restructuring looks good.

The change correctly updates the import path for CatchErr from the now centralized types location, maintaining consistency with other files in the codebase while preserving functionality.

src/util/dynamicConfigParser.ts (1)

2-2: Import consolidation is well implemented.

The change improves code organization by consolidating multiple imports into a single statement while correctly updating the import path for FixMe to point to the centralized types directory.

src/controllers/regulation.ts (1)

5-6: Import organization looks good.

The consolidation of types into a single import from ../types and repositioning of the tags import creates cleaner, more maintainable code.

src/controllers/delivery.ts (1)

9-16: Import consolidation is appropriate.

The addition of FixMe to the existing types import statement from ../types aligns with the PR objective of centralizing type definitions.

src/services/source/nativeIntegration.ts (1)

4-12: Type import consolidation looks good.

The inclusion of FixMe with other types imported from ../../types follows the project's new pattern for type management, making imports more consistent.

src/helpers/serviceSelector.ts (1)

9-9: Import statement consolidation is well-structured.

The merged import statement brings together all type imports from a single source, which improves code organization and maintainability.

@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@codecov

codecov Bot commented Apr 16, 2025 •

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.32%. Comparing base (79cebfc) to head (8ae3b99).
Report is 27 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4258      +/-   ##
===========================================
+ Coverage    91.21%   91.32%   +0.10%     
===========================================
  Files          632      636       +4     
  Lines        33053    33376     +323     
  Branches      7827     7892      +65     
===========================================
+ Hits         30150    30481     +331     
- Misses        2658     2680      +22     
+ Partials       245      215      -30     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

except for the point about other unused types in src/util I am good with the changes.

LGTM

Comment thread src/util/types.ts Resolved
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@sonarqubecloud

sonarqubecloud Bot commented May 5, 2025

Copy link
Copy Markdown

@vinayteki95
vinayteki95 merged commit 3425086 into develop May 5, 2025
@vinayteki95
vinayteki95 deleted the chore.cleanup-unused-types branch May 5, 2025 07:25
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.

6 participants