Debian Codegraph @

testsuite/lint.00-init/005-init_ts.exp

raw
1 ##############################################################################
2 # Modules Revision 3.0
3 # Providing a flexible user environment
4 #
5 # File: lint.00-init/%M%
6 # Revision: %I%
7 # First Edition: 2022/08/26
8 # Last Mod.: %U%, %G%
9 #
10 # Authors: Xavier Delaruelle, [email protected]
11 #
12 # Description: Testuite testsequence
13 # Command:
14 # Sub-Command:
15 #
16 # Comment: %C{
17 # Defines all patterns used further in the testsuite
18 # }C%
19 #
20 ##############################################################################
21
22 proc report {msg} {
23 if {$::verbose} {
24 send_user "\t$msg\n"
25 }
26 }
27
28 report {Initializing the testsuite ...}
29
30 #
31 # file list to test per language
32 #
33
34 set lint_files(sh) [list\
35 init/profile.sh\
36 init/sh\
37 doc/example/compiler-etc-dependencies/example-sessions/common_code.sh\
38 ]
39
40 set lint_files(bash) [list\
41 init/bash_completion\
42 init/bash\
43 ]
44
45 set lint_files(ksh) [list\
46 init/ksh\
47 ]
48
49 set lint_files(tcl) [list\
50 init/tcl\
51 ]
52
53 # list generated or source files to skip
54 set skip_files [list\
55 modulecmd-test.tcl\
56 lib/configure\
57 lib/config.status\
58 lib/config.guess\
59 init/ksh.in\
60 init/sh.in\
61 init/bash.in\
62 init/bash_completion.in\
63 init/profile.sh.in\
64 init/tcl.in\
65 script/modulecmd.in\
66 script/add.modules.in\
67 ]
68
69 # fetch files in directories not to scan in depth
70 set scan_files [glob -types f * testsuite/*]
71
72 # scan directories to find files to scan
73 set scan_dirs [list\
74 script\
75 init\
76 lib\
77 share\
78 testsuite/bin\
79 doc/example\
80 ]
81 lappend scan_files {*}[exec find {*}$scan_dirs -type f]
82
83 # check files to find file to lint
84 foreach fpath $scan_files {
85 if {$fpath ni $skip_files} {
86 switch -glob -- [exec file -b $fpath] {
87 {POSIX shell script*} {
88 lappend lint_files(sh) $fpath
89 }
90 {Bourne-Again shell script*} {
91 lappend lint_files(bash) $fpath
92 }
93 {*tclsh script*} - {Tcl/Tk script*} {
94 lappend lint_files(tcl) $fpath
95 }
96 }
97 }
98 }
99
100 foreach lang [array names lint_files] {
101 report "$lang files to lint:\n\t\t[join $lint_files($lang) \n\t\t]"
102 }
103
104 # specific lint options for some files
105 array set file_lint_opts [list\
106 init/ksh {-e SC2089,SC2090}\
107 init/bash {-e SC2089,SC2090}\
108 init/sh {-e SC2089,SC2090}\
109 init/bash_completion {-e SC2207}\
110 script/add.modules {-e SC2162}\
111 testsuite/bin/install_test_sh {-e SC1090,SC3037,SC3044}\
112 ]
113
114 proc set_linter_opts {fpath} {
115 if {![info exists ::ORIG_linter_opts]} {
116 set ::ORIG_linter_opts $::linter_opts
117 }
118 if {[info exists ::file_lint_opts($fpath)]} {
119 set ::linter_opts $::file_lint_opts($fpath)
120 } else {
121 set ::linter_opts $::ORIG_linter_opts
122 }
123 }
124
125 # clean up temporary variables used
126 unset fpath
127 unset lang
128
129 # vim:set tabstop=3 shiftwidth=3 expandtab autoindent: