language-limit

A place in the project holds more or fewer files of a language than its limit.

Group
Code
Runs
Optional: run it with ur lint --rule language-limit
Level
warning
Reads
Every file
Fix
None: which files go is a design choice

Why

An entry of the [architecture.languages] table in .ur/ur.toml may limit how many files of a language its glob covers, as at_most = { rust = 412 } does. A place over its limit holds a file too many, and one under it has lost files the limit still allows, so the limit comes down as files go and a language being retired from a place stays retired. Files an entry leaves alone are not counted.

The fix, as Ur suggests it: remove the files over the limit, or lower the limit to the files left.

For agents

Never add a file of a language to a place at its at_most limit in .ur/ur.toml; when files of it go, lower the limit to the count left.

Example

.ur/ur.toml
[architecture.languages]
"ecosystems" = { at_most = { rust = 1 } }
ecosystems/toml/src/parser.rs
pub fn parse(text: &str) -> Vec<&str> {
    text.split_whitespace().collect()
}
ecosystems/toml/src/printer.rs
pub fn print(words: &[&str]) -> String {
    words.join(" ")
}
What Ur prints
$ ur lint --rule language-limit
warning[language-limit]: `ecosystems` holds 2 `rust` files, more than the 1 it allows
  --> .ur/ur.toml:2:1 `ecosystems` says so
  = hint: remove the files over the limit, or lower the limit to the files left
0 clone classes and 1 `language-limit` finding in 3 files

Try it in the playground →