Comments (25)
@victorgilc Yes it's true, the plugin tries to run 'dartanalyzer -h' but can't because it needs to call ** 'dartanalyze.bat -h' **.
Maybe someone knows how to solve it?
Exactly, I did the patch locally, I'll try to create a pull request as soon I'm able to test it.
DartAnalyzerSensor.java:
private static final String ANALYZER_COMMAND = System.getProperty("os.name").toUpperCase().contains("WINDOWS")?"dartanalyzer.bat":"dartanalyzer";
from sonar-flutter.
The pull request that fixes this bug was merged to the development branch today.
from sonar-flutter.
@victorgilc your answer works for me but I have new issue, Any idea?
Yeah, a lot of errors actually...I'll work on the fix. I'll let you know when it's finished. Please let me know if you finish it first lol. Now I'm facing something related to "tests.output"
from sonar-flutter.
Yes, @victorgilc, it is true, I solved it by changing the code of the code in the FlutterTestReportParser.java class with the help of PR #22. Am I a little uncomfortable there are several open pull requests, the approvers disappeared?
Maybe these guys didn't have time enough to approve in the last few days...At least it's open-source.
from sonar-flutter.
Well, I'm not finished yet, but there's something wrong with the following regex inside the class "DartAnalyzerReportParser.java": Pattern pattern = Pattern.compile("(.)•(.)•(.):(.):(.)•(.)");
With the "dartanalyzer" output, this regex isn't able to create any sonar issue.
from sonar-flutter.
Hello guys, I hope you are doing well, I am using the release 0.3.1, during the scanner I found the related problem here in the previous posts.
I'm using it in a gitlab CI/CD pipeline to generate the analysis and push it to Sonarqube.
ERROR: Could not startup process 'dartanalyzer -h'.
org.buildobjects.process.StartupException: Could not startup process 'dartanalyzer -h'.
Caused by: java.io.IOException: Cannot run program "dartanalyzer": error=2, No such file or directory
Should we reopen the issue?
Thank you in advance!
from sonar-flutter.
same issue here i'm using windows 7
from sonar-flutter.
I have the same issue, i tried with either dark-sdk installed by flutter and installing dart-sdk manually, both times having dart-sdk in my PATH, still the same issue.
Of course, when i use manually any dartanalyzer commands like "dartanalyzer lib test" it works, so i dont know why it doesn't work, probably it's from the binary plugin ?
Any updates on this issue please ?
from sonar-flutter.
Any update for this issue?
Same issue.
from sonar-flutter.
Same issue, windows server 2012
from sonar-flutter.
I have the same issue in windows 10
from sonar-flutter.
I have the same issue in windows 10
I think it's something related to windows...Maybe add the .bat at the end of the command
from sonar-flutter.
@victorgilc Yes it's true, the plugin tries to run 'dartanalyzer -h' but can't because it needs to call 'dartanalyze.bat -h'.
Maybe someone knows how to solve it?
from sonar-flutter.
@victorgilc your answer works for me but I have new issue, Any idea?
from sonar-flutter.
Yes, @victorgilc, it is true, I solved it by changing the code of the code in the FlutterTestReportParser.java class with the help of PR #22. Am I a little uncomfortable there are several open pull requests, the approvers disappeared?
from sonar-flutter.
Same issue here !
from sonar-flutter.
I'm working on it. I'll try to finish it at the weekend. If someone wants to help me, I appreciate it.
from sonar-flutter.
I opened a PR. please reach me for any concerns.
from sonar-flutter.
Issue is fixed in release 0.3.0 (it includes @victorgilc PR).
I'm closing the issue.
from sonar-flutter.
Hi @epadilhaf3,
Is Flutter properly installed on your runner ?
For example, here is what I use to run an analysis on Gitlab :
image: openjdk:8-jdk
variables:
FLUTTER_VERSION: "1.20.1-stable"
SONAR_SCANNER_VERSION: "3.2.0.1227"
before_script:
- apt-get --quiet update --yes
- apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1 apt-transport-https
- sh -c 'wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -'
- sh -c 'wget -qO- https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'
- apt-get --quiet update --yes
- apt-get --quiet install --yes dart
- export PATH=$PATH:/usr/lib/dart/bin
- wget --output-document=flutter-sdk.tar.xz https://storage.googleapis.com/flutter_infra/releases/stable/linux/flutter_linux_${FLUTTER_VERSION}.tar.xz
- tar -xf flutter-sdk.tar.xz
- export PATH=$PATH:$PWD/flutter/bin
- wget --output-document=sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${SONAR_SCANNER_VERSION}-linux.zip
- unzip sonar-scanner.zip
- export PATH=$PATH:$PWD/sonar-scanner-$SONAR_SCANNER_VERSION-linux/bin
stages:
- analyse
analyse:
stage: analyse
script:
- flutter pub get
- flutter test --machine > tests.output
- flutter test --coverage
- sonar-scanner -Dsonar.host.url=$SONAR_URL -Dsonar.login=$SONAR_TOKEN
from sonar-flutter.
Hi @epadilhaf3,
Is Flutter properly installed on your runner ?
For example, here is what I use to run an analysis on Gitlab :
image: openjdk:8-jdk variables: FLUTTER_VERSION: "1.20.1-stable" SONAR_SCANNER_VERSION: "3.2.0.1227" before_script: - apt-get --quiet update --yes - apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1 apt-transport-https - sh -c 'wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -' - sh -c 'wget -qO- https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list' - apt-get --quiet update --yes - apt-get --quiet install --yes dart - export PATH=$PATH:/usr/lib/dart/bin - wget --output-document=flutter-sdk.tar.xz https://storage.googleapis.com/flutter_infra/releases/stable/linux/flutter_linux_${FLUTTER_VERSION}.tar.xz - tar -xf flutter-sdk.tar.xz - export PATH=$PATH:$PWD/flutter/bin - wget --output-document=sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${SONAR_SCANNER_VERSION}-linux.zip - unzip sonar-scanner.zip - export PATH=$PATH:$PWD/sonar-scanner-$SONAR_SCANNER_VERSION-linux/bin stages: - analyse analyse: stage: analyse script: - flutter pub get - flutter test --machine > tests.output - flutter test --coverage - sonar-scanner -Dsonar.host.url=$SONAR_URL -Dsonar.login=$SONAR_TOKEN
Hey @zippy1978, thank you for your response, I hope you are doing well.
Looking for best performance, I'm using an image to flutter stage, running commands like apt-get update in a pipeline could result in a slow deployment, please take a look on my .gitlab-ci.yaml file:
stages:
- test
- sonar_analysis
unit_test:
stage: test
image: cirrusci/flutter:stable
script:
- pub get
- dartanalyzer lib test
- pub run test --reporter expanded
- pub run test_coverage
- genhtml coverage/lcov.info -o coverage
artifacts:
paths:
- coverage/
.sonar_template: &sonar_common
stage: sonar_analysis
image: sonarsource/sonar-scanner-cli
variables:
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar"
cache:
key: ${CI_JOB_NAME}
paths:
- .sonar/cache
sonar_push:
<<: *sonar_common
script:
- sonar-scanner -Dsonar.projectKey=$CI_PROJECT_NAME -Dsonar.qualitygate.wait=true -Dsonar.branch.name=$CI_COMMIT_BRANCH
sonar_mr:
<<: *sonar_common
script:
- sonar-scanner -Dsonar.projectKey=$CI_PROJECT_NAME -Dsonar.pullrequest.key=$CI_MERGE_REQUEST_IID -Dsonar.pullrequest.branch=$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME -Dsonar.pullrequest.base=master
rules:
- if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"'
The complete log is the following:
INFO: Sensor dartanalyzer sensor [flutter]
ERROR: Could not startup process 'dartanalyzer -h'.
org.buildobjects.process.StartupException: Could not startup process 'dartanalyzer -h'.
at org.buildobjects.process.Proc.<init>(Proc.java:91)
at org.buildobjects.process.ProcBuilder.run(ProcBuilder.java:205)
at fr.insideapp.sonarqube.dart.lang.issues.dartanalyzer.DartAnalyzerSensor.verifyIfDartAnalyzerExists(DartAnalyzerSensor.java:254)
at fr.insideapp.sonarqube.dart.lang.issues.dartanalyzer.DartAnalyzerSensor.execute(DartAnalyzerSensor.java:68)
at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:59)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:77)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:59)
at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:82)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:400)
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:395)
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:358)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:141)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:73)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
at com.sun.proxy.$Proxy0.execute(Unknown Source)
at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Caused by: java.io.IOException: Cannot run program "dartanalyzer": error=2, No such file or directory
at java.base/java.lang.ProcessBuilder.start(Unknown Source)
at java.base/java.lang.ProcessBuilder.start(Unknown Source)
at java.base/java.lang.Runtime.exec(Unknown Source)
at org.buildobjects.process.Proc.<init>(Proc.java:77)
... 33 common frames omitted
Caused by: java.io.IOException: error=2, No such file or directory
at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
at java.base/java.lang.ProcessImpl.<init>(Unknown Source)
at java.base/java.lang.ProcessImpl.start(Unknown Source)
... 37 common frames omitted
Thank you again.
from sonar-flutter.
Hi @epadilhaf3,
The problem is that when you move to stage "sonar_analysis", you switch to image "sonarsource/sonar-scanner-cli", where flutter is not installed.
from sonar-flutter.
Hi @epadilhaf3,
The problem is that when you move to stage "sonar_analysis", you switch to image "sonarsource/sonar-scanner-cli", where flutter is not installed.
Hey, thanks, I'll change it, and test.
from sonar-flutter.
any update on this?
from sonar-flutter.
I don't think there is anything to do here. If you experience this message you need to make sure that you ran pub global activate dartanalyzer
.
As a sidenote, Dartanalyzer has been pretty much replaced by dart/flutter analyze
in recent Dart/Flutter versions. You can configure this via sonar.flutter.analyzer.mode
according to the README.
from sonar-flutter.
Related Issues (20)
- Exception on pubspec.yaml with no dependencies HOT 2
- Could not startup process 'flutter analyze --no-fatal-warnings --no-fatal-infos' HOT 4
- Sonar-Flutter Plugin not working in SonarQube 9.9.x or 10.2.x HOT 6
- Simplify "Run analysis" documentation HOT 2
- GitHub actions cannot start up flutter analyze HOT 10
- Issue Multi-Module for code coverage does not show in a report HOT 3
- 'The main branch has no lines of code' problem HOT 4
- Vulnerability issue shows on my local but not SonarQube Dashboard. HOT 2
- Analysis fails if any `pubspec.yaml` file does not have a `dependencies` key HOT 2
- java.lang.IllegalStateException: Error while running 'flutter analyze --no-fatal-warnings --no-fatal-infos' (exit 1): 6632 issues found. (ran in 3.3s) HOT 13
- scanner fails to report the results back to qube - Current edition does not support branch feature HOT 4
- How to scan dependencies HOT 2
- Not getting issue in SonarQube Dashboard and removed existing analysis_options.yaml HOT 6
- Exclusion and lcov HOT 2
- IllegalArgumentException while analyzing Dart of Flutter project
- Files aren't indexed as dart with SonarQube 10.4.1 HOT 2
- [QUESTION] Use sonarlint in connected mode
- [FATAL] Could not startup process 'flutter analyze --no-fatal-warnings --no-fatal-infos'. HOT 1
- [FATAL] pubspec.yaml does not exist in Monorepository
- [QUESTION] Support dart code linter HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sonar-flutter.