Giter Club home page Giter Club logo

Comments (25)

victorgilc avatar victorgilc commented on May 28, 2024 2

@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.

victorgilc avatar victorgilc commented on May 28, 2024 2

The pull request that fixes this bug was merged to the development branch today.

from sonar-flutter.

victorgilc avatar victorgilc commented on May 28, 2024 1

@victorgilc your answer works for me but I have new issue, Any idea?
imagen

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.

victorgilc avatar victorgilc commented on May 28, 2024 1

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.

victorgilc avatar victorgilc commented on May 28, 2024 1

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.

epadilhaf3 avatar epadilhaf3 commented on May 28, 2024 1

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.

salim-lachdhaf avatar salim-lachdhaf commented on May 28, 2024

same issue here i'm using windows 7

from sonar-flutter.

Pizzakath avatar Pizzakath commented on May 28, 2024

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.

RicardoHds avatar RicardoHds commented on May 28, 2024

Any update for this issue?

Same issue.

from sonar-flutter.

victorgilc avatar victorgilc commented on May 28, 2024

Same issue, windows server 2012

from sonar-flutter.

santitigaga avatar santitigaga commented on May 28, 2024

I have the same issue in windows 10

from sonar-flutter.

victorgilc avatar victorgilc commented on May 28, 2024

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.

santitigaga avatar santitigaga commented on May 28, 2024

@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.

santitigaga avatar santitigaga commented on May 28, 2024

@victorgilc your answer works for me but I have new issue, Any idea?
imagen

from sonar-flutter.

santitigaga avatar santitigaga commented on May 28, 2024

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.

sathishmscict avatar sathishmscict commented on May 28, 2024

Same issue here !

from sonar-flutter.

victorgilc avatar victorgilc commented on May 28, 2024

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.

victorgilc avatar victorgilc commented on May 28, 2024

I opened a PR. please reach me for any concerns.

from sonar-flutter.

zippy1978 avatar zippy1978 commented on May 28, 2024

Issue is fixed in release 0.3.0 (it includes @victorgilc PR).
I'm closing the issue.

from sonar-flutter.

zippy1978 avatar zippy1978 commented on May 28, 2024

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.

epadilhaf3 avatar epadilhaf3 commented on May 28, 2024

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.

zippy1978 avatar zippy1978 commented on May 28, 2024

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.

epadilhaf3 avatar epadilhaf3 commented on May 28, 2024

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.

ninjacoder96 avatar ninjacoder96 commented on May 28, 2024

any update on this?

from sonar-flutter.

kuhnroyal avatar kuhnroyal commented on May 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.