Skip to content

Commit

Permalink
[#1202] Add Javadoc for backend functions (#1364)
Browse files Browse the repository at this point in the history
Some methods in `StreamGobbler`, `CustomLogFormatter`, `FileType`, 
and `RepoConfiguration` do not have Javadoc although the methods are 
not standard getter or setter.

To enhance readability, it may be necessary to explain what they do, 
especially for `run()` in `StreamGobbler` since the method name may 
not give enough information. Additionally, there is a colon missing 
in the developer guide architecture section.

Let's add Javadoc to these methods and also add the missing colon
to the developer guide to make documentation more consistent.
  • Loading branch information
HCY123902 authored Dec 17, 2020
1 parent e396f5f commit 8b4555b
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/dg/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* [`ArgsParser`](https://github.com/reposense/RepoSense/blob/master/src/main/java/reposense/parser/ArgsParser.java): Parses the user-supplied command line arguments into a `CliArguments` object.
* [`CsvParser`](https://github.com/reposense/RepoSense/blob/master/src/main/java/reposense/parser/CsvParser.java): Abstract generic class for CSV parsing functionality. The following three classes extend `CsvParser`.
* [`AuthorConfigCsvParser`](https://github.com/reposense/RepoSense/blob/master/src/main/java/reposense/parser/AuthorConfigCsvParser.java): Parses the `author-config.csv` config file into a list of `AuthorConfiguration` for each repository to analyze.
* [`GroupConfigCsvParser`](https://github.com/reposense/RepoSense/blob/master/src/main/java/reposense/parser/GroupConfigCsvParser.java) Parses the `group-config.csv` config file into a list of `GroupConfiguration` for each repository to analyze.
* [`GroupConfigCsvParser`](https://github.com/reposense/RepoSense/blob/master/src/main/java/reposense/parser/GroupConfigCsvParser.java): Parses the `group-config.csv` config file into a list of `GroupConfiguration` for each repository to analyze.
* [`RepoConfigCsvParser`](https://github.com/reposense/RepoSense/blob/master/src/main/java/reposense/parser/RepoConfigCsvParser.java): Parses the `repo-config.csv` config file into a list of `RepoConfiguration` for each repository to analyze.
* [`JsonParser`](https://github.com/reposense/RepoSense/blob/master/src/main/java/reposense/parser/JsonParser.java): Abstract generic class for JSON parsing functionality. The following class extends `JsonParser` class:
* [`StandaloneConfigJsonParser`](https://github.com/reposense/RepoSense/blob/master/src/main/java/reposense/parser/StandaloneConfigJsonParser.java): Parses the `_reposense/config.json` config file into a `StandaloneConfig`.
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/reposense/model/FileType.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ public FileType(String label, List<String> paths) {
setPaths(paths);
}

/**
* Returns a list of {@code FileType} from {@code formats}, with each {@code FileType}
* containing the format name and associated files ending with the format.
*/
public static List<FileType> convertFormatStringsToFileTypes(List<String> formats) {
return formats.stream().map(FileType::convertStringFormatToFileType).collect(Collectors.toList());
}
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/reposense/model/RepoConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,18 @@ public void setBranch(String branch) {
authorConfig.setBranch(branch);
}

/**
* Updates the branch in the {@code displayName} to the
* current {@code branch}.
*/
public void updateDisplayName(String branch) {
this.displayName = displayName.substring(0, displayName.lastIndexOf('[') + 1) + branch + "]";
}

/**
* Updates the branch in the {@code outputFolderName} to the
* current {@code branch}.
*/
public void updateOutputFolderName(String branch) {
this.outputFolderName = outputFolderName.substring(0, outputFolderName.lastIndexOf('_') + 1) + branch;
}
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/reposense/system/CustomLogFormatter.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ public CustomLogFormatter() {
AnsiConsole.systemInstall();
}

/**
* Returns the string representation of the {@code record} with
* the timestamp in hh:mm:ss and the record severity level if applicable.
*/
@Override
public synchronized String format(LogRecord record) {
StringBuilder builder = new StringBuilder();
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/reposense/system/LogsManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,9 @@ private static ConsoleHandler createConsoleHandler() {
return consoleHandler;
}

/** Sets the log folder location using {@code location} and adds file handler with this location to all the loggers
* created.
/**
* Sets the log folder location using {@code location} and adds file handler with this location to all the loggers
* created.
*/
public static void setLogFolderLocation(Path location) {
logFolderLocation = location;
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/reposense/system/StreamGobbler.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ public String getValue() {
return value;
}

/**
* Reads from input stream {@code is} and stores it into {@code value}.
*/
@Override
public void run() {
try {
Expand Down

0 comments on commit 8b4555b

Please sign in to comment.