-
Notifications
You must be signed in to change notification settings - Fork 0
Style Guide
This is a style guide that all files in this repository should follow
All Subsystems should follow the following rules.
1. All Subsystems should contain a README.md
All subsystems should contain a README.md with a brief description and a link to its respective wiki page.
2. Folder structure
Follow this folder structure
Arm
├── Cmd
│ ├── Cmd_ArmDefault.java
│ ├── Cmd_ArmExtensionPID.java
│ └── Cmd_ArmShoulderPID.java
├── Const_Arm.java
└── SubSys_Arm.java
In this example, Arm is the root folder of the subsystem. Contained inside this there is a constants file and a subsystem file that follows our file name guide. There is also a directory named Cmd this folder holds our commands that use this given subsystem. Most likely a default command or an autonomous command.
WORK IN PROGRESS
- Subsystem files should be prfixed with SubSys_ Notice the capital S in Sys
- Command flies should be prfixed with Cmd_
- Command Group files should be prefixed with CmdGrp_
- Constants file should be prefixed with
1. Use generalized method names. Global method names for something that does something physical on the robot:
(What part it affects)(Where that part is/subpart if applicable)(What it is doing to that part/how it is changing it)(What input it needs)
For example, if we had a subsystem named SubSys_Arm.java we would base our method names on that. Assume inside this subsystem we had a method that raised the arm given a set amount of power -1 -> 1. We would create a method named something like this.
ArmRotatePercentOutput()
Arm is the part of the physical robot that is being affected. Then we have Rotate which is what the Arm is doing. Finally, we have PercentOutput this shows that the method needs a double value inputted or a percent.
2. Avoid nesting and unstyled code Code should not be nested more than three layers deep as it becomes extremely confusing for other developers to understand. A good general rule of thumb is to create a function for what would otherwise be nested code if you need that level of function. The code should also be styled generally. Deepsource should automatically fix your styling but please be sure to try to keep the code as neat as possible.