@@ -94,7 +94,7 @@ template styleCheckDef*(ctx: PContext; info: TLineInfo; sym: PSym; k: TSymKind)
9494 # # Check symbol definitions adhere to NEP1 style rules.
9595 if optStyleCheck in ctx.config.options and # ignore if styleChecks are off
9696 hintName in ctx.config.notes and # ignore if name checks are not requested
97- ctx.config.belongsToProjectPackage (ctx.module ) and # ignore foreign packages
97+ ctx.config.belongsToProjectPackage (sym ) and # ignore foreign packages
9898 optStyleUsages notin ctx.config.globalOptions and # ignore if requested to only check name usage
9999 sym.kind != skResult and # ignore `result`
100100 sym.kind != skTemp and # ignore temporary variables created by the compiler
@@ -135,7 +135,7 @@ template styleCheckUse*(ctx: PContext; info: TLineInfo; sym: PSym) =
135135 # # Check symbol uses match their definition's style.
136136 if {optStyleHint, optStyleError} * ctx.config.globalOptions != {} and # ignore if styleChecks are off
137137 hintName in ctx.config.notes and # ignore if name checks are not requested
138- ctx.config.belongsToProjectPackage (ctx.module ) and # ignore foreign packages
138+ ctx.config.belongsToProjectPackage (sym ) and # ignore foreign packages
139139 sym.kind != skTemp and # ignore temporary variables created by the compiler
140140 sym.name.s[0 ] in Letters and # ignore operators TODO: what about unicode symbols???
141141 sfAnon notin sym.flags: # ignore temporary variables created by the compiler
@@ -146,6 +146,10 @@ proc checkPragmaUseImpl(conf: ConfigRef; info: TLineInfo; w: TSpecialWord; pragm
146146 if pragmaName != wanted:
147147 lintReport (conf, info, wanted, pragmaName)
148148
149- template checkPragmaUse * (conf: ConfigRef ; info: TLineInfo ; w: TSpecialWord ; pragmaName: string ) =
150- if {optStyleHint, optStyleError} * conf.globalOptions != {}:
151- checkPragmaUseImpl (conf, info, w, pragmaName)
149+ template checkPragmaUse * (ctx: PContext ; info: TLineInfo ; w: TSpecialWord ; pragmaName: string , sym: PSym ) =
150+ # # Check builtin pragma uses match their definition's style.
151+ # # Note: This only applies to builtin pragmas, not user pragmas.
152+ if {optStyleHint, optStyleError} * ctx.config.globalOptions != {} and # ignore if styleChecks are off
153+ hintName in ctx.config.notes and # ignore if name checks are not requested
154+ (sym != nil and ctx.config.belongsToProjectPackage (sym)): # ignore foreign packages
155+ checkPragmaUseImpl (ctx.config, info, w, pragmaName)
0 commit comments