Skip to content

Commit 7683840

Browse files
feat(standards): add Swift and Kotlin standards pages and blog posts
Add standards documentation pages for Swift (SwiftLint, swift-format, swift test) and Kotlin (ktlint, detekt, Gradle). Add announcement blog posts for both language ecosystems. Update standards index with new languages in the support matrix. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 808bda9 commit 7683840

File tree

5 files changed

+444
-15
lines changed

5 files changed

+444
-15
lines changed
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
---
2+
title: "Kotlin Language Support"
3+
date: 2026-03-23
4+
description: "DevRail now supports Kotlin with ktlint, detekt, and Gradle -- covering both server-side and Android Kotlin development."
5+
---
6+
7+
DevRail now supports Kotlin as its tenth language ecosystem. Whether you are building server-side Kotlin services or Android applications, DevRail provides consistent linting, static analysis, testing, and security scanning through the same Makefile targets and CI pipelines used by every other supported language.
8+
9+
## What's Included
10+
11+
The dev-toolchain container ships JDK 21, the Kotlin compiler, Gradle, and dedicated analysis tools:
12+
13+
- **ktlint** -- Kotlin linter and formatter that enforces the official Kotlin coding conventions, serving as a dual-purpose tool for both style checking and auto-formatting
14+
- **detekt** -- configurable static code analysis for Kotlin, covering complexity, potential bugs, and code smells
15+
- **Gradle** -- the standard Kotlin build tool, used for running tests and dependency analysis
16+
- **OWASP dependency-check** -- Gradle plugin for scanning dependencies against the National Vulnerability Database
17+
- **trivy** -- universal dependency scanning for Gradle projects
18+
19+
JDK 21 (Eclipse Temurin) is included in the container alongside the Kotlin compiler and Gradle distribution.
20+
21+
## Configuration
22+
23+
Add `kotlin` to your `.devrail.yml`:
24+
25+
```yaml
26+
languages:
27+
- kotlin
28+
```
29+
30+
ktlint reads `.editorconfig` at the repository root -- no separate config file needed. detekt reads `detekt.yml` for static analysis rules. Both are scaffolded by `devrail init` when Kotlin is declared.
31+
32+
## Makefile Targets
33+
34+
The standard targets work out of the box:
35+
36+
```bash
37+
make lint # ktlint + detekt (if detekt.yml exists)
38+
make format # ktlint --format --dry-run
39+
make fix # ktlint --format
40+
make test # gradle test (if build.gradle.kts or build.gradle exists)
41+
make security # gradle dependencyCheckAnalyze (OWASP)
42+
make check # all of the above
43+
```
44+
45+
## Android Projects
46+
47+
The container handles ktlint, detekt, and Gradle test for all Kotlin projects. Android-specific checks (Android Lint) require the Android SDK, which is not included in the container. For Android projects, configure a separate CI job:
48+
49+
```yaml
50+
# GitHub Actions example -- Android Lint job
51+
- name: Run Android Lint
52+
runs-on: ubuntu-latest
53+
steps:
54+
- uses: actions/checkout@v4
55+
- uses: actions/setup-java@v4
56+
with:
57+
distribution: temurin
58+
java-version: 21
59+
- name: Setup Android SDK
60+
uses: android-actions/setup-android@v3
61+
- run: ./gradlew lint
62+
```
63+
64+
Server-side Kotlin projects (Spring Boot, Ktor, etc.) work entirely inside the container with no additional setup.
65+
66+
## Pre-Commit Hooks
67+
68+
ktlint runs as a local pre-commit hook (under 30 seconds):
69+
70+
```yaml
71+
repos:
72+
- repo: https://github.com/JetBrains/ktlint-pre-commit-hook
73+
rev: v1.5.0
74+
hooks:
75+
- id: ktlint
76+
```
77+
78+
## Getting Started
79+
80+
Pull the latest container and add Kotlin to your project:
81+
82+
```bash
83+
docker pull ghcr.io/devrail-dev/dev-toolchain:v1
84+
```
85+
86+
Or use `devrail init` to set up a new Kotlin project:
87+
88+
```bash
89+
curl -fsSL https://devrail.dev/init.sh | bash -s -- --languages kotlin --ci github --all
90+
```
91+
92+
See the [Kotlin Standards](/docs/standards/kotlin/) page for the full configuration reference.
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
---
2+
title: "Swift Language Support"
3+
date: 2026-03-23
4+
description: "DevRail now supports Swift with SwiftLint, swift-format, and swift test -- bringing Apple-platform development into the standards-driven workflow."
5+
---
6+
7+
DevRail now supports Swift as its ninth language ecosystem. Swift projects get the same standards-driven workflow as every other DevRail-supported language: linting, formatting, testing, and security scanning through consistent Makefile targets and CI pipelines.
8+
9+
## What's Included
10+
11+
The dev-toolchain container ships the full Swift toolchain alongside dedicated linting and formatting tools:
12+
13+
- **SwiftLint** -- the de facto standard Swift linter, enforcing style and convention rules with extensive opt-in rule coverage
14+
- **swift-format** -- Apple's official code formatter, handling all whitespace, indentation, and line-breaking decisions
15+
- **swift test** -- Swift Package Manager's built-in test runner for SPM-based projects
16+
- **trivy** -- universal dependency scanning via `Package.resolved`
17+
18+
The full Swift toolchain (swiftc, swift build, swift test, Swift Package Manager) is included in the container, COPY'd from the official `swift:6.1-slim-bookworm` image.
19+
20+
## Configuration
21+
22+
Add `swift` to your `.devrail.yml`:
23+
24+
```yaml
25+
languages:
26+
- swift
27+
```
28+
29+
SwiftLint reads `.swiftlint.yml` at the repository root. swift-format reads `.swift-format` (JSON). Both config files are scaffolded by `devrail init` when Swift is declared.
30+
31+
## Makefile Targets
32+
33+
The standard targets work out of the box:
34+
35+
```bash
36+
make lint # swiftlint lint --strict
37+
make format # swift-format lint --strict -r .
38+
make fix # swift-format format -i -r .
39+
make test # swift test (if Package.swift exists)
40+
make check # all of the above
41+
```
42+
43+
## Xcode Projects
44+
45+
The container runs on Linux, so `xcodebuild` is not available inside it. For Xcode-based projects (iOS, macOS apps), the container handles linting and formatting. Testing requires a separate macOS CI runner:
46+
47+
```yaml
48+
# GitHub Actions example -- macOS job for xcodebuild
49+
- name: Run Xcode tests
50+
runs-on: macos-latest
51+
steps:
52+
- uses: actions/checkout@v4
53+
- run: xcodebuild test -scheme MyApp -destination 'platform=iOS Simulator,name=iPhone 16'
54+
```
55+
56+
SPM-based projects (those with `Package.swift`) run `swift test` inside the container with no additional setup.
57+
58+
## Pre-Commit Hooks
59+
60+
SwiftLint runs as a local pre-commit hook (under 30 seconds):
61+
62+
```yaml
63+
repos:
64+
- repo: https://github.com/realm/SwiftLint
65+
rev: 0.58.0
66+
hooks:
67+
- id: swiftlint
68+
args: ["lint", "--strict"]
69+
```
70+
71+
## Getting Started
72+
73+
Pull the latest container and add Swift to your project:
74+
75+
```bash
76+
docker pull ghcr.io/devrail-dev/dev-toolchain:v1
77+
```
78+
79+
Or use `devrail init` to set up a new Swift project:
80+
81+
```bash
82+
curl -fsSL https://devrail.dev/init.sh | bash -s -- --languages swift --ci github --all
83+
```
84+
85+
See the [Swift Standards](/docs/standards/swift/) page for the full configuration reference.

content/docs/standards/_index.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: "Standards"
33
linkTitle: "Standards"
44
weight: 20
5-
description: "Per-language tooling standards for Python, Bash, Terraform, Ansible, Ruby, Go, JavaScript/TypeScript, Rust, and universal security tools."
5+
description: "Per-language tooling standards for Python, Bash, Terraform, Ansible, Ruby, Go, JavaScript/TypeScript, Rust, Swift, Kotlin, and universal security tools."
66
---
77

88
DevRail defines opinionated tooling standards for each supported language ecosystem. Every tool is pre-installed in the dev-toolchain container and invoked through consistent Makefile targets.
@@ -11,15 +11,15 @@ DevRail defines opinionated tooling standards for each supported language ecosys
1111

1212
The following table shows the default tool for each concern per language. These tools are pre-installed in the `dev-toolchain` container.
1313

14-
| Concern | Python | Bash | Terraform | Ansible | Ruby | Go | JavaScript | Rust |
15-
|---|---|---|---|---|---|---|---|---|
16-
| Linter | ruff | shellcheck | tflint | ansible-lint | rubocop, reek | golangci-lint | eslint | clippy |
17-
| Formatter | ruff format | shfmt | terraform fmt, terragrunt hclfmt | -- | rubocop | gofumpt | prettier | rustfmt |
18-
| Security | bandit, semgrep | -- | tfsec, checkov | -- | brakeman, bundler-audit | govulncheck | npm audit | cargo-audit, cargo-deny |
19-
| Tests | pytest | bats | terratest | molecule | rspec | go test | vitest | cargo test |
20-
| Type Check | mypy | -- | -- | -- | sorbet | -- | tsc | -- |
21-
| Docs | -- | -- | terraform-docs | -- | -- | -- | -- | -- |
22-
| Universal | trivy, gitleaks, git-cliff | trivy, gitleaks, git-cliff | trivy, gitleaks, git-cliff | trivy, gitleaks, git-cliff | trivy, gitleaks, git-cliff | trivy, gitleaks, git-cliff | trivy, gitleaks, git-cliff | trivy, gitleaks, git-cliff |
14+
| Concern | Python | Bash | Terraform | Ansible | Ruby | Go | JavaScript | Rust | Swift | Kotlin |
15+
|---|---|---|---|---|---|---|---|---|---|---|
16+
| Linter | ruff | shellcheck | tflint | ansible-lint | rubocop, reek | golangci-lint | eslint | clippy | SwiftLint | ktlint, detekt |
17+
| Formatter | ruff format | shfmt | terraform fmt, terragrunt hclfmt | -- | rubocop | gofumpt | prettier | rustfmt | swift-format | ktlint |
18+
| Security | bandit, semgrep | -- | tfsec, checkov | -- | brakeman, bundler-audit | govulncheck | npm audit | cargo-audit, cargo-deny | -- | OWASP dependency-check |
19+
| Tests | pytest | bats | terratest | molecule | rspec | go test | vitest | cargo test | swift test | gradle test |
20+
| Type Check | mypy | -- | -- | -- | sorbet | -- | tsc | -- | -- | -- |
21+
| Docs | -- | -- | terraform-docs | -- | -- | -- | -- | -- | -- | -- |
22+
| Universal | trivy, gitleaks, git-cliff | trivy, gitleaks, git-cliff | trivy, gitleaks, git-cliff | trivy, gitleaks, git-cliff | trivy, gitleaks, git-cliff | trivy, gitleaks, git-cliff | trivy, gitleaks, git-cliff | trivy, gitleaks, git-cliff | trivy, gitleaks, git-cliff | trivy, gitleaks, git-cliff |
2323

2424
A `--` entry means the concern does not apply to that language. Universal tools run for all projects regardless of declared languages.
2525

@@ -29,11 +29,11 @@ Each Makefile target runs the relevant tools for all languages declared in `.dev
2929

3030
| Target | What It Runs |
3131
|---|---|
32-
| `make lint` | ruff check, shellcheck, tflint, ansible-lint, mypy, rubocop, reek, golangci-lint, eslint, tsc, clippy |
33-
| `make format` | ruff format --check, shfmt -d, terraform fmt -check, terragrunt hclfmt --terragrunt-check, rubocop --check, gofumpt -d, prettier --check, cargo fmt --check |
34-
| `make fix` | ruff format, shfmt -w, terraform fmt, terragrunt hclfmt, rubocop -a, gofumpt -w, prettier --write, cargo fmt |
35-
| `make test` | pytest, bats, terratest, molecule, rspec, go test, vitest, cargo test |
36-
| `make security` | bandit, semgrep, tfsec, checkov, brakeman, bundler-audit, govulncheck, npm audit, cargo-audit, cargo-deny |
32+
| `make lint` | ruff check, shellcheck, tflint, ansible-lint, mypy, rubocop, reek, golangci-lint, eslint, tsc, clippy, SwiftLint, ktlint, detekt |
33+
| `make format` | ruff format --check, shfmt -d, terraform fmt -check, terragrunt hclfmt --terragrunt-check, rubocop --check, gofumpt -d, prettier --check, cargo fmt --check, swift-format lint, ktlint --format --dry-run |
34+
| `make fix` | ruff format, shfmt -w, terraform fmt, terragrunt hclfmt, rubocop -a, gofumpt -w, prettier --write, cargo fmt, swift-format format, ktlint --format |
35+
| `make test` | pytest, bats, terratest, molecule, rspec, go test, vitest, cargo test, swift test, gradle test |
36+
| `make security` | bandit, semgrep, tfsec, checkov, brakeman, bundler-audit, govulncheck, npm audit, cargo-audit, cargo-deny, OWASP dependency-check |
3737
| `make scan` | trivy, gitleaks (universal -- all projects) |
3838
| `make docs` | terraform-docs |
3939
| `make changelog` | git-cliff (generate CHANGELOG.md from conventional commits) |
@@ -50,6 +50,8 @@ Each Makefile target runs the relevant tools for all languages declared in `.dev
5050
- [Go Standards](/docs/standards/go/) -- golangci-lint, gofumpt, govulncheck, go test
5151
- [JavaScript Standards](/docs/standards/javascript/) -- eslint, prettier, npm audit, vitest, tsc
5252
- [Rust Standards](/docs/standards/rust/) -- clippy, rustfmt, cargo-audit, cargo-deny, cargo test
53+
- [Swift Standards](/docs/standards/swift/) -- SwiftLint, swift-format, swift test, xcodebuild
54+
- [Kotlin Standards](/docs/standards/kotlin/) -- ktlint, detekt, Gradle, Android Lint
5355
- [Universal Security](/docs/standards/universal/) -- trivy, gitleaks, git-cliff
5456

5557
## Consistent Page Structure

content/docs/standards/kotlin.md

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
---
2+
title: "Kotlin"
3+
linkTitle: "Kotlin"
4+
weight: 50
5+
description: "Kotlin tooling standards: ktlint, detekt, Gradle, and Android Lint."
6+
---
7+
8+
Kotlin projects use ktlint for linting and formatting, detekt for static analysis, Gradle for building and testing, and Android Lint for Android-specific checks on CI.
9+
10+
## Tools
11+
12+
| Category | Tool | Purpose |
13+
|---|---|---|
14+
| Linter / Formatter | ktlint | Kotlin linter and formatter (official coding conventions) |
15+
| Static Analysis | detekt | Configurable static code analysis |
16+
| Build / Tests | Gradle | Build tool and test runner (`gradle test`) |
17+
| Security | OWASP dependency-check | Dependency vulnerability scanning (Gradle plugin) |
18+
| Android Lint | Android Lint | Android-specific checks (requires Android SDK, CI-only) |
19+
20+
All tools except Android Lint are pre-installed in the dev-toolchain container. Do not install them on the host.
21+
22+
## Configuration
23+
24+
### ktlint
25+
26+
Config file: `.editorconfig` at repository root (ktlint respects EditorConfig).
27+
28+
```ini
29+
# .editorconfig -- ktlint configuration
30+
[*.{kt,kts}]
31+
indent_size = 4
32+
max_line_length = 120
33+
ktlint_code_style = ktlint_official
34+
```
35+
36+
ktlint enforces the official Kotlin coding conventions. No separate config file is needed beyond `.editorconfig`.
37+
38+
### detekt
39+
40+
Config file: `detekt.yml` at repository root.
41+
42+
```yaml
43+
# detekt.yml -- DevRail Kotlin static analysis configuration
44+
build:
45+
maxIssues: 0
46+
47+
complexity:
48+
LongMethod:
49+
threshold: 50
50+
LongParameterList:
51+
functionThreshold: 7
52+
ComplexMethod:
53+
threshold: 15
54+
55+
style:
56+
MagicNumber:
57+
active: true
58+
ignoreNumbers: ["-1", "0", "1", "2"]
59+
MaxLineLength:
60+
maxLineLength: 120
61+
WildcardImport:
62+
active: true
63+
64+
potential-bugs:
65+
UnsafeCast:
66+
active: true
67+
```
68+
69+
Setting `maxIssues: 0` causes any finding to fail the build.
70+
71+
### Gradle (OWASP dependency-check)
72+
73+
Add the plugin to `build.gradle.kts`:
74+
75+
```kotlin
76+
plugins {
77+
id("org.owasp.dependencycheck") version "11.1.1"
78+
}
79+
80+
dependencyCheck {
81+
failBuildOnCVSS = 7.0f
82+
formats = listOf("HTML", "JSON")
83+
}
84+
```
85+
86+
## Makefile Targets
87+
88+
| Target | Command | Description |
89+
|---|---|---|
90+
| `make lint` | `ktlint` | Lint all Kotlin files |
91+
| `make lint` | `detekt --build-upon-default-config --config detekt.yml` | Static analysis (if `detekt.yml` exists) |
92+
| `make format` | `ktlint --format --dry-run` | Check formatting |
93+
| `make fix` | `ktlint --format` | Apply formatting fixes |
94+
| `make security` | `gradle dependencyCheckAnalyze` | OWASP dependency scanning |
95+
| `make test` | `gradle test` | Run test suite |
96+
97+
## Pre-Commit Hooks
98+
99+
### Local Hooks (run on every commit, under 30 seconds)
100+
101+
ktlint runs on every commit to catch lint and formatting issues:
102+
103+
```yaml
104+
# .pre-commit-config.yaml -- Kotlin hooks
105+
repos:
106+
- repo: https://github.com/JetBrains/ktlint-pre-commit-hook
107+
rev: v1.5.0
108+
hooks:
109+
- id: ktlint
110+
```
111+
112+
### CI-Only (too slow for local hooks)
113+
114+
- `detekt` -- static code analysis (requires full project context)
115+
- `gradle test` -- full test suite
116+
- `gradle dependencyCheckAnalyze` -- OWASP dependency vulnerability scanning
117+
- `gradle lint` -- Android Lint (Android projects only, requires Android SDK)
118+
119+
## Notes
120+
121+
- **ktlint is dual-purpose: linter and formatter.** It checks and enforces the official Kotlin coding conventions. Run `ktlint` to check and `ktlint --format` to fix.
122+
- **detekt complements ktlint.** While ktlint focuses on style and formatting, detekt provides deeper static analysis (complexity, potential bugs, code smells). Both run in CI.
123+
- **Gradle is the standard build tool.** Both `gradle test` and dependency checking require Gradle. The container ships Gradle and JDK 21 so projects do not need the Gradle wrapper, though `gradlew` is supported if present.
124+
- **Android Lint requires the Android SDK.** For Android projects, configure a separate CI job with the Android SDK. The container handles ktlint, detekt, and Gradle test for all Kotlin projects.
125+
- **JDK 21 is included in the container.** Eclipse Temurin JDK 21 is COPY'd from a builder stage.
126+
- **`build.gradle.kts` or `build.gradle` presence gates testing.** If neither file exists, Gradle commands are skipped.
127+
- **ktlint uses `.editorconfig` for configuration.** Consistent with DevRail's `.editorconfig`-first approach.
128+
- **All tools are pre-installed in the dev-toolchain container.** Do not install them on the host.
129+
- For cross-cutting coding practices and git workflow standards that apply to all languages, see [Coding Practices](/docs/standards/practices/).

0 commit comments

Comments
 (0)