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

devonfw / IDEasy / 33880824479

04 Sep 2026 01:56PM UTC coverage: 73.915% (+0.1%) from 73.8%
33880824479

Pull #2335

github

web-flow
Merge abdd81846 into 5190e2e5e
Pull Request #2335: #1695: Clone settings to temporary directory, analyse, and then move

5544 of 8340 branches covered (66.47%)

Branch coverage included in aggregate %.

14439 of 18695 relevant lines covered (77.23%)

3.3 hits per line

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

80.39
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
  public boolean isWriteLogFile() {
45

46
    return false;
×
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. "
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 (!this.context.isCombinedSettingsCodeRepository()) {
×
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
    VersionIdentifier targetVersion = migrator.getTargetVersion();
3✔
131
    if (projectVersion.isLess(targetVersion)) {
4!
132
      IdeLogLevel.INTERACTION.log(LOG,
14✔
133
          "Your project is on IDEasy version {} and needs an update to version {}!\nPlease run 'ide update' to migrate your project",
134
          projectVersion, targetVersion);
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