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

devonfw / IDEasy / 42872703736

10 Nov 2026 06:11PM UTC coverage: 75.25% (+0.2%) from 75.085%
42872703736

push

github

web-flow
#2410: improve bug report support (#2507)

Co-authored-by: Jörg Hohwiller <hohwille@users.noreply.github.com>

6294 of 9273 branches covered (67.87%)

Branch coverage included in aggregate %.

16162 of 20569 relevant lines covered (78.57%)

3.39 hits per line

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

81.19
cli/src/main/java/com/devonfw/tools/ide/commandlet/StatusCommandlet.java
1
package com.devonfw.tools.ide.commandlet;
2

3
import java.nio.file.Files;
4
import java.nio.file.Path;
5

6
import org.slf4j.Logger;
7
import org.slf4j.LoggerFactory;
8

9
import com.devonfw.tools.ide.context.IdeContext;
10
import com.devonfw.tools.ide.environment.EnvironmentVariables;
11
import com.devonfw.tools.ide.git.GitContext;
12
import com.devonfw.tools.ide.git.repository.RepositoryType;
13
import com.devonfw.tools.ide.log.IdeLogLevel;
14
import com.devonfw.tools.ide.migration.IdeMigrator;
15
import com.devonfw.tools.ide.os.SystemInfo;
16
import com.devonfw.tools.ide.step.Step;
17
import com.devonfw.tools.ide.tool.IdeasyCommandlet;
18
import com.devonfw.tools.ide.version.VersionIdentifier;
19

20
/**
21
 * {@link AbstractCommandlet} to print a status report about IDEasy.
22
 */
23
public class StatusCommandlet extends AbstractCommandlet {
24

25
  private static final Logger LOG = LoggerFactory.getLogger(StatusCommandlet.class);
4 ✔
26

27
  /**
28
   * The constructor.
29
   *
30
   * @param context the {@link IdeContext}.
31
   */
32
  public StatusCommandlet(IdeContext context) {
33

34
    super(context);
3 ✔
35
    addKeyword(getName());
4 ✔
36
  }
1 ✔
37

38
  @Override
39
  public String getName() {
40

41
    return "status";
2 ✔
42
  }
43

44
  @Override
45
  public boolean isWriteLogFile() {
46

47
    return false;
×
48
  }
49

50
  @Override
51
  protected void doRun() {
52
    Step step = this.context.newStep(true, "Show IDE_ROOT and IDE_HOME");
8 ✔
53
    step.run(this.context::logIdeHomeAndRootStatus);
9 ✔
54
    step = this.context.newStep(true, "Check for updates of IDEasy");
8 ✔
55
    step.run(this::checkForUpdate);
5 ✔
56
    step = this.context.newStep(true, "Show online status");
8 ✔
57
    step.run(this::logOnlineStatus);
5 ✔
58
    step = this.context.newStep(true, "Show git and bash location");
8 ✔
59
    step.run(this::logGitBashLocationStatus);
5 ✔
60

61
    if (this.context.getIdeHome() != null) {
4 ✔
62
      step = this.context.newStep(true, "Show git status");
8 ✔
63
      step.run(this::logSettingsGitStatus);
5 ✔
64
      step = this.context.newStep(true, "Show legacy status");
8 ✔
65
      step.run(this::logSettingsLegacyStatus);
5 ✔
66
      step = this.context.newStep(true, "Show migration status");
8 ✔
67
      step.run(this::logMigrationStatus);
5 ✔
68
    }
69
  }
1 ✔
70

71
  private void checkForUpdate() {
72
    new IdeasyCommandlet(this.context, null).checkIfUpdateIsAvailable();
8 ✔
73
    logSystemInfo();
2 ✔
74
  }
1 ✔
75

76
  private void logSystemInfo() {
77
    SystemInfo systemInfo = this.context.getSystemInfo();
4 ✔
78
    LOG.info("Your operating system is {}", systemInfo.describe());
5 ✔
79
  }
1 ✔
80

81
  private void logSettingsLegacyStatus() {
82
    EnvironmentVariables variables = this.context.getVariables();
4 ✔
83
    boolean hasLegacyProperties = false;
2 ✔
84
    while (variables != null) {
2 ✔
85
      Path legacyProperties = variables.getLegacyPropertiesFilePath();
3 ✔
86
      if (legacyProperties != null && Files.exists(legacyProperties)) {
7 !
87
        hasLegacyProperties = true;
×
88
        LOG.warn("Found legacy properties {}", legacyProperties);
×
89
      }
90
      variables = variables.getParent();
3 ✔
91
    }
1 ✔
92
    if (hasLegacyProperties) {
2 !
93
      LOG.warn(
×
94
          "Your settings are outdated and contain legacy configurations. "
95
              + "Please consider upgrading your settings:\nhttps://github.com/devonfw/IDEasy/blob/main/documentation/settings.adoc#upgrade");
96
    }
97
  }
1 ✔
98

99
  private void logSettingsGitStatus() {
100
    Path settingsPath = this.context.getSettingsGitRepository();
4 ✔
101
    if (settingsPath == null) {
2 ✔
102
      if (this.context.getIdeHome() != null) {
4 !
103
        LOG.error("No settings repository was found.");
4 ✔
104
      }
105
    } else {
106
      GitContext gitContext = this.context.getGitContext();
4 ✔
107
      if (gitContext.isRepositoryUpdateAvailable(settingsPath, this.context.getSettingsCommitIdPath())) {
7 !
108
        if (RepositoryType.ofSettingsPath(this.context.getSettingsPath(), context) != RepositoryType.CODE_SETTINGS_COMBINED) {
×
109
          LOG.warn("Your settings are not up-to-date, please run 'ide update'.");
×
110
        }
111
      } else {
112
        IdeLogLevel.SUCCESS.log(LOG, "Your settings are up-to-date.");
4 ✔
113
      }
114
      String branch = gitContext.determineCurrentBranch(settingsPath);
4 ✔
115
      LOG.debug("Your settings branch is {}", branch);
4 ✔
116
      if (!"master".equals(branch) && !"main".equals(branch)) {
8 !
117
        LOG.warn("Your settings are on a custom branch: {}", branch);
×
118
      }
119
    }
120
  }
1 ✔
121

122
  private void logOnlineStatus() {
123
    this.context.getNetworkStatus().logStatusMessage();
4 ✔
124
  }
1 ✔
125

126
  private void logMigrationStatus() {
127

128
    IdeMigrator migrator = new IdeMigrator();
4 ✔
129
    VersionIdentifier projectVersion = this.context.getProjectVersion();
4 ✔
130
    if (projectVersion.isLess(migrator.getTargetVersion())) {
5 ✔
131
      IdeLogLevel.INTERACTION.log(LOG,
10 ✔
132
          "Your project '{}' was created or last updated with IDEasy version {} and needs an update.\nPlease run 'ide update' to migrate your project.",
133
          this.context.getProjectName(), projectVersion);
6 ✔
134
    }
135
  }
1 ✔
136

137
  private void logGitBashLocationStatus() {
138
    Path bashPath = this.context.findBash();
4 ✔
139
    if (bashPath != null) {
2 !
140
      IdeLogLevel.SUCCESS.log(LOG, "Found bash executable at: {}", bashPath);
11 ✔
141
    } else {
142
      LOG.error("No bash executable was found on your system!");
×
143
    }
144
    GitContext gitContext = this.context.getGitContext();
4 ✔
145
    Path gitPath = gitContext.findGit();
3 ✔
146
    if (gitPath != null) {
2 !
147
      IdeLogLevel.SUCCESS.log(LOG, "Found git executable at: {}", gitPath);
×
148
    } else {
149
      LOG.error("No git executable was found on your system!");
3 ✔
150
    }
151
  }
1 ✔
152

153
  @Override
154
  public boolean isIdeRootRequired() {
155

156
    return false;
2 ✔
157
  }
158
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc