• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

devonfw / IDEasy / 19651727463

24 Nov 2025 10:43PM UTC coverage: 69.156% (+0.1%) from 69.024%
19651727463

push

github

web-flow
#1144: #1145: CVE warnings and suggestions (#1593)

Co-authored-by: KianRolf <kian.loroff@capgemini.com>
Co-authored-by: jan-vcapgemini <59438728+jan-vcapgemini@users.noreply.github.com>

3613 of 5721 branches covered (63.15%)

Branch coverage included in aggregate %.

9387 of 13077 relevant lines covered (71.78%)

3.15 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

9.26
cli/src/main/java/com/devonfw/tools/ide/tool/sonar/Sonar.java
1
package com.devonfw.tools.ide.tool.sonar;
2

3
import java.nio.file.Path;
4
import java.util.Properties;
5
import java.util.Set;
6

7
import com.devonfw.tools.ide.common.Tag;
8
import com.devonfw.tools.ide.context.IdeContext;
9
import com.devonfw.tools.ide.property.EnumProperty;
10
import com.devonfw.tools.ide.tool.LocalToolCommandlet;
11
import com.devonfw.tools.ide.tool.ToolInstallation;
12
import com.devonfw.tools.ide.tool.java.Java;
13
import com.devonfw.tools.ide.tool.mvn.Mvn;
14

15
public class Sonar extends LocalToolCommandlet {
16

17
  public final EnumProperty<SonarCommand> command;
18

19
  /**
20
   * The constructor.
21
   *
22
   * @param context the {@link IdeContext}. method.
23
   */
24
  public Sonar(IdeContext context) {
25

26
    super(context, "sonar", Set.of(Tag.CODE_QA));
6✔
27

28
    this.command = add(new EnumProperty<>("", true, "command", SonarCommand.class));
12✔
29
    add(this.arguments);
5✔
30
  }
1✔
31

32
  @Override
33
  protected void initProperties() {
34

35
    // Empty on purpose
36
  }
1✔
37

38
  @Override
39
  public ToolInstallation install(boolean silent) {
40

41
    getCommandlet(Java.class).install();
×
42
    return super.install(silent);
×
43
  }
44

45
  @Override
46
  public void run() {
47

48
    SonarCommand command = this.command.getValue();
×
49

50
    Path toolPath = getToolPath();
×
51
    if (!toolPath.toFile().exists()) {
×
52
      super.install(true);
×
53
    }
54

55
    switch (command) {
×
56
      case ANALYZE:
57
        getCommandlet(Mvn.class).runTool("sonar:sonar");
×
58
        break;
×
59
      case START:
60
        printSonarWebPort();
×
61
        this.arguments.setValueAsString("start", this.context);
×
62
        super.run();
×
63
        break;
×
64
      case STOP:
65
        this.arguments.setValueAsString("stop", this.context);
×
66
        super.run();
×
67
        break;
×
68
      default:
69
    }
70
  }
×
71

72
  @Override
73
  protected String getBinaryName() {
74

75
    if (this.context.getSystemInfo().isWindows()) {
×
76
      SonarCommand command = this.command.getValue();
×
77
      if (command.equals(SonarCommand.START)) {
×
78
        return "windows-x86-64/StartSonar.bat";
×
79
      } else if (command.equals(SonarCommand.STOP)) {
×
80
        return "windows-x86-64/SonarService.bat";
×
81
      }
82
    } else if (this.context.getSystemInfo().isMac()) {
×
83
      return "macosx-universal-64/sonar.sh";
×
84
    }
85
    return "linux-x86-64/sonar.sh";
×
86
  }
87

88
  private void printSonarWebPort() {
89

90
    this.context.info("SonarQube is running at localhost on the following port (default 9000):");
×
91
    Path sonarPropertiesPath = getToolPath().resolve("conf/sonar.properties");
×
92

93
    Properties sonarProperties = this.context.getFileAccess().readProperties(sonarPropertiesPath);
×
94
    String sonarWebPort = sonarProperties.getProperty("sonar.web.port");
×
95
    if (sonarWebPort != null) {
×
96
      this.context.info(sonarWebPort);
×
97
    }
98
  }
×
99
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc