Skip to content

Commit

Permalink
Merge branch 'master' into enhancement-compare-json-objects
Browse files Browse the repository at this point in the history
  • Loading branch information
gok99 authored Feb 2, 2024
2 parents f98c571 + 7977382 commit 55d3e1f
Show file tree
Hide file tree
Showing 24 changed files with 643 additions and 175 deletions.
22 changes: 11 additions & 11 deletions docs/dg/learningBasics.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ Here are some small tasks for you to gain some basic knowledge of the code relat

Therefore, the first step you can take is to add the following to `ArgsParser`.

```
```java
public static final String[] JSON_PRINT_MODE_FLAGS = new String[]{"--use-json-pretty-printing", "-j"};
```

In `getArgumentParser` method, add the following content to make `ArgumentParser` capture the new argument.

```
```java
parser.addArgument(JSON_PRINT_MODE_FLAGS)
.dest(JSON_PRINT_MODE_FLAGS[0])
.action(Arguments.storeTrue())
Expand All @@ -102,7 +102,7 @@ Here are some small tasks for you to gain some basic knowledge of the code relat

1. Add the following content to `CliArguments` to include `isPrettyPrintingUsed` as a new attribute to the class.

```
```java
protected boolean isPrettyPrintingUsed;

public boolean isPrettyPrintingUsed() {
Expand All @@ -112,13 +112,13 @@ Here are some small tasks for you to gain some basic knowledge of the code relat

2. In the constructor of `ConfigCliArguments`, add `isPrettyPrintingUsed` as a new parameter of the method, and add the following instruction to the method body.

```
```java
this.isPrettyPrintingUsed = isPrettyPrintingUsed;
```

3. In the `parse` method of `ArgsParser`, add the following instruction to get `isJsonPrettyPrintingUsed` from `ArgmentParser`.

```
```java
boolean isJsonPrettyPrintingUsed = results.get(JSON_PRINT_MODE_FLAGS[0]);
```

Expand All @@ -139,13 +139,13 @@ Here are some small tasks for you to gain some basic knowledge of the code relat

2. Add the following content to `FileUtil`.

```
```java
private static boolean isPrettyPrintingUsed = false;
```

3. In the `writeJsonFile` method, Replace the creation of the `Gson` object with the following instructions.

```
```java
GsonBuilder gsonBuilder = new GsonBuilder()
.registerTypeAdapter(LocalDateTime.class, (JsonSerializer<LocalDateTime>) (date, typeOfSrc, context)
-> new JsonPrimitive(date.format(DateTimeFormatter.ofPattern(GITHUB_API_DATE_FORMAT))))
Expand All @@ -160,15 +160,15 @@ Here are some small tasks for you to gain some basic knowledge of the code relat

4. To notify `FileUtil` of the switch between different printing mode, add the following method to `FileUtil`.

```
```java
public static void setPrettyPrintingMode(boolean isPrettyPrintingAdopted) {
isPrettyPrintingUsed = isPrettyPrintingAdopted;
}
```

5. It is now possible to notify `FileUtil` of the printing mode switch by extracting the argument from the `CliArguments` object in the `main` method of `RepoSense.java` and passing it to the corresponding method in `FileUtil`.

```
```java
FileUtil.setPrettyPrintingMode(cliArguments.isPrettyPrintingUsed());
```

Expand Down Expand Up @@ -225,7 +225,7 @@ Here are some small tasks for you to gain some basic knowledge of the code relat

Add this to the catch block of `spawnCloneProcess` and `waitForCloneProcess`, so that the message will be captured in `summary.json`.

```
```java
ErrorSummary.getInstance().addErrorMessage(config.getDisplayName(), e.getMessage());
```
</panel>
Expand Down Expand Up @@ -358,7 +358,7 @@ Here are some small tasks for you to gain some basic knowledge of the code relat

Add this to `c_summary.scss`.

```
```css
.active-text {
color: mui-color('green');
}
Expand Down
2 changes: 1 addition & 1 deletion docs/dg/settingUp.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<box type="info" seamless>

Type `java -version`, `npm -v` and `git --version` respectively on your OS terminal and ensure that you have the correct version of each prerequisite installed.
Type `java -version`, `node -v` and `git --version` respectively on your OS terminal and ensure that you have the correct version of each prerequisite installed.
</box>

<!-- ==================================================================================================== -->
Expand Down
24 changes: 12 additions & 12 deletions docs/dg/styleGuides.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Our coding standards are mostly based on those at [se-education.org/guides](http

## Note on Ternary Operators:
Ternary operators can be used to shorten if-else blocks such as this:
```
```java
LocalDateTime min = ARBITRARY_FIRST_COMMIT_DATE_UTC.withZoneSameInstant(zoneId).toLocalDateTime();
if (!commitInfos.isEmpty()) {
min = commitInfos.get(0).getTime();
Expand All @@ -31,7 +31,7 @@ return min;
```

The result would look something like this:
```
```java
return (commitInfos.isEmpty())
? ARBITRARY_FIRST_COMMIT_DATE_UTC.withZoneSameInstant(zoneId).toLocalDateTime()
: commitInfos.get(0).getTime();
Expand All @@ -48,16 +48,16 @@ In addition to what has been mentioned in the [**Java** coding standard (SE-EDU)
* This is not necessary (although still recommended) for methods with `@Override` annotations if Javadoc is used. However, if the method that is being overriden is part of your code and has Javadoc, all parameters must be described.

Negative Examples:
```
Not okay (Only mentions zoneId parameter):
```java
// Not okay (Only mentions zoneId parameter):
/**
* Returns a {@link LocalDateTime} object adjusted for timezone given by {@code zoneId}.
*/
public LocalDateTime adjustTimeZone(LocalDateTime sinceDate, ZoneId zoneId) {
//Code here
}

Not okay (@param tag used only for zoneId)
// Not okay (@param tag used only for zoneId)
/**
* Returns a {@link LocalDateTime} object by adjusting {@code sinceDate}
* to the timezone given by {@code zoneId}.
Expand All @@ -69,8 +69,8 @@ public LocalDateTime adjustTimeZone(LocalDateTime sinceDate, ZoneId zoneId) {
}
```
Positive Example #1:
```
Okay (No @param tags):
```java
// Okay (No @param tags):
/**
* Returns a {@link LocalDateTime} object by adjusting {@code sinceDate}
* to the timezone given by {@code zoneId}.
Expand All @@ -80,8 +80,8 @@ public LocalDateTime adjustTimeZone(LocalDateTime sinceDate, ZoneId zoneId) {
}
```
Positive Example #2:
```
Okay (@param tags used for all inputs):
```java
// Okay (@param tags used for all inputs):
/**
* Returns a {@link LocalDateTime} object by adjusting {@code sinceDate}
* to the timezone given by {@code zoneId}.
Expand All @@ -98,8 +98,8 @@ public LocalDateTime adjustTimeZone(LocalDateTime sinceDate, ZoneId zoneId) {
* This requirement does not apply to test code.
* One `@throws` tag per unique exception.
* The order of exceptions in the `@throws` tag block should match that of the method's `throws` statement.
```
Not okay (order of exceptions in tag block and method signature do not match):
```java
// Not okay (order of exceptions in tag block and method signature do not match):
/**
* Returns a {@link LocalDateTime} object from {@code dateString}.
*
Expand All @@ -111,7 +111,7 @@ public LocalDateTime parseDate(String dateString) throws NullPointerException, P
// Code here
}

Should be:
// Should be:
/**
* Returns a {@link LocalDateTime} object from {@code dateString}.
*
Expand Down
6 changes: 3 additions & 3 deletions docs/ug/configFiles.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,15 +190,15 @@ Date: Fri Feb 9 19:13:13 2018 +0800
```
`ActualGitHostId` and `ConfiguredAuthorName` are both `Git Author Name` of the same author.<br>
To find the author name that you are currently using for your current git repository, run the following command within your git repository:
``` {.no-line-numbers}
``` shell {.no-line-numbers}
git config user.name
```
To set the author name to the value you want (e.g., to set it to your GitHub username) for your current git repository, you can use the following command ([more info](https://www.git-tower.com/learn/git/faq/change-author-name-email)):
``` {.no-line-numbers}
``` shell {.no-line-numbers}
git config user.name "YOUR_AUTHOR_NAME”
```
To set the author name to use a default value you want for future git repositories, you can use the following command:
``` {.no-line-numbers}
``` shell {.no-line-numbers}
git config --global user.name "YOUR_AUTHOR_NAME”
```
RepoSense expects the Git Author Name to be the same as author's username on the Git hosting platform (GitHub, GitLab, BitBucket). If an author's `Git Author Name` is different from their username on the Git hosting platform, the `Git Author Name` needs to be specified in the standalone config file. If the author has more than one `Git Author Name`, multiple values can be entered too.
Expand Down
21 changes: 20 additions & 1 deletion frontend/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,26 @@
}
],
"@typescript-eslint/member-delimiter-style": "error",
"@typescript-eslint/type-annotation-spacing": "error"
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/array-type": [
"error",
{
"default": "array-simple",
"readonly": "array-simple"
}
]
}
},
{
"files": ["*.vue"],
"rules": {
"@typescript-eslint/array-type": [
"error",
{
"default": "generic",
"readonly": "generic"
}
]
}
}
]
Expand Down
4 changes: 3 additions & 1 deletion frontend/.stylelintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
"scss/no-global-function-names": null,
"selector-type-no-unknown": null,
"at-rule-no-unknown": null,
"no-duplicate-selectors": null
"no-duplicate-selectors": null,
"block-opening-brace-space-before": "always",
"declaration-colon-space-before": "never"
}
}
Loading

0 comments on commit 55d3e1f

Please sign in to comment.