{"id":13553041,"url":"https://github.com/insideapp-oss/sonar-flutter","last_synced_at":"2025-04-03T04:31:56.094Z","repository":{"id":37449976,"uuid":"235879795","full_name":"insideapp-oss/sonar-flutter","owner":"insideapp-oss","description":"SonarQube plugin for Flutter / Dart","archived":false,"fork":false,"pushed_at":"2024-10-23T19:55:22.000Z","size":1426,"stargazers_count":445,"open_issues_count":8,"forks_count":83,"subscribers_count":15,"default_branch":"master","last_synced_at":"2024-11-04T00:32:49.123Z","etag":null,"topics":["code-analysis","coverage","dart","dartanalyzer","flutter","sonarqube","sonarqube-plugin","technical-debt","tests"],"latest_commit_sha":null,"homepage":"","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":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2020-01-23T20:25:47.000Z","updated_at":"2024-11-03T06:15:03.000Z","dependencies_parsed_at":"2024-08-01T12:22:01.657Z","dependency_job_id":"aa99570d-e2e3-4d6d-b959-f216bc3e1f3f","html_url":"https://github.com/insideapp-oss/sonar-flutter","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/insideapp-oss%2Fsonar-flutter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/insideapp-oss%2Fsonar-flutter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/insideapp-oss%2Fsonar-flutter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/insideapp-oss%2Fsonar-flutter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/insideapp-oss","download_url":"https://codeload.github.com/insideapp-oss/sonar-flutter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246939195,"owners_count":20857916,"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":["code-analysis","coverage","dart","dartanalyzer","flutter","sonarqube","sonarqube-plugin","technical-debt","tests"],"created_at":"2024-08-01T12:02:16.124Z","updated_at":"2025-04-03T04:31:51.084Z","avatar_url":"https://github.com/insideapp-oss.png","language":"Java","readme":"![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-flutter\u0026metric=sqale_index)](https://sonarcloud.io/summary/new_code?id=insideapp-oss_sonar-flutter)\n[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=insideapp-oss_sonar-flutter\u0026metric=coverage)](https://sonarcloud.io/summary/new_code?id=insideapp-oss_sonar-flutter)\n[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=insideapp-oss_sonar-flutter\u0026metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=insideapp-oss_sonar-flutter)\n[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=insideapp-oss_sonar-flutter\u0026metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=insideapp-oss_sonar-flutter)\n[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=insideapp-oss_sonar-flutter\u0026metric=security_rating)](https://sonarcloud.io/summary/new_code?id=insideapp-oss_sonar-flutter)\n\n\n# SonarQube plugin for Flutter / Dart\n\nA plugin to enable analysis of Dart and Flutter projects into SonarQube.\n\n\u003cp style=\"text-align: center\"\u003e\n\t\u003cimg src=\"screenshots/main.png\" alt=\"main.png\" width=\"80%\"/\u003e\n\u003c/p\u003e\n\n## Features\n\n| Feature    | Supported                                                       |\n|------------|-----------------------------------------------------------------|\n| Size       | YES                                                             |\n| Issues     | YES ([dartanalyzer](https://dart.dev/tools/dartanalyzer) rules) |\n| Tests      | YES                                                             |\n| Coverage   | YES                                                             |\n| Complexity | YES                                                             |\n| Syntax     | YES                                                             |\n\nThe plugin is compatible with sonarQube 7.9+.\n\n## Download\n\nCheckout the [Releases](https://github.com/insideapp-oss/sonar-flutter/releases) page.\n\nChangelog is available [here](https://github.com/insideapp-oss/sonar-flutter/blob/develop/CHANGELOG.md).\n\n## Prerequisites\n\n### Flutter SDK (when analyzing a Flutter project)\n\nInstall Flutter as explained on the official documentation page.\n\n[Flutter Installation instructions](https://flutter.dev/docs/get-started/install)\n\n### Dart\n\nDart is downloaded by the Flutter SDK in **$FLUTTER_HOME/bin/cache/dart-sdk**, however command lines are not on the path by default (dart must be on the path).\n\nIt is recommended to install Dart SDK separately as explained here : [Install the Dart SDK](https://dart.dev/get-dart) for more reliability in a CI/CD environment.\n\n### sonar-scanner (requires Java)\n\nInstall sonar-scanner as explained in the official documentation.\n\n[Installation instructions](https://docs.sonarqube.org/latest/analysis/scan/sonarscanner/)\n\n\n## Installation (on the server)\n\n- Download the plugin binary into the **$SONARQUBE_HOME/extensions/plugins** directory.\n- Restart the server.\n\n## Project configuration\n\nCreate a **sonar-project.properties** file at the root with this content :\n\n```properties\n# Project identification\nsonar.projectKey=flutter_rocks\nsonar.projectName=Flutter Rocks\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 file/folder.\n# It is good practice to add pubspec.yaml to the sources as the analyzer\n# may produce warnings for this file as well.\nsonar.sources=lib,pubspec.yaml\nsonar.tests=test\n\n# Encoding of the source code. Default is default system encoding.\nsonar.sourceEncoding=UTF-8\n\n# Analyzer mode\n# Can be:\n# - DETECT (attempt to detect automatically) - default\n# - MANUAL (an existing report needs to be provided)\n# - FLUTTER (flutter analyze)\n# - DART (dart analyze)\n# - DARTANALYZER (dartanalyzer)\n# sonar.dart.analyzer.mode= \n\n# Allows reuse of an existing analyzer report when mode is MANUAL\n# sonar.dart.analyzer.report.path=\n\n# Analyzer report output mode\n# Can be:\n# - DETECT (attempt to detect automatically, requires Dart SDK on the PATH) - default\n# - MACHINE (a new machine readable output that is available for Dart 2.12+)\n# - LEGACY (attempts to parse human readable output from dart/flutter) - default\n# sonar.dart.analyzer.report.mode= \n```\n\n*For a complete list of available options, please refer to the [SonarQube documentation](https://docs.sonarqube.org/latest/analysis/analysis-parameters/).*\n\n### Use existing analysis options\n\nThe plugin uses its own analysis options file.\nIf `analysis_options.yaml` file already exists under the project root, it will be saved during the analysis and then restored to its initial state.\n\nTo disable this behavior and use the existing`analysis_options.yaml` file instead, add the following line to `sonar-project.properties` file :\n\n```\n# Use existing options to perform dartanalyzer analysis\nsonar.dart.analyzer.options.override=true\n```\n\n### Multi-module sample\n\nIt is possible to analyze a project with multiple modules. For example a Dart generator library with an example.\n\n```properties\nsonar.projectKey=mylib\nsonar.sourceEncoding=UTF-8\n\nsonar.modules=mylib,mylib_generator,example\n\n# mylib\nmylib.sonar.sources=lib,pubspec.yaml\nmylib.sonar.dart.analyzer.mode=MANUAL\nmylib.sonar.dart.analyzer.report.mode=LEGACY\nmylib.sonar.dart.analyzer.report.path=build/reports/analysis-results.txt\n\n# mylib_generator\nmylib_generator.sonar.sources=lib,pubspec.yaml\nmylib_generator.sonar.dart.analyzer.options.override=false\nmylib_generator.sonar.dart.analyzer.mode=MANUAL\nmylib_generator.sonar.dart.analyzer.report.mode=MACHINE\nmylib_generator.sonar.dart.analyzer.report.path=build/reports/analysis-results.txt\n\n# example\nexample.sonar.sources=lib,pubspec.yaml\nexample.sonar.tests=test\nexample.sonar.exclusions=**/*/*.g.dart\nexample.sonar.dart.analyzer.options.override=false\nexample.sonar.dart.analyzer.mode=MANUAL\nexample.sonar.dart.analyzer.report.mode=LEGACY\nexample.sonar.dart.analyzer.report.path=build/reports/analysis-results.txt\n```\n\n## Run analysis\n\nUse the following commands from the root folder to start an analysis: \n\n```console\n# Download dependencies \nflutter pub get \n# Run tests with User feedback (in case some test are failing)\nflutter test\n# Run tests without user feedback regeneration tests.output and coverage/lcov.info\nflutter test --machine --coverage \u003e tests.output \n\n# Run the analysis and publish to the SonarQube server\nsonar-scanner\n```\n\n## Using `dart_test.yaml`\n\nDart/Flutter support the use of a `dart_test.yaml` file to configure test behavior.\nThis file can be used to configure the test output format and location. More information can be found [here](https://github.com/dart-lang/test/blob/master/pkgs/test/doc/configuration.md).\n\n```yaml\nfile_reporters:\n  json: build/reports/test-results.json\n```\n\nWith this, it is no longer use the `--machine` switch or redirect the output.\nIt is currently not possible to configure the coverage out in this file.\nYou may follow and upvote these related issue if interested:\n* Configuration option - https://github.com/dart-lang/test/issues/1361\n* Dart coverage support - https://github.com/dart-lang/test/issues/1265\n\n\n## Available options\n\nAll options are configurable in the SonarQube UI, via `sonar-project.properties` or `-D` parameters.\n\n| Name                                   | Options                                                                  | Default              | Description                                                                                                                                                                                                                                                                                         |\n|----------------------------------------|--------------------------------------------------------------------------|----------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `sonar.dart.analyzer.mode`             | \u003ccode\u003eDETECT\u0026#124;DART\u0026#124;FLUTTER\u0026#124;MANUAL\u0026#124;DARTANALYZER\u003c/code\u003e | `DETECT`             | By default the plugin attempts to detect a fitting analyzer (`flutter analyze` or `dart analyze`) by parsing the `environment` from `pubspec.yaml`. This can be set to `MANUAL` to provide and existing report file. For compatibility with older Dart versions, this can be set to `DARTANALYZER`. |\n| `sonar.dart.analyzer.options.override` | \u003ccode\u003etrue\u0026#124;false\u003c/code\u003e                                             | `true`               | By default any local `analysis_options.yaml` will be replaced for the analysis. This can be prevented by setting this to `false`.                                                                                                                                                                   |\n| `sonar.dart.analyzer.report.mode`      | \u003ccode\u003eDETECT\u0026#124;MACHINE\u0026#124;LEGACY\u003c/code\u003e                             | `DETECT`             | The new machine readable output can be automatically detected if Dart SDK is available on the $PATH.                                                                                                                                                                                                |\n| `sonar.dart.analyzer.report.path`      | A file path                                                              | -                    | This is required if the analyzer mode is set to `MANUAL`.                                                                                                                                                                                                                                           |\n| `sonar.flutter.tests.reportPath`       | Comma separated list of file paths (wildcard not supported)              | `tests.output`       | The path to the test report JSON file.                                                                                                                                                                                                                                                              |\n| `sonar.flutter.coverage.reportPath`    | A file path                                                              | `coverage/lcov.info` | The path to the test coverage file in LCOV format.                                                                                                                                                                                                                                                  |\n\n\n## Contributing\n\nAny help is welcome, and PRs will be greatly appreciated!\n\nPlease read [CONTRIBUTING](https://github.com/insideapp-oss/sonar-flutter/blob/develop/CONTRIBUTING.md) for more information.\n\n\n## License\n\nSonarQube Plugin for Flutter / Dart is released under the GNU LGPL v3 license. See the [LICENSE](https://github.com/insideapp-oss/sonar-flutter/blob/develop/LICENSE) file for more information.\n","funding_links":["https://github.com/sponsors/insideapp-oss"],"categories":["Java"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finsideapp-oss%2Fsonar-flutter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finsideapp-oss%2Fsonar-flutter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finsideapp-oss%2Fsonar-flutter/lists"}