add astmsgs; add declared in msg for usage lint errors (#17961)

* add astmsgs; add `declared in` msg for usage lint errors

* fix test

* fix tests/tools/tlinter.nim

* std prefix
This commit is contained in:
Timothee Cour 2021-05-07 21:43:52 -07:00 • committed by GitHub
commit e224865b3b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 43 additions and 39 deletions

View file

@ -1,9 +1,11 @@
discard """
cmd: "nim c --styleCheck:error --styleCheck:usages $file"
errormsg: "'BAD_STYLE' should be: 'BADSTYLE'"
line: 20
action: reject
nimout: '''tusages.nim(22, 5) Error: 'BAD_STYLE' should be: 'BADSTYLE' [proc declared in tusages.nim(11, 6)]'''
cmd: "nim $target --styleCheck:error --styleCheck:usages $file"
"""
# xxx pending bug #17960, use: matrix: "--styleCheck:error --styleCheck:usages"
import strutils
proc BADSTYLE(c: char) = discard
@ -20,4 +22,3 @@ proc toSnakeCase(s: string): string =
BAD_STYLE(s[i])
echo toSnakeCase("fooBarBaz Yes")

View file

@ -2,12 +2,12 @@ discard """
cmd: '''nim c --styleCheck:hint $file'''
nimout: '''
tlinter.nim(21, 14) Hint: 'nosideeffect' should be: 'noSideEffect' [Name]
tlinter.nim(21, 28) Hint: 'myown' should be: 'myOwn' [Name]
tlinter.nim(21, 28) Hint: 'myown' should be: 'myOwn' [template declared in tlinter.nim(19, 9)] [Name]
tlinter.nim(21, 35) Hint: 'inLine' should be: 'inline' [Name]
tlinter.nim(25, 1) Hint: 'tyPE' should be: 'type' [Name]
tlinter.nim(23, 1) Hint: 'foO' should be: 'foo' [Name]
tlinter.nim(27, 14) Hint: 'Foo_bar' should be: 'FooBar' [Name]
tlinter.nim(29, 6) Hint: 'someVAR' should be: 'someVar' [Name]
tlinter.nim(23, 1) Hint: 'foO' should be: 'foo' [proc declared in tlinter.nim(21, 6)] [Name]
tlinter.nim(27, 14) Hint: 'Foo_bar' should be: 'FooBar' [type declared in tlinter.nim(25, 6)] [Name]
tlinter.nim(29, 6) Hint: 'someVAR' should be: 'someVar' [var declared in tlinter.nim(27, 5)] [Name]
tlinter.nim(32, 7) Hint: 'i_fool' should be: 'iFool' [Name]
tlinter.nim(39, 5) Hint: 'meh_field' should be: 'mehField' [Name]
'''