Skip to content

Commit

Permalink
fix(sonar): separate folder path and file name into two constants ins…
Browse files Browse the repository at this point in the history
…tead of one
  • Loading branch information
renanfranca committed Jul 22, 2024
1 parent f1284bc commit e193b2b
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class FileSystemProjectsRepository implements ProjectsRepository {

private static final String HISTORY_FOLDER = ".jhipster/modules";
private static final String HISTORY_FILE = "history.json";
private static final String PRESET_FILE_PATH = "/preset.json";
private static final String PRESET_FOLDER = "/";
private static final String PRESET_FILE = "preset.json";

private final ObjectMapper json;
private final ProjectFormatter formatter;
Expand Down Expand Up @@ -94,9 +95,13 @@ private Path historyFilePath(ProjectPath path) {
@Override
public Collection<Preset> getPresets() {
try {
return json.readValue(projectFiles.readBytes(PRESET_FILE_PATH), PersistedPresets.class).toDomain();
return json.readValue(projectFiles.readBytes(presetFilePath()), PersistedPresets.class).toDomain();
} catch (IOException e) {
throw GeneratorException.technicalError("Can't read presets: " + e.getMessage(), e);
}
}

private String presetFilePath() {
return PRESET_FOLDER + PRESET_FILE;
}
}

0 comments on commit e193b2b

Please sign in to comment.