defnamespaceLinter : Linterwhere run := withSetOptionIn fun stx ↦do
body · 9
lines
if getLinterValue linter.style.namespace (← getLinterOptions) thenfor id in (←Mathlib.Linter.getNamesFrom (stx.getPos?.getD default)) dolet declName := id.getId
if declName.hasMacroScopes thencontinuelet nm := declName.components
-- If the declaration has only one component, it's not in a namespaceif nm.length == 1thenLinter.logLint linter.style.namespace id
m!"The declaration '{declName}' is not inside a namespace. All declarations should be placed within a namespace."