Skip to content

Code Style

Dmitrii Karataev edited this page Feb 26, 2026 · 2 revisions

Code Style

RocketRide Engine is a multi-language project. This page defines the style guidelines for each language and the tooling used to enforce them.

C++ (Core and Engine Libraries)

Standard: C++17

  • Use meaningful variable and function names.
  • Add comments for complex logic.
  • Follow the existing code style in packages/server/.
  • Include the MIT license header at the top of every new file.
// MIT License
// Copyright (c) 2026 RocketRide, Inc.
// ...

No automated formatter is enforced for C++. Follow the conventions established in the existing codebase.

Python (Nodes, AI, Client SDK)

Standard: PEP 8

Tooling: Ruff for linting and formatting.

Key rules:

  • Use single quotes for strings (configured in Ruff).
  • Add type hints to function signatures.
  • Write docstrings for all public functions and classes.
  • Include the MIT license header at the top of every new file.
# MIT License
# Copyright (c) 2026 RocketRide, Inc.
# ...

def process_document(text: str, chunk_size: int = 512) -> list[str]:
    """Split text into chunks of the given size.

    Args:
        text: The input text to split.
        chunk_size: Maximum characters per chunk.

    Returns:
        A list of text chunks.
    """
    ...

Run the linter:

ruff check nodes/
ruff check packages/client-python/

TypeScript (Clients, UI, Build Scripts)

Standard: ESLint with strict TypeScript configuration.

Tooling:

  • ESLint for linting (config in eslint.config.mjs)
  • Prettier for formatting

Key rules:

  • Enable TypeScript strict mode.
  • Prefer interfaces over type aliases for object shapes.
  • Add JSDoc comments to all public APIs.
  • Include the MIT license header at the top of every new file.
/**
 * MIT License
 * Copyright (c) 2026 RocketRide, Inc.
 * ...
 */

/**
 * Configuration options for the client.
 */
interface ClientConfig {
    /** Server URI (http, https, ws, or wss). */
    uri: string;
    /** API key for authentication. */
    auth: string;
}

Run the linter:

npx eslint .

License Header

All new source files must include the MIT license header. The exact format varies by language (see examples above), but the content is the same:

MIT License

Copyright (c) 2026 RocketRide, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

General Guidelines

  • Naming -- use descriptive, meaningful names. Avoid abbreviations unless they are universally understood.
  • Comments -- explain why, not what. Code should be self-documenting where possible.
  • Tests -- new features and bug fixes should include tests. Use descriptive test names.
  • Dependencies -- minimize new dependencies. Discuss additions in the PR.

Next Steps

Clone this wiki locally