berto
Posts: 20708
Joined: 3/13/2002 From: metro Chicago, Illinois, USA Status: offline
|
AGElint: squelches & ignores Try running agelint against a buggy file. If you see false positives on lines 15, 244, 532 & 1278, try rerunning the agelint command like, for example: ./agelint -n +w +e +c5 +u +x -S 15 244 532 1278 -g rus "Events/7-Drang1921.sct" The -S option will squelch error reports for the specified lines. And, since you can recall previous commands with cursor-up key presses -- cursor-up and cursor-down to review and recall any earlier/later Linux/Cygwin commands; use the standard cursor-left, cursor-right, delete, etc. to edit earlier commands) -- you can continue recalling earlier agelint commands, adding and subtracting line #s to your heart's content. We use this error (and warning & notice) squelch mechanism in the AGElint 'make check' regression test. In the AGElint Makefile, it says: check: ./chklint.pl -n +w +e -v -s +u +x +q +c5 -S -g chk 2>&1 | tee ./chklint.chk.out If you try that command adding the +G debuG option (and piping to 'less' for on-screen display) ./chklint.pl -n +w +e -v -s +u +x +q +c5 +G -S -g chk 2>&1 | less you will see the -S Squelch mechanism in action: ... Aliases/uni_Alias.ini /home/berto/games/ageod/agelint/agelint -n +w +e -v -s +c5 +u +x +q -X -L -S 24 163 400 662 917 -g chk "Aliases/uni_Alias.ini" | GameData/Research/104-RI_Modern_agricultural_techniques.res /home/berto/games/ageod/agelint/agelint -n +w +e -v -s +c5 +u +x +q -X -L -S 12 19 25 31 -g chk "GameData/Research/104-RI_Modern_agricultural_techniques.res" | ... In the CHK/Aliases/uni_Alias.ini file (where CHK is a pseudo install, within the agelintroot folder, for 'make check' regression tests), you will see deliberately buggy lines 24, 163, 400, 662 & 917. Likewise for lines 12, 19, 25 & 31 in the CHK/GameData/Research/104-RI_Modern_agricultural_techniques.res file. Where do those line #s come from? From the squelches.chk.pl file, shown in part here: ... # Aliases $squelches{"Aliases/uni_Alias.ini"} .= "24 "; $squelches{"Aliases/uni_Alias.ini"} .= "163 "; $squelches{"Aliases/uni_Alias.ini"} .= "400 "; $squelches{"Aliases/uni_Alias.ini"} .= "662 "; $squelches{"Aliases/uni_Alias.ini"} .= "917 "; ... # Research $squelches{"GameData/Research/104-RI_Modern_agricultural_techniques.res"} .= "12 "; $squelches{"GameData/Research/104-RI_Modern_agricultural_techniques.res"} .= "19 "; $squelches{"GameData/Research/104-RI_Modern_agricultural_techniques.res"} .= "25 "; $squelches{"GameData/Research/104-RI_Modern_agricultural_techniques.res"} .= "31 "; ... Whenever chklint.pl runs with the -S Squelch option, it looks for a squelches.???.pl file in the agelintroot directory, where ??? matches the game specified in the -g option. So, for example, if you were to run the command ./chklint.pl -n +w +e -v -s +u +x +q +c5 -S -g rus 2>&1 | tee ./chklint.rus.out chklint.pl would look for the file (in agelintroot) squelches.rus.pl, which is currently empty: # RUS 1.04 1; # required! It is up for you to add squelch entries in that (and the other game squelches.???.pl files) as you wish. If you run agelint with the +q (as in '+|-q show/don't show squelches') option, for example [root@telemann agelint]# ./agelint -n +w +e -v -s +u +x +q +c5 -g chk "Aliases/uni_Alias.ini" 2>&1 | less you will see something like ERROR: in ./CHK/Aliases/uni_Alias.ini, at (or near) line 24: syntax error: #$# (0x24), #$uni_RED_Div23# 19 $uni_RED_Div18 = 18 20 $uni_RED_Div19 = 19 21 $uni_RED_Div20 = 20 22 $uni_RED_Div21 = 21 23 $uni_RED_Div22 22 24> $uni_RED_Div23 = 23 25 $uni_RED_Div24 = 24 26 $uni_RED_Div25 = 25 27 $uni_RED_Div26 = 26 28 $uni_RED_Div27 = 27 29 $uni_RED_Div28 = 28 $squelches{"Aliases/uni_Alias.ini"} .= "24 "; ERROR: in ./CHK/Aliases/uni_Alias.ini, at (or near) line 163: syntax error: #u# (0x75), #uni_RED_VOKhR2# 158 $uni_RED_MilAG = 157 159 $uni_RED_Cav21 = 158 160 $uni_RED_Reb = 159 161 $uni_RED_Tck = 160 162 $uni_RED_VOKhR1 = 161 163> uni_RED_VOKhR2 = 162 164 $uni_RED_Sla = 163 165 $uni_RED_Ins1 = 164 166 $uni_RED_Str1 = 165 167 $uni_RED_Wsu = 166 168 $uni_RED_Mer = 167 $squelches{"Aliases/uni_Alias.ini"} .= "163 "; ... NOTE: For chklint.pl, you use the -S without line #s. For agelint, you use the -S with line #s. The agelint +q (show squelches) option displays lines like $squelches{"Aliases/uni_Alias.ini"} .= "24 "; for each offending error (or warning or notice) line. You can cut-and-paste these ready-made squelch lines into your customized squelches.???.pl files. "Hey, this is handy. Why don't I create a customized squelches.rus.pl file stuffed with all those pesky false positives?" you may be thinking to yourself. Be careful! If you add or delete lines from that file, you will offset the numbers in squelches.rus.pl, rendering many or all squelch line #s useless. That is why agelint doesn't invoke any of the squelches.???.pl files. Only chklint.pl does that. And so far, only the 'make check', which calls chklint.pl on an invariant (to you) squelches.chk.pl file with unchanging line #s. So, begin populating your customized squelches.???.pl files, and use them with chklint.pl, but use at your own risk! In addition to the agelint (and chklint.pl) squelch mechanism, there is also the ignore mechanism. Try editing the file ./agelintroot/CHK/GameData/Religions/8-Protestant.rel, adding a 'Q' before 'UID' in the first line like so: QUID = 8 Name = Protestant Alias = relProtestant Color = colLavenderBlush3 Then run a standard agelint command against that file: [root@telemann agelint]# ./agelint -n +w +e -v -s +u +x +q +c5 -g chk "GameData/Religions/8-Protestant.rel" 2>&1 ERROR: in ./CHK/GameData/Religions/8-Protestant.rel, at (or near) line 1: syntax error: #=# (0x3d), #=# 1> QUID = 8 2 Name = Protestant 3 Alias = relProtestant 4 Color = colLavenderBlush3 $squelches{"GameData/Religions/8-Protestant.rel"} .= "1 "; As expected, agelint complains about the unknown 'QUID' in line #1. Try squelching that error by adding '-S 1' to the command line: [root@telemann agelint]# ./agelint -n +w +e -v -s +u +x +q +c5 -S 1 -g chk "GameData/Religions/8-Protestant.rel" 2>&1 No error reported. Great, the '-S 1' is working as expected. Now, instead try ignoring the first line by adding '-I 1' to the command line: [root@telemann agelint]# ./agelint -n +w +e -v -s +u +x +q +c5 -I 1 -g chk "GameData/Religions/8-Protestant.rel" 2>&1 ERROR: in ./CHK/GameData/Religions/8-Protestant.rel, at (or near) line 2: syntax error: #N# (0x4e), #Name# 1 QUID = 8 2> Name = Protestant 3 Alias = relProtestant 4 Color = colLavenderBlush3 $squelches{"GameData/Religions/8-Protestant.rel"} .= "2 "; Hmm, what's going on here? In this case, the '-I 1' says to ignore the first line as if it doesn't exist. The agelint parser simply ignores it entirely. A consequence of that is this Religions file appears to lack the required opening 'UID =' line, which is certainly an error. When the parser sees 2> Name = Protestant as if it were the very first actual data line (it's ignoring the first line, remember?), the parser "thinks": "Where is the opening 'UID ='? Error!" If this is all unclear to you, you might try experimenting with the '-S <#s>' squelch option vs. the '-I <#s>' ignore option to gain a better understanding of their differences. Note that you can just as easily combine '-S' with '-I' in the same agelint command line, as in: [root@telemann agelint]# ./agelint -n +w +e -v -s +u +x +q +c5 -S 1 -I 4 -g chk "GameData/Religions/8-Protestant.rel" 2>&1 That tells agelint to squelch the report of error in line #1, and totally ignore line #4 (which is also erroneous, since 'Color =' requires an alias parameter; note the missing '$' before 'colLavenderBlush3'). NOTE: You may use -S (without line #s) with chklint.pl, but for that program -I is not a valid option. That is, you may squelch and/or ignore with agelint, but with chklint.pl you may only squelch. (There are also no ignores.???.pl files corresponding to the squelches.???.pl files. That is WAD.) This may all seem a bit confusing, but play around. Usually squelches are appropriate, but maybe ignores will sometimes suit your purpose. Experiment! (If you edited the ./agelintroot/CHK/GameData/Religions/8-Protestant.rel to add a 'Q' before 'UID' in the first line, you should undo that edit now. Unless you want to experiment some more.)
< Message edited by berto -- 1/9/2012 9:03:58 PM >
_____________________________
|