E5CB Coding Standards · axyl-casc/Scheduler-Designer Wiki · GitHub
[go: up one dir, main page]

Skip to content

Coding Standards

Axyl S edited this page Dec 6, 2024 · 4 revisions

Wiki Documentation: Coding Standards and Error Reporting for Our Project

Code Formatting

Our team has agreed upon specific coding standards to maintain code consistency, readability, and maintainability throughout the project. This section outlines the standards we follow for code formatting.

  1. Indentation:

    • We use 4 spaces per tab for indentation throughout the project.
    • No trailing whitespace should be left at the end of any line.
  2. Braces and Block Structures:

    • Place the opening brace { on the same line as the control statement.
    • Example:
      if (condition) {
          // Code block
      }
  3. Line Length:

    • Try to keep lines to 80 characters to maintain code readability.
  4. Function Definitions:

    • Functions must follow the format:
      function function_name(parameters){
          // function body
      }
  5. Commenting and Documentation:

    • Use /** ... */ for function documentation, explaining its purpose, parameters, and return values.
    • Inline comments are encouraged where the logic is non-obvious, using //.
  6. Naming Conventions:

    • Variables: Use snake_case for names, e.g., is_running.
    • Functions: Use camelCase for functions, e.g., setScheduler().
    • Constants: Use ALL_CAPS_WITH_UNDERSCORES.

Reference

Our coding standards are aligned with the Linux Kernel Coding Style, with minor adjustments for team preferences, such as the use of 4-space tabs instead of 8 and same line function curly braces.


Error Reporting

All errors in our project will be reported using the showToast function to ensure consistency and clarity. Each error message must follow the format:

Example Usage

console.log("No scheduler selected");

Clone this wiki locally

0