sonar-flutter
sonar-flutter copied to clipboard
sonar-scanner "Found issues: 0"
If I run flutter analyze
I get:
210 issues found. (ran in 2.5s)
...but when I run sonar-scanner
the execution succeeds and I get:
...
INFO: Chosen analyzer mode: flutter
INFO: Running 'flutter analyze'...
INFO: Found issues: 0
...
I checked the logs using sonar-scanner -Dsonar.verbose=true
and everything looks ok, my .dart files are being detected and there are no weird errors (wrong charset or similar).
This is related to #81 and #8 but none of the suggested ideas solved the problem.
I'm using:
- SonarQube Community EditionVersion 8.7.1
- SonarScanner 4.5.0.2216
- sonar-flutter 0.4.0
- Flutter 2.2.3 • channel stable • https://github.com/flutter/flutter.git Framework • revision f4abaa0735 (3 months ago) • 2021-07-01 12:46:11 -0700 Engine • revision 241c87ad80 Tools • Dart 2.13.4
Thanks
I think the output format of the analysis results changed with Flutter 2.2, the new parsing still needs to be implemented.
I forgot to mention that I'm using Ubuntu 18.04.5 LTS. I also tested Flutter 2.0.6 but I get the same result.
Can you add the sonar-scanner log with --verbose
to the issue please.
Ok so, I debugged the issue and found out that I have an encoding problem: the flutter analyze
output lines look like info ??? The method iconContainer should have a return type but doesn't ??? lib/widgets/my_widget.dart:28:3 ??? always_declare_return_types
.
The plugin expects bulls "•" and therefore the reg expr fails.
I got it to work with this code:
byte[] outputBytes = new ProcBuilder(analyzerCommand, "analyze")
.withTimeoutMillis(ANALYZER_TIMEOUT)
.ignoreExitStatus()
.run()
.getOutputBytes();
String outputString = new String(outputBytes, StandardCharsets.UTF_8);
List<DartAnalyzerReportIssue> issues = new DartAnalyzerReportParser().parse(outputString);
Thanks for your support @kuhnroyal, feel free to close the issue if you think this is not affecting other people.
Thanks for the effort! What OS are you on?
I'm using Ubuntu 18.04.5 LTS, this is a devops agent so I guess I have some issues with the system's locale. That's why I'm not sure this is a common issue ... anyway, it could be interesting to add some debug information or let the plugin fail if the output's format is unexpected. Thanks
i'm having the same issue.
@kuhnroyal @mcelotti can you please do a PR for this issue?
+1 Facing the same issue when I try to execute it on GitLab worker nodes, whereas the same plugin (v0.4.0) works perfectly on my M1 Mac. It would be great if a PR can be raised for this.
I'm having the same issue.
Is there any solution?
+1 , same error About the change of output, any clue of what changed?
Hey there, I think @kuhnroyal has to decide what to do with this issue, in the meantime here's the "quick-and-dirty" solution (ie my .jar file) sonar-flutter-plugin-0.4.0.jar.zip
Thanks, @mcelotti , but still 0 issues. It only finds the coverage. But, in most of the files, i receive the alert: No blame info at line 1. Is file committed? [Author: PersonIdent[Not Committed Yet, , Tue Dec 21 18:20:27 2021 +0000] Source commit: null]
@tommymolto you're welcome. Do you get issues when you manually run the flutter analyze
command?
The .jar that I shared only fixes the locale's problem.
Sorry for the delay. Yes, we get issues in the analyze. I`m concerned in not having code smells, bugs with criticity, etc.
+1 Any predictions for this, I'm having this problem only when project dart (without flutter).
+1
Same problem here Flutter 2.10.5
This issue is stale because it has been open for 90 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.
I found solution to use flutter analyze by command sonar-scanner
with sonar-flutter plugin instead of separated scanning by command flutter analyze
Another workaround - is to change the default encoding in your environment (where you are running sonar-scanner). You need to set it to UTF-8
If you use docker you can try adding this:
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8