insideapp-oss / sonar-flutter

SonarQube plugin for Flutter / Dart
Other
446 stars 82 forks source link

Not getting issue in SonarQube Dashboard and removed existing analysis_options.yaml #209

Closed AkashPrajapati25 closed 5 months ago

AkashPrajapati25 commented 9 months ago

Hello I have installed this plugin in my sonarqube and set the configurations below in project

# must be unique in a given SonarQube instance sonar.projectKey=test sonar.host.url=http://localhost:4005 sonar.token=sqp_557750c57557750c57557750c57557750c57 sonar.projectName='test' sonar.sources=lib sonar.sourceEncoding=UTF-8

After I have run this command: sonar-scanner.bat

19:23:00.667 INFO: Running 'flutter.bat [analyze, --no-fatal-warnings, --no-fatal-infos]' 19:23:16.601 INFO: Command 'flutter.bat analyze --no-fatal-warnings --no-fatal-infos' finished (exit 0) 19:23:16.604 DEBUG: Cleaned up temporary analysis_options.yaml file 19:23:16.949 INFO: Recording 14168 issues 19:23:16.950 DEBUG: Recording issue for analysis_options.yaml 19:23:16.950 WARN: File not included in SonarQube analysis_options.yaml 19:23:16.951 DEBUG: Recording issue for analysis_options.yaml 19:23:16.951 WARN: File not included in SonarQube analysis_options.yaml 19:23:16.951 DEBUG: Recording issue for analysis_options.yaml 19:23:16.951 WARN: File not included in SonarQube analysis_options.yaml 19:23:16.969 DEBUG: Recording issue for customer_controller.dart 19:23:16.974 DEBUG: Recording issue for customer_controller.dart 19:23:16.974 DEBUG: Recording issue for customer_controller.dart 19:23:16.975 DEBUG: Recording issue for customer_controller.dart 19:23:16.975 DEBUG: Recording issue for customer_controller.dart 19:23:16.976 DEBUG: Recording issue for customer_controller.dart 19:23:16.976 DEBUG: Recording issue for customer_controller.dart 19:23:16.976 DEBUG: Recording issue for customer_controller.dart 19:23:16.977 DEBUG: Recording issue for customer_controller.dart 19:23:16.977 DEBUG: Recording issue for customer_controller.dart 19:23:16.977 DEBUG: Recording issue for customer_controller.dart 19:23:16.977 DEBUG: Recording issue for customer_controller.dart 19:23:16.978 DEBUG: Recording issue for customer_controller.dart 19:23:16.978 DEBUG: Recording issue for customer_controller.dart 19:23:16.978 DEBUG: Recording issue for customer_controller.dart 19:23:16.979 DEBUG: Recording issue for customer_controller.dart 19:23:16.979 DEBUG: Recording issue for customer_controller.dart 19:23:16.980 DEBUG: Recording issue for customer_controller.dart 19:23:16.981 DEBUG: Recording issue for customer_controller.dart 19:23:16.982 DEBUG: Recording issue for customer_controller.dart 19:23:16.983 DEBUG: Recording issue for customer_controller.dart 19:23:16.983 DEBUG: Recording issue for customer_controller.dart 19:23:21.679 INFO: Sensor Dart analysis sensor [flutter] (done) | time=21205ms 19:23:21.679 INFO: Sensor Flutter unit tests [flutter] 19:23:21.681 INFO: Sensor Flutter unit tests [flutter] (done) | time=2ms 19:23:21.681 INFO: Sensor Flutter Coverage [flutter] 19:23:21.681 WARN: No coverage information will be saved because LCOV file cannot be found or read. 19:23:21.681 WARN: Provided LCOV file path: coverage/lcov.info. Seek file with path: coverage\lcov.info 19:23:21.682 INFO: Analysing [null] 19:23:21.686 INFO: Sensor Flutter Coverage [flutter] (done) | time=5ms 19:23:21.686 INFO: Sensor HTML [web] 19:23:21.691 INFO: Sensor HTML [web] (done) | time=5ms 19:23:21.691 INFO: Sensor TextAndSecretsSensor [text] 19:23:22.374 INFO: 189 source files to be analyzed 19:23:25.297 INFO: 189/189 source files have been analyzed 19:23:25.297 INFO: Sensor TextAndSecretsSensor [text] (done) | time=3606ms 19:23:25.297 INFO: Sensor VB.NET Project Type Information [vbnet] 19:23:25.299 INFO: Sensor VB.NET Project Type Information [vbnet] (done) | time=2ms 19:23:25.299 INFO: Sensor VB.NET Analysis Log [vbnet] 19:23:25.317 DEBUG: Project '': Property missing: 'sonar.vbnet.analyzer.projectOutPaths'. No protobuf files will be loaded for this project. 19:23:25.317 INFO: Sensor VB.NET Analysis Log [vbnet] (done) | time=18ms 19:23:25.317 INFO: Sensor VB.NET Properties [vbnet] 19:23:25.318 DEBUG: Project '': Property missing: 'sonar.vbnet.analyzer.projectOutPaths'. No protobuf files will be loaded for this project. 19:23:25.318 DEBUG: Project '': No Roslyn issues reports have been found. 19:23:25.318 INFO: Sensor VB.NET Properties [vbnet] (done) | time=1ms 19:23:25.318 INFO: Sensor IaC Docker Sensor [iac] 19:23:25.322 INFO: 0 source files to be analyzed 19:23:25.432 INFO: 0/0 source files have been analyzed 19:23:25.432 INFO: Sensor IaC Docker Sensor [iac] (done) | time=114ms 19:23:25.437 INFO: ------------- Run sensors on project 19:23:25.566 DEBUG: 'Generic Coverage Report' skipped because one of the required properties is missing 19:23:25.567 DEBUG: 'Import external issues report from SARIF file.' skipped because one of the required properties is missing 19:23:25.567 DEBUG: 'C#' skipped because there is no related file in current project 19:23:25.568 DEBUG: 'C# File Caching Sensor' skipped because there is no related file in current project 19:23:25.569 DEBUG: 'C# Tests Coverage Report Import' skipped because there is no related file in current project 19:23:25.569 DEBUG: '[Deprecated] C# Integration Tests Coverage Report Import' skipped because there is no related file in current project 19:23:25.570 DEBUG: 'C# Unit Test Results Import' skipped because there is no related file in current project 19:23:25.570 DEBUG: 'VB.NET' skipped because there is no related file in current project 19:23:25.571 DEBUG: 'VB.NET File Caching Sensor' skipped because there is no related file in current project 19:23:25.572 DEBUG: 'VB.NET Tests Coverage Report Import' skipped because there is no related file in current project 19:23:25.573 DEBUG: '[Deprecated] VB.NET Integration Tests Coverage Report Import' skipped because there is no related file in current project 19:23:25.574 DEBUG: 'VB.NET Unit Test Results Import' skipped because there is no related file in current project 19:23:25.574 DEBUG: 'Java CPD Block Indexer' skipped because there is no related file in current project 19:23:25.574 DEBUG: Sensors : Analysis Warnings import -> Zero Coverage Sensor 19:23:25.575 INFO: Sensor Analysis Warnings import [csharp] 19:23:25.578 INFO: Sensor Analysis Warnings import [csharp] (done) | time=3ms 19:23:25.578 INFO: Sensor Zero Coverage Sensor 19:23:25.583 INFO: Sensor Zero Coverage Sensor (done) | time=5ms 19:23:25.777 INFO: CPD Executor 5 files had no CPD blocks 19:23:25.777 INFO: CPD Executor Calculating CPD for 184 files 19:23:25.777 DEBUG: Detection of duplications for order_controller.dart 19:23:25.791 DEBUG: Detection of duplications for standard_response_model.dart 19:23:26.094 INFO: CPD Executor CPD calculation finished (done) | time=316ms 19:23:26.121 DEBUG: SCM revision ID '9eee0ef711a657a1831cb' 19:23:34.275 INFO: Analysis report generated in 554ms, dir size=1.4 MB 19:23:35.047 INFO: Analysis report compressed in 747ms, zip size=485.9 kB 19:23:35.048 INFO: Analysis report generated in .scannerwork\scanner-report 19:23:35.048 DEBUG: Upload report 19:23:35.121 DEBUG: POST 200 http://localhost:4005 | time=71ms 19:23:35.132 INFO: Analysis report uploaded in 80ms 19:23:35.135 DEBUG: Report metadata written to .scannerwork\report-task.txt 19:23:35.135 INFO: ANALYSIS SUCCESSFUL, you can find the results at: http://localhost:4005/ 19:23:35.135 INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report 19:23:35.135 INFO: More about the report processing at http://localhost:4005/api/ 19:23:35.147 DEBUG: Post-jobs : 19:23:35.159 INFO: Analysis total time: 55.532 s 19:23:35.164 INFO: ------------------------------------------------------------------------ 19:23:35.165 INFO: EXECUTION SUCCESS 19:23:35.165 INFO: ------------------------------------------------------------------------ 19:23:35.165 INFO: Total time: 1:00.645s 19:23:35.265 INFO: Final Memory: 27M/108M 19:23:35.266 INFO: ------------------------------------------------------------------------

In flutter.bat analyze I am getting the errors but after success when I checked into the sonarqube not get any error can you please help with it?

Thanks

GustC commented 8 months ago

I have the same problem. The version of my SonarQube is 10.4.1.88267.

Looking the command log, there is 1207 indexed-files but 0 source files to be analyzed. I knwon't the cause of this files cannot be analyzed.

The sonar-project.properties file:

sonar.projectKey=sonar-flutter
sonar.token=sqp_3f7fef8f038b3c84f99edd92615ea7da67fa9362
sonar.sources=lib,pubspec.yaml
sonar.tests=test
sonar.sourceEncoding=UTF-8 

The log of sonar-scanner:

INFO: SonarScanner 5.0.1.3006
INFO: Java 17.0.7 Eclipse Adoptium (64-bit)
INFO: Windows 10 10.0 amd64
INFO: Analyzing on SonarQube server 10.4.1.88267
INFO: Default locale: "pt_BR", source code encoding: "UTF-8"
INFO: Load global settings
INFO: Load global settings (done) | time=39ms
INFO: Server id: 86E1FA4D-AY4PmlDLFaAlChrvnaUG
WARN: sonar.plugins.downloadOnlyRequired is false, so ALL available plugins will be downloaded
INFO: Loading all plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=25ms
INFO: Load/download plugins
INFO: Load/download plugins (done) | time=56ms
INFO: Process project properties
INFO: Process project properties (done) | time=6ms
INFO: Execute project builders
INFO: Execute project builders (done) | time=1ms
INFO: Project key: sonar-flutter
INFO: Load project settings for component key: 'sonar-flutter'
INFO: Load project settings for component key: 'sonar-flutter' (done) | time=10ms
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=46ms
INFO: Load active rules
INFO: Load active rules (done) | time=928ms
INFO: Load analysis cache
INFO: Load analysis cache (404) | time=4ms
INFO: Preprocessing files...
INFO: 1 language detected in 1207 preprocessed files
INFO: 0 files ignored because of inclusion/exclusion patterns
INFO: 90 files ignored because of scm ignore settings
INFO: Load project repositories
INFO: Load project repositories (done) | time=8ms
INFO: Indexing files...
INFO: Project configuration:
INFO:   Excluded sources: test/**/*.mocks.dart, integration_test/**/*.mocks.dart
INFO: 1207 files indexed
INFO: Quality profile for yaml: Sonar way
INFO: ------------- Run sensors on module sonar-flutter
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=13ms
INFO: Sensor JaCoCo XML Report Importer [jacoco]
INFO: 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
INFO: No report imported, no coverage information will be imported by JaCoCo XML Report Importer
INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=2ms
INFO: Sensor IaC CloudFormation Sensor [iac]
INFO: 0 source files to be analyzed
INFO: 0/0 source files have been analyzed
INFO: Sensor IaC CloudFormation Sensor [iac] (done) | time=23ms
INFO: Sensor IaC Kubernetes Sensor [iac]
INFO: 0 source files to be analyzed
INFO: 0/0 source files have been analyzed
INFO: Sensor IaC Kubernetes Sensor [iac] (done) | time=55ms
INFO: Sensor JavaScript inside YAML analysis [javascript]
INFO: No input files found for analysis
INFO: Hit the cache for 0 out of 0
INFO: Miss the cache for 0 out of 0
INFO: Sensor JavaScript inside YAML analysis [javascript] (done) | time=6ms
INFO: Sensor CSS Rules [javascript]
INFO: No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped.
INFO: Sensor CSS Rules [javascript] (done) | time=3ms
INFO: Sensor C# Project Type Information [csharp]
INFO: Sensor C# Project Type Information [csharp] (done) | time=1ms
INFO: Sensor C# Analysis Log [csharp]
INFO: Sensor C# Analysis Log [csharp] (done) | time=9ms
INFO: Sensor C# Properties [csharp]
INFO: Sensor C# Properties [csharp] (done) | time=0ms
INFO: Sensor HTML [web]
INFO: Sensor HTML [web] (done) | time=3ms
INFO: Sensor TextAndSecretsSensor [text]
INFO: 1 source file to be analyzed
INFO: 1/1 source file has been analyzed
INFO: Sensor TextAndSecretsSensor [text] (done) | time=266ms
INFO: Sensor VB.NET Project Type Information [vbnet]
INFO: Sensor VB.NET Project Type Information [vbnet] (done) | time=1ms
INFO: Sensor VB.NET Analysis Log [vbnet]
INFO: Sensor VB.NET Analysis Log [vbnet] (done) | time=9ms
INFO: Sensor VB.NET Properties [vbnet]
INFO: Sensor VB.NET Properties [vbnet] (done) | time=1ms
INFO: Sensor IaC Docker Sensor [iac]
INFO: 0 source files to be analyzed
INFO: 0/0 source files have been analyzed
INFO: Sensor IaC Docker Sensor [iac] (done) | time=55ms
INFO: ------------- Run sensors on project
INFO: Sensor Analysis Warnings import [csharp]
INFO: Sensor Analysis Warnings import [csharp] (done) | time=1ms
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=20ms
INFO: CPD Executor Calculating CPD for 0 files
INFO: CPD Executor CPD calculation finished (done) | time=0ms
INFO: Analysis report generated in 58ms, dir size=202.4 kB
INFO: Analysis report compressed in 11ms, zip size=20.9 kB
INFO: Analysis report uploaded in 22ms
INFO: ANALYSIS SUCCESSFUL, you can find the results at: http://localhost:9000/dashboard?id=sonar-flutter
INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
INFO: More about the report processing at http://localhost:9000/api/ce/task?id=9cb2fa6e-e550-48e4-80f1-25314d68f76b
INFO: Analysis total time: 4.529 s
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 5.290s
INFO: Final Memory: 20M/96M
INFO: ------------------------------------------------------------------------
komgritz commented 7 months ago

I am using Flutter plugin version 0.4.0. And I am facing same problem after upgrade version to 10.4.1.88267, SonarScanner 5.0.1.3006

This below is log output.

INFO: Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties INFO: Project root configuration file: /usr/src/sonar-project.properties INFO: SonarScanner 5.0.1.3006 INFO: Java 17.0.8 Alpine (64-bit) INFO: Linux 5.10.104-linuxkit amd64 INFO: User cache: /opt/sonar-scanner/.sonar/cache INFO: Analyzing on SonarQube server 10.4.1.88267 INFO: Default locale: "en_US", source code encoding: "UTF-8" INFO: Load global settings INFO: Load global settings (done) | time=815ms INFO: Server id: xxxxxxxxx INFO: User cache: /opt/sonar-scanner/.sonar/cache WARN: sonar.plugins.downloadOnlyRequired is false, so ALL available plugins will be downloaded INFO: Loading all plugins INFO: Load plugins index INFO: Load plugins index (done) | time=350ms INFO: Load/download plugins INFO: Load/download plugins (done) | time=235179ms INFO: Process project properties INFO: Process project properties (done) | time=54ms INFO: Execute project builders INFO: Execute project builders (done) | time=17ms INFO: Project key: mercury-mobile INFO: Base dir: /usr/src INFO: Working dir: /usr/src/.scannerwork INFO: Load project settings for component key: 'xxxxx' INFO: Load project settings for component key: 'xxxxx' (done) | time=114ms INFO: Load quality profiles INFO: Load quality profiles (done) | time=220ms INFO: Load active rules INFO: Load active rules (done) | time=5303ms INFO: Load analysis cache INFO: Load analysis cache (404) | time=106ms INFO: Preprocessing files... INFO: 0 languages detected in 188 preprocessed files INFO: 0 files ignored because of scm ignore settings INFO: Load project repositories INFO: Load project repositories (done) | time=120ms INFO: Indexing files... INFO: Project configuration: INFO: Excluded sources for coverage: lib/src/screens/, lib/src/widgets/, lib/src/shared/, lib/src/constants/, lib/src/local_storage/shared_preference_manager/, lib/src/widgets/dialog_widgets/, lib/src/widgets/snackbar_widgets/, lib/src/configs/routes/, lib/src/core/base/, lib/src/core/dio/, lib/src/core/dio/dio_utils/, lib/src/core/dio/interceptors/, lib/src/core/firebase_remote_config/, lib/src/core/supfeature/ INFO: 188 files indexed INFO: ------------- Run sensors on module xxxxx INFO: Load metrics repository INFO: Load metrics repository (done) | time=233ms INFO: Sensor JaCoCo XML Report Importer [jacoco] INFO: 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml INFO: No report imported, no coverage information will be imported by JaCoCo XML Report Importer INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=17ms INFO: Sensor CSS Rules [javascript] INFO: No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped. INFO: Sensor CSS Rules [javascript] (done) | time=8ms INFO: Sensor C# Project Type Information [csharp] INFO: Sensor C# Project Type Information [csharp] (done) | time=7ms INFO: Sensor C# Analysis Log [csharp] INFO: Sensor C# Analysis Log [csharp] (done) | time=81ms INFO: Sensor C# Properties [csharp] INFO: Sensor C# Properties [csharp] (done) | time=0ms INFO: Sensor HTML [web] INFO: Sensor HTML [web] (done) | time=19ms INFO: Sensor TextAndSecretsSensor [text] INFO: Sensor TextAndSecretsSensor [text] (done) | time=3155ms INFO: Sensor VB.NET Project Type Information [vbnet] INFO: Sensor VB.NET Project Type Information [vbnet] (done) | time=36ms INFO: Sensor VB.NET Analysis Log [vbnet] INFO: Sensor VB.NET Analysis Log [vbnet] (done) | time=136ms INFO: Sensor VB.NET Properties [vbnet] INFO: Sensor VB.NET Properties [vbnet] (done) | time=1ms INFO: Sensor IaC Docker Sensor [iac] INFO: 0 source files to be analyzed INFO: 0/0 source files have been analyzed INFO: Sensor IaC Docker Sensor [iac] (done) | time=530ms INFO: ------------- Run sensors on project INFO: Sensor Dependency-Check [dependencycheck] INFO: Process Dependency-Check report INFO: Using JSON-Reportparser INFO: Dependency-Check JSON report does not exists. Please check property sonar.dependencyCheck.jsonReportPath:/usr/src/${WORKSPACE}/dependency-check-report.json INFO: JSON-Analysis skipped/aborted due to missing report file INFO: Dependency-Check HTML report does not exists. Please check property sonar.dependencyCheck.htmlReportPath:/usr/src/DependencyCheckerReport.html INFO: HTML-Dependency-Check report does not exist. INFO: Process Dependency-Check report (done) | time=14ms INFO: Sensor Dependency-Check [dependencycheck] (done) | time=15ms INFO: Sensor Analysis Warnings import [csharp] INFO: Sensor Analysis Warnings import [csharp] (done) | time=6ms INFO: Sensor Zero Coverage Sensor INFO: Sensor Zero Coverage Sensor (done) | time=36ms INFO: CPD Executor Calculating CPD for 0 files INFO: CPD Executor CPD calculation finished (done) | time=0ms INFO: Analysis report generated in 607ms, dir size=145.8 kB INFO: Analysis report compressed in 27ms, zip size=19.4 kB INFO: Analysis report uploaded in 344ms INFO: ANALYSIS SUCCESSFUL, you can find the results at: https://xxxxxxx/dashboard?id=xxxxx INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report INFO: More about the report processing at https://xxxxxxxx/api/ce/task?id=xxxxx INFO: Analysis total time: 29.601 s INFO: ------------------------------------------------------------------------ INFO: EXECUTION SUCCESS INFO: ------------------------------------------------------------------------ INFO: Total time: 4:55.539s INFO: Final Memory: 19M/70M INFO: ------------------------------------------------------------------------

I compared with the old log before upgrade SonarQube version. So there was "Sensor Dart sensor [flutter]" appeared in previous version log as sample below.

INFO: Sensor Dart sensor [flutter] INFO: Load project repositories INFO: Load project repositories INFO: Load project repositories INFO: Load project repositories INFO: Load project repositories (done) | time=58ms INFO: Load project repositories (done) | time=94ms INFO: Load project repositories (done) | time=129ms INFO: Load project repositories (done) | time=117ms INFO: Sensor Dart sensor [flutter] (done) | time=1867ms INFO: Sensor dartanalyzer sensor [flutter] INFO: Chosen analyzer mode: flutter INFO: Running 'flutter analyze'...

Please suggest me. Thank you.

DilanAriza commented 7 months ago

@GustC @komgritz In this issue you can find the solution, there I was able to solve my problem which did not index the files 'The main branch has no lines of code' problem #203

GustC commented 7 months ago

@DilanAriza works perfectly!! Thanks for help 😄

zippy1978 commented 5 months ago

Duplicate of https://github.com/insideapp-oss/sonar-flutter/issues/212

zippy1978 commented 5 months ago

Fixed in new release: https://github.com/insideapp-oss/sonar-flutter/releases/tag/0.5.1