Skip to content

no_submodules

Flag the presence of .gitmodules at the repo root — always, regardless of paths. For general “file X must not exist” checks, use file_absent.

Note the fix only deletes .gitmodules; git submodule deinit and cleaning .git/modules/ are still on the user.

This rule takes no kind-specific options.

Plus the common level, id, and when fields. This rule analyses the whole repository, so it takes no paths. This table is generated from the JSON Schema; option types and defaults are authoritative.

The rule fires on this repository:

.gitmodules
README.md
vendor/
vendor/lib/
vendor/lib/.keep
.gitmodules
[submodule "vendor/lib"]
path = vendor/lib
url = https://example.com/lib.git
README.md
# demo

With this .alint.yml:

version: 1
rules:
- id: no-submods
kind: no_submodules
level: error

alint check reports:

Terminal window
--- .gitmodules ----------------------------------------------------------------
x error no-submods
`.gitmodules` present - git submodules are forbidden
Summary (1 violation):
x 1 error
0 passing * 1 failing

This repository is compliant:

.gitignore
README.md
src/
src/main.rs
.gitignore
/target
README.md
# demo
src/main.rs
fn main() {}

With this .alint.yml:

version: 1
rules:
- id: no-submods
kind: no_submodules
level: error

alint check reports:

Terminal window
v All 1 rule(s) passed.