Code style
Pureline
Spec 1.1 47 rules 5 Language profiles
Code without noise.
My own code style. Linear control flow, explicit intent, no unnecessary code — fully documented with stable rule IDs and profiles for Java, JavaScript, TypeScript, Go and Crystal.
Five principles
- Linear Flow
- Explicit Intent
- Minimal Noise
- Small Units
- Clear Ownership
PL-CF-001
The difference
The same logic twice. Nested, the happy path keeps drifting to the right — with guard clauses it stays at the base level.
if (request != null) {
if (request.valid()) {
var session = sessions.create(request.user());
return executor.execute(session, request);
} else {
return Result.invalid();
}
}
return Result.empty(); if (request == null) {
return Result.empty();
}
if (!request.valid()) {
return Result.invalid();
}
var session = sessions.create(request.user());
return executor.execute(session, request); Pureline Core
The core rules
They apply to every language, as far as the language allows them naturally.
- PL-CORE-001 Control flow should be as linear as possible
- PL-CORE-002 Avoid
else - PL-CORE-003 Prefer guard clauses
- PL-CORE-004 Use the clearest control-flow form for the language; brace-based languages use explicit blocks
- PL-CORE-005 Idiomatic language-native shorthand is allowed when it remains immediately readable
- PL-CORE-006 Functions should be small and focused
- PL-CORE-007 Names must carry meaning
- PL-CORE-008 Avoid unnecessary abstractions
- PL-CORE-009 Avoid God Classes and God Modules
- PL-CORE-010 Prefer immutable state
- PL-CORE-011 Prefer modern language features where they improve clarity
- PL-CORE-012 Avoid unnecessary vertical formatting
- PL-CORE-013 Comments must not compensate for unclear code
- PL-CORE-014 Handle invalid and error states early
- PL-CORE-015 Keep important side effects visible
- PL-CORE-016 Resources must have a clear lifecycle
- PL-CORE-017 Prefer framework-native APIs
- PL-CORE-018 Avoid magic values
- PL-CORE-019 Make dependencies explicit
- PL-CORE-020 Optimize hot paths deliberately, not accidentally
Chapters
The specification
Every chapter with rules, reasoning and code examples — what Pureline is and what it is not.
Architecture & practice
Language profiles
Java 10 rules
- Package by Responsibility
- Naming
- Prefer Records for Immutable Data
- Braces Are Mandatory
- Use Semicolons
- const First
- Avoid any
- Use Types Deliberately
- No Java-Style I Prefix
- Error Guards
- Avoid else After Terminating Branches
- Naming Must Remain Idiomatic
- Idiomatic Postfix Guards Are Allowed
- Avoid else
- Idiomatic Naming
Tooling
One rule set, everywhere
Checker, formatter, CLI and IDE plugins share the same specification. Every diagnostic references a stable rule ID.
- Pureline Checker
- Pureline Formatter
- Pureline CLI
- IntelliJ Plugin
- VS Code Extension
- Eclipse Plugin
- future IDE integrations
PL-CF-002
Avoid else after a terminating branch.
Line 48:
} else {
Suggested fix:
Remove the else block and continue with the happy path. How Pureline code should feel
- linear
- explicit
- compact
- modern
- low-noise
- modular
- predictable
- easy to scan
- easy to refactor
- hard to misunderstand
Code without noise.
Pureline standardizes principles, not syntax.