Skip to content

Feature/sonarqube coverage#12

Closed
mattinannt wants to merge 2 commits intomainfrom
feature/sonarqube-coverage
Closed

Feature/sonarqube coverage#12
mattinannt wants to merge 2 commits intomainfrom
feature/sonarqube-coverage

Conversation

@mattinannt
Copy link
Member

This pull request introduces several enhancements and fixes to the Formbricks SDK, focusing on improving functionality, test coverage, and maintainability. The changes include adding a SonarQube workflow for code quality analysis, enabling support for pre-initialization SDK operations, introducing dependency injection for the SurveyManager, and improving test coverage with mock data and updated test cases.

New Features and Enhancements:

  • SonarQube Workflow: Added a GitHub Actions workflow (.github/workflows/sonarqube.yml) to integrate SonarQube for code quality analysis, including steps for building, testing, and uploading coverage reports.
  • Pre-Initialization Support: Updated the setLanguage method in Formbricks.swift to allow it to be called before SDK initialization, improving flexibility.

Codebase Improvements:

  • Dependency Injection: Refactored SurveyManager to support dependency injection via a FormbricksServiceProtocol, making it easier to mock services in tests. [1] [2]
  • Simplified URL Construction: Simplified URL generation in FormbricksEnvironment.swift by replacing URL manipulation with string concatenation.

Testing Enhancements:

  • Mock Data for Tests: Added mock JSON files (Mock/User.json, Mock/Environment.json) to support unit tests. [1] [2]
  • Improved Test Cases: Enhanced test coverage in FormbricksSDKTests.swift by adding setup and teardown methods, testing pre-initialization behavior, and validating asynchronous operations with expectations. [1] [2] [3]

Debugging Additions:

  • Debug Logs: Added debug print statements in SurveyManager and APIClient for easier troubleshooting during development. [1] [2]

@sonarqubecloud
Copy link

@mattinannt mattinannt closed this May 15, 2025
@mattinannt mattinannt deleted the feature/sonarqube-coverage branch May 15, 2025 12:45
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.

1 participant