Skip to content

filename_case

Basename (stem only or full) matches a case convention: snake, kebab, pascal, camel, screaming-snake, flat, lower, upper.

Fix: file_rename — converts the stem to the configured case, preserving extension.

OptionTypeRequiredDefaultDescription
caseone of lower | lowercase | upper | uppercase | pascal | pascalcase | PascalCase | UpperCamelCase | upper_camel | upper_camel_case | camel | camelcase | camelCase | lowerCamelCase | lower_camel | lower_camel_case | snake | snakecase | snake_case | kebab | kebabcase | kebab-case | dash | dashcase | dash-case | screaming-snake | screamingsnake | screamingsnakecase | SCREAMING_SNAKE_CASE | upper_snake | upper_snake_case | flat | flatcaseyes

Plus the common paths, level, id, and when fields. This table is generated from the JSON Schema; option types and defaults are authoritative.

Rust source files whose names break the snake_case convention

Section titled “Rust source files whose names break the snake_case convention”

The rule fires on this repository:

src/
src/BadModule.rs
src/OtherName.rs
src/good_module.rs

With this .alint.yml:

version: 1
rules:
- id: rust-snake
kind: filename_case
paths: "src/**/*.rs"
case: snake
level: error

alint check reports:

Terminal window
--- src/BadModule.rs -----------------------------------------------------------
x error rust-snake
filename stem "BadModule" is not snake_case
--- src/OtherName.rs -----------------------------------------------------------
x error rust-snake
filename stem "OtherName" is not snake_case
Summary (2 violations):
x 2 errors
0 passing * 1 failing

This repository is compliant:

src/
src/lib.rs
src/main.rs
src/nested_mod.rs
src/with1number.rs

With this .alint.yml:

version: 1
rules:
- id: rust-snake
kind: filename_case
paths: "src/**/*.rs"
case: snake
level: error

alint check reports:

Terminal window
v All 1 rule(s) passed.