Skip to content

Commit

Permalink
Clarify Javadoc style
Browse files Browse the repository at this point in the history
  • Loading branch information
CoffeeCoder1 authored Jan 9, 2025
1 parent fe1b653 commit 72e9316
Showing 1 changed file with 22 additions and 19 deletions.
41 changes: 22 additions & 19 deletions docs/style-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,33 +139,36 @@ Methods within a class SHOULD be in the following order.
# Javadoc

* Java classes, methods, and constants MUST have a valid and complete Javadoc entry accompanying them
* MUST describe the full function of the object they are documenting
* MUST accurately describe the function of any parameters
* MUST describe the return type and returned object if applicable
* SHOULD include any implementation specifics that might be useful to whoever is using the object
* Javadoc entries MUST describe the full function of the object they are documenting, even if the description is redundant with the name of the object
* Javadoc entries MUST accurately describe the function of any parameters
* Javadoc entries MUST describe the return type and returned object if applicable
* Javadoc entries SHOULD include any implementation specifics that might be useful to whoever is using the object
* Javadoc entries SHOULD be written in sentence case with appropriate punctuation
* Descriptions of Javadoc annotations like `@param` and `@return` MUST be on the next line
* References to classes MUST be linked to the classes they are referencing to make browsing the hosted Javadoc easier

Examples:
```java
/**
* safely set the target angle for the arm
*
* @param targetDegrees
* the target angle for the arm in degrees
*/
public void setArmTarget(double targetDegrees) {
...
}
* Safely sets the target angle for the arm.
*
* @param targetDegrees
* the target angle for the arm in degrees
*/
public void setArmTarget(double targetDegrees) {
...
}
```
```java
/**
* get the velocity of the arm
*
* @return the velocity of the arm in m/s
*/
public double getArmVelocity(){
...
}
* Gets the velocity of the arm.
*
* @return
* the velocity of the arm in m/s
*/
public double getArmVelocity(){
...
}
```
When you hover over a function with Javadoc anywhere in the project it will apear.
![Javadoc in VSCode](/code-standards/assets/images/javadoc-vscode.png)
Expand Down

0 comments on commit 72e9316

Please sign in to comment.