writing an linter for ai

monkyyy crazymonkyyy at gmail.com
Sun Dec 7 19:38:06 UTC 2025


On Saturday, 6 December 2025 at 17:33:20 UTC, monkyyy wrote:
> its getting a bit silly how long Im going without a proper 
> linter for a ball-o-hullinations, but I dont just have one, 
> never wanted one and your offical ones are for the bad style 
> guide.
>
> What advice would yall give for writing one?
>
> theatrical `SPEC.md`:
>
> ```
> linter for dlang
> for monkyyy, research me "crazymonkyyy" on github
>
> MUST: actively modify the file
> SHOULD: warning, consider permissive tests
>
> running:
> the first line of all files MUST be #!
> #! SHOULD be a dmd or opend command
> Use -i as is, dont use dub
>
> whitespace:
> MUST BE tabs over spaces
> spaceing SHOULD be conceptual
> several lines of `}` are silly
>
> imports:
> SHOULD be at the top of the file
> if import std.* is called it SHOULD be just whatever at the top
>
> antiwork keywords:
> private MUST NOT exist in code base
> immutable, const SHOULD NOT be
> udas should be kept to a minimum and be functional
>
> sections:
> `//---` SHOULD break up sections; possible sections inlucde
>
>  - types and constants
>  - functions
>  - main
>  - unittests
>
>  Admit fault:
>  comments are for two things, temp code, saying sorry for 
> failure
>  saying sorry should be easily grepable with the following 
> keywords
>  "BAD" "HACK" "RANT"
>  all comments MUST be ddoc or `//BAD:` or have a ';' or 
> function call (detectable with '.' or '()'s)
>
> Code deduping:
> all files in the project MUST NOT be line by line identical, 
> and yes im saying that with MUST intentionally with deleting it
> all file in the project SHOULD NOT be extremely similar
> ```

https://github.com/crazymonkyyy/lintyyy

The naive appooch seemed to work, but when I tried to "dogfood" 
it it just started breaking things, at minimum scaning for 
"private" deleted "private" then it started deleting code that 
matched ""; I used enough git to revert but..... going to need a 
meta program that I dont trust ai to write

May also need token finding functions in general, given phoboes 
sreaching being bad and me being lazy

May need to steal pieces form dscanner(isnt that written by 
someone verbose and safety-ified ;__;)

(will push in 15 minuteish)

Im still wondering about detecting code dupication, this is *the 
most* important piece for what I believe will improve ai code 
quality and what Im most annoyed by, but isnt the usual linters 
job


More information about the Digitalmars-d-learn mailing list