Peios Learn
Documentation

Peios

Peios Peios Kernel Universal Directory Project

Developer Tools

Trail Acta Provium clackatoo CAF GCSL Pekit

Applications

Framewright

Standards and Conventions

Standards and Conventions Peios Specifications
Standards and Conventions

Language Profiles

Single-page view · as markdown

Language Conventions

Standards and Conventions / Language Profiles

These profiles apply the common rules through each language's syntax and established conventions. They do not adopt every recommendation in an external styleguide. An external guide's preferences do not override explicit Peios decisions such as the shared 100-column target.

Rust

Standards and Conventions / Language Profiles

Use four spaces, a 100-column formatter target, snake_case functions/modules, PascalCase types, and SCREAMING_SNAKE_CASE constants. Follow rustfmt for mechanical layout. Use the edition and formatter version selected by the project. Required Rust braces remain required; a short early return can be expanded by the formatter.

Apply the ownership and error rules using ordinary Rust mechanisms: Option for absence, Result for expected failures, and ownership/Drop for resource lifetimes. Use mut where mutation is needed and keep visibility narrow. An unsafe block needs the safety explanation required by the common guide, including assumptions maintained outside the block.

Reference: Rust style guide.

Go

Standards and Conventions / Language Profiles

Follow gofmt, including tab indentation and automatic alignment. Use mixedCaps for unexported identifiers and MixedCaps for exported identifiers, including types and constants; initial capitalization controls visibility. Use short lowercase package names and conventional abbreviations such as ID and HTTP. These are language exceptions to the common naming table.

Keep the 100-column readability target where practical, but do not fight gofmt or treat it as a hard limit; gofmt has no configurable wrapping target. Go requires braces around control-flow bodies.

Apply the common cleanup rule using defer where its function-exit lifetime is appropriate. Check meaningful cleanup errors. Ordinary failures use error values; a goroutine still needs an owner and shutdown/failure handling.

References: Effective Go and Go code review comments.

Python

Standards and Conventions / Language Profiles

Use four spaces and the shared naming conventions. Retain the Peios 100-column target rather than adopting PEP 8's shorter line recommendation. Use docstrings for the public interfaces and non-obvious contracts covered by the common rule.

Give ordinary functions in maintained Python code type hints for parameters and return values, including functions in maintained scripts. Allow justified exceptions, and omit redundant annotations such as the usual self parameter. For example, def load_config(path: Path) -> Config makes the interface clear.

Type hints support readers and automatic checking; they do not validate incoming data at runtime. The validation-boundary rules still apply.

Use context managers for scoped resource cleanup where appropriate. Use the language's explicit absence value, None, without conflating it with valid values such as zero or an empty collection.

References: PEP 8 and Python typing guidance.

JavaScript and TypeScript

Standards and Conventions / Language Profiles

Use conventional camelCase variables/functions and PascalCase types/classes. Use the shared constant naming rule for named constants, not for every local binding declared with const. Keep four spaces and the 100-column target: a formatter's two-space default alone does not override the Peios baseline.

Apply read-only-by-default to bindings with const, and use let where reassignment is needed. Remember that const does not freeze object contents. The common optional-brace and explicit-argument rules apply.

In TypeScript, use strict type checking by default. Avoid any as a way to bypass checking; use unknown for values that must be checked before use. Allow narrow, explained exceptions where needed, such as integration with an untyped third-party interface. Type declarations alone do not validate external data.

That type-checking requirement concerns TypeScript; this guide does not itself require converting JavaScript projects to TypeScript. Apply the approved common quote preference and explicit semicolons using the pinned formatter settings.

References: TypeScript strict checking and MDN JavaScript conventions.

C

Standards and Conventions / Language Profiles

Prefer explicit struct names, such as struct Buffer, rather than introducing a typedef solely to omit the struct keyword. Allow typedefs when they provide a useful abstraction, such as an opaque library handle. Kernel-specific rules remain separately scoped.

Write pointer declarations with the star next to the declared name, as in char *name. Normally declare one variable per statement. Allow compact loop declarations when their meaning remains clear. Avoid declarations such as char* first, second, where only the first variable is a pointer.

Prefer ordinary functions, including inline functions where appropriate, over function-like macros. Use function-like macros when preprocessor capabilities are actually needed. Named constants and conditional compilation remain valid uses of the preprocessor.

The common formatting and naming defaults apply outside documented repository exceptions. This means, for example, four spaces and same-line function braces for ordinary Peios C, but the Linux profile for kernel C.

Shell

Standards and Conventions / Language Profiles

Keep shell focused on connecting existing commands. Move substantial parsing or application logic to a more suitable language, considering complexity and the available runtime rather than imposing a hard script-length cutoff.

Make the intended interpreter explicit and use syntax supported by that interpreter. Apply the error and cleanup rules to command exit statuses, pipelines, and temporary resources. Preserve argument boundaries when expanding values: filenames containing spaces must not silently become several arguments. Use four-space indentation where shell syntax permits it; syntax that requires literal tabs retains them.

Bazel and Starlark

Standards and Conventions / Language Profiles

Use four spaces, snake_case functions/variables, and explicit load imports. Use the language's underscore-prefixed private top-level names. Keep the shared 100-column readability target, allowing intact labels where splitting them is not useful. Starlark is not Python; Python-only typing and syntax rules do not apply to it.

Use buildifier as the formatting baseline. Keep target declarations readable and use shared abstractions for shared concepts rather than merely hiding repeated declarations. Document public .bzl interfaces and their contracts.

Reference: Bazel's Starlark guide.

Other Formats and Languages

Standards and Conventions / Language Profiles

Respect format-required syntax, such as tabs in Make recipes and the absence of trailing commas in JSON. Do not apply a source-language rule mechanically to a different format. Add a scoped language profile when a new language needs choices that the common policy does not settle.

Peios Learn — documentation for Peios software.

Built with Trail.