{"id":13604434,"url":"https://github.com/insideapp-oss/sonar-apple","last_synced_at":"2025-04-12T02:30:38.671Z","repository":{"id":38385682,"uuid":"481563481","full_name":"insideapp-oss/sonar-apple","owner":"insideapp-oss","description":"SonarQube plugin for Swift / Objective-C","archived":false,"fork":false,"pushed_at":"2024-10-30T10:29:45.000Z","size":1130,"stargazers_count":98,"open_issues_count":4,"forks_count":2,"subscribers_count":7,"default_branch":"main","last_synced_at":"2024-10-30T11:29:41.907Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/insideapp-oss.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["insideapp-oss"]}},"created_at":"2022-04-14T10:33:20.000Z","updated_at":"2024-10-24T08:47:06.000Z","dependencies_parsed_at":"2024-01-16T23:30:03.439Z","dependency_job_id":"e77583cb-6cf6-41ef-a484-5087203c11bc","html_url":"https://github.com/insideapp-oss/sonar-apple","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/insideapp-oss%2Fsonar-apple","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/insideapp-oss%2Fsonar-apple/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/insideapp-oss%2Fsonar-apple/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/insideapp-oss%2Fsonar-apple/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/insideapp-oss","download_url":"https://codeload.github.com/insideapp-oss/sonar-apple/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223489538,"owners_count":17153778,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T19:00:45.583Z","updated_at":"2025-04-12T02:30:38.663Z","avatar_url":"https://github.com/insideapp-oss.png","language":"Java","funding_links":["https://github.com/sponsors/insideapp-oss"],"categories":["Java"],"sub_categories":[],"readme":"\n![CI](https://github.com/insideapp-oss/sonar-flutter/workflows/CI/badge.svg)\n\n[![Technical Debt](https://sonarcloud.io/api/project_badges/measure?project=insideapp-oss_sonar-apple\u0026metric=sqale_index)](https://sonarcloud.io/summary/new_code?id=insideapp-oss_sonar-apple)\n[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=insideapp-oss_sonar-apple\u0026metric=coverage)](https://sonarcloud.io/summary/new_code?id=insideapp-oss_sonar-apple)\n[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=insideapp-oss_sonar-apple\u0026metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=insideapp-oss_sonar-apple)\n[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=insideapp-oss_sonar-apple\u0026metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=insideapp-oss_sonar-apple)\n[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=insideapp-oss_sonar-apple\u0026metric=security_rating)](https://sonarcloud.io/summary/new_code?id=insideapp-oss_sonar-apple)\n\n\n# SonarQube plugin for Swift / Objective-C\n\nA plugin to enable analysis of Swift and Objective-C code quality and security.\n\nLet us know if you want to get involved.\n\n## Features\n\nThe plugin is designed to support Swift 5 syntax.\n\n| Feature             | Tool(s)           | Availability       |\n|---------------------|-------------------|--------------------|\n| Tests               | Xcode             | Swift, Objective-C |\n| Coverage            | Xcode             | Swift, Objective-C |\n| Complexity          | SonarQube         | Swift, Objective-C |\n| Dead code           | Periphery         | Swift              |\n| Size                | SonarQube         | Swift, Objective-C |\n| Syntax highlighting | SonarQube         | Swift, Objective-C |\n| Issues              | SwiftLint, OCLint | Swift, Objective-C |\n| Security            | mobsfscan         | Swift, Objective-C |\n\n## Installation\n\n### Server-side\n\nSonarQube 9.9+ is required.\n\n- Download the plugin binary into the ``$SONARQUBE_HOME/extensions/plugins`` directory.\n- Restart the server.\n- Activate the rules in your Quality Profiles.\n\n### Client-side\n\nXcode 13+ and SonarScanner are required.\nThe following tools are optional:\n\n- [SwiftLint](https://github.com/realm/SwiftLint)\n- [OCLint](https://oclint.org/)\n- [mobsfscan](https://github.com/MobSF/mobsfscan)\n- [Periphery](https://github.com/peripheryapp/periphery)\n\n#### Sonar configuration\n\nCreate a ``sonar-project.properties`` file at the root with this content:\n\n```properties\n# Project identification\nsonar.projectKey=ios_app\nsonar.projectName=iOS App\nsonar.projectVersion=1.0\n\t\n# Source code location.\n# Path is relative to the sonar-project.properties file. Defaults to .\n# Use commas to specify more than one folder.\nsonar.sources=iOSApp\n# Tests source code location.\n# Path is relative to the sonar-project.properties file. Defaults to empty.\n# Use commas to specify more than one folder.\nsonar.tests=iOSAppTests\n\n## Coverage \u0026 Tests ##\n\n# Path to the Xcode result bundle file. \n# The path is relative to the project base directory.\n# Defaults to build/result.xcresult\n#sonar.apple.resultBundlePath=custom/path/to/file.xcresult\n\n## Periphery ##\n\n# Index Store folder path.\n# This matches the parameter \"-derivedDataPath\" in xcodebuild (see below).\n# Warning: starting Xcode 14 the folder \"Index\" is renamed \"Index.noindex\".\nsonar.apple.periphery.indexStorePath=derivedData/Index/DataStore\n\n## OCLint ##\n\n# Path to the JSON Compilation Database folder\n# The path is relative to the project base directory.\n# Defaults to build/json_compilation_database\n# sonar.apple.jsonCompilationDatabasePath=custom/path/to/folder\n\n## Misc ##\n\n# Encoding of the source code. Default is default system encoding.\nsonar.sourceEncoding=UTF-8\n```\n\nFor a complete list of available options, please refer to the [SonarQube documentation](https://docs.sonarqube.org/latest/analysis/analysis-parameters/).\n\n#### Run analysis\n\nUse the following commands from the root folder to start an analysis:\n\n```bash\n# Don't forget to add -workspace to the build command if your project is part of a workspace\n# Don't forget to activate 'Gather coverage' option in the app scheme or add '-enableCodeCoverage YES' to the following command\n\n# Run tests \nxcrun xcodebuild \\\n  -project MyApp.xcodeproj \\\n  -scheme MyApp \\\n  -sdk iphonesimulator \\\n  -destination 'platform=iOS Simulator,name=iPhone 11 Pro' \\\n  -derivedDataPath ./derivedData \\\n  -resultBundlePath build/result.xcresult \\\n  OTHER_CFLAGS=\"\\$(inherited) -gen-cdb-fragment-path build/compilation_database\" \\\n  -quiet \\\n  clean test\n\n# Run the analysis and publish to the SonarQube server\n# Don't forget to specify `sonar.host.url` and `sonar.token` in `sonar-project.properties` or supply it to the following command.\nsonar-scanner\n```\n\n### Advanced configuration\n\n#### Periphery\n\nThe plugin assumes the Periphery configuration is properly settled for your project, in the [Periphery configuration file](https://github.com/peripheryapp/periphery#configuration).\nThe required information are the project, the schemes and the targets. You also need to provide the workspace, if you have one.\n```yaml\nworkspace: path/to/workspace.xcworkspace # optional\nproject: path/to/project.xcodeproj\nschemes:\n  - MyScheme\ntargets:\n  - MyTarget\n```\n\n#### OCLint\n\nOn macOS, the system will block usage of OCLint. In order to get rid of the manual verification of each of them, use the following commands:\n\n```bash\nsudo xattr -dr com.apple.quarantine /usr/local/lib/oclint/rules/lib*\nsudo xattr -dr com.apple.quarantine /usr/local/lib/oclint/reporters/lib*\n```\n\n#### Sonar Scanner\n\nIf you have trouble running the Sonar Scanner, you can run it in verbose mode, to get more logs and information.\nYou can either:\n- add `sonar.verbose=true` to your `sonar-project.properties`\n- add the option `X` to the command, like so: `sonar-scanner -X ...`\n\n## Contributing\n\nAny help is welcome, and PRs will be greatly appreciated!\n\nHave a look at the [developer guide](https://github.com/insideapp-oss/sonar-apple/blob/main/DEVELOP.md) to get started.\n\n## License\n\nThis plugin is released under the GNU LGPL v3 license. See the [LICENSE](https://github.com/insideapp-oss/sonar-apple/blob/main/LICENSE.md) file for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finsideapp-oss%2Fsonar-apple","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finsideapp-oss%2Fsonar-apple","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finsideapp-oss%2Fsonar-apple/lists"}