-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#1958] Use syntax coloring for code blocks in docs #2099
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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(); | ||||||
|
@@ -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(); | ||||||
|
@@ -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): | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Would be good to add a space here after the comment, and update the other There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh oops, I must have forgotten to add the space after changing all the code blocks. It should be fixed in the new commit! |
||||||
/** | ||||||
* 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}. | ||||||
|
@@ -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}. | ||||||
|
@@ -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}. | ||||||
|
@@ -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}. | ||||||
* | ||||||
|
@@ -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}. | ||||||
* | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't believe MarkBind supports the
vue
code block, perhaps we could either use another code block syntax highlighting, or remove it altogether.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, I have removed the
vue
tag from the code, it should look better now!