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

devonfw / IDEasy / 22241505980

20 Feb 2026 09:16PM UTC coverage: 70.656% (+0.2%) from 70.474%
22241505980

Pull #1710

github

web-flow
Merge 04e4bdacd into 379acdc9d
Pull Request #1710: #404: allow logging via SLF4J

4121 of 6440 branches covered (63.99%)

Branch coverage included in aggregate %.

10704 of 14542 relevant lines covered (73.61%)

3.13 hits per line

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

71.57
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.log.IdeLogLevel;
13
import com.devonfw.tools.ide.migration.IdeMigrator;
14
import com.devonfw.tools.ide.os.SystemInfo;
15
import com.devonfw.tools.ide.step.Step;
16
import com.devonfw.tools.ide.tool.IdeasyCommandlet;
17
import com.devonfw.tools.ide.version.VersionIdentifier;
18

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

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

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

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

37
  @Override
38
  public String getName() {
39

40
    return "status";
2✔
41
  }
42

43
  @Override
44
  protected boolean isActivateJaveUtilLogging() {
45

46
    return false;
2✔
47
  }
48

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

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

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

75
  private void logSystemInfo() {
76
    SystemInfo systemInfo = this.context.getSystemInfo();
4✔
77
    LOG.info("Your operating system is {}({})@{} [{}@{}]", systemInfo.getOs(), systemInfo.getOsVersion(), systemInfo.getArchitecture(),
23✔
78
        systemInfo.getOsName(), systemInfo.getArchitectureName());
7✔
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. Please consider upgrading your settings:\nhttps://github.com/devonfw/IDEasy/blob/main/documentation/settings.adoc#upgrade");
95
    }
96
  }
1✔
97

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

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

125
  private void logMigrationStatus() {
126

127
    IdeMigrator migrator = new IdeMigrator();
4✔
128
    VersionIdentifier projectVersion = this.context.getProjectVersion();
4✔
129
    VersionIdentifier targetVersion = migrator.getTargetVersion();
3✔
130
    if (projectVersion.isLess(targetVersion)) {
4!
131
      LOG.info(IdeLogLevel.INTERACTION.getSlf4jMarker(),
7✔
132
          "Your project is on IDEasy version {} and needs an update to version {}!\nPlease run 'ide update' to migrate your project",
133
          projectVersion, targetVersion);
134
    }
135
  }
1✔
136

137
  private void logGitBashLocationStatus() {
138
    Path bashPath = this.context.findBash();
4✔
139
    if (bashPath != null) {
2!
140
      LOG.info(IdeLogLevel.SUCCESS.getSlf4jMarker(), "Found bash executable at: {}", bashPath);
7✔
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
      LOG.info(IdeLogLevel.SUCCESS.getSlf4jMarker(), "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 · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc