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

devonfw / IDEasy / 38742671777

15 Oct 2026 01:26PM UTC coverage: 74.782% (+0.2%) from 74.57%
38742671777

Pull #2525

github

web-flow
Merge 4fcc7cc8f into 7e7928d01
Pull Request #2525: #2452: Fixed checkstyle violations in cli module

5866 of 8721 branches covered (67.26%)

Branch coverage included in aggregate %.

15343 of 19640 relevant lines covered (78.12%)

3.36 hits per line

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

81.37
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.getOs(), systemInfo.getOsVersion(), systemInfo.getArchitecture(),
23 ✔
79
        systemInfo.getOsName(), systemInfo.getArchitectureName());
7 ✔
80
  }
1 ✔
81

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

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

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

127
  private void logMigrationStatus() {
128

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

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

154
  @Override
155
  public boolean isIdeRootRequired() {
156

157
    return false;
2 ✔
158
  }
159
}
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