Debian Codegraph @

share/nagelfar/plugin_globalrc.tcl

raw
1 ##Nagelfar Plugin : global rc-specific notices
2 #
3 # PLUGIN_GLOBALRC.tcl, Nagelfar plugin to lint global rc files
4 # Copyright (C) 2022-2023 Xavier Delaruelle
5 #
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 2 of the License, or
9 # (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18
19 ##########################################################################
20
21 # report deprecated/not implemented/not recommended usages
22 proc statementWords {words info} {
23 set res {}
24 switch [lindex $words 0] {
25 always-load - append-path - chdir - complete - conflict - depends-on -\
26 extensions - family - getenv - getvariant - is-avail - is-saved -\
27 module - module-whatis - prepend-path - prereq - prereq-all -\
28 prereq-any - pushenv - remove-path - reportError - reportWarning -\
29 require-fullname - set-alias - set-function - setenv - source-sh -\
30 uncomplete - unset-alias - unset-function - unsetenv - variant -\
31 x-resource - add-property - remove-property - module-log - module-trace\
32 - module-user - module-verbosity {
33 set res [list warning "Command \"[lindex $words 0]\" should not be\
34 be used in global rc file"]
35 }
36 module-info {
37 if {[lindex $words 1] in {flags trace tracepat user}} {
38 set res [list warning "Command \"[lrange $words 0 1]\" is\
39 deprecated and not implemented"]
40 }
41 }
42 }
43 return $res
44 }
45
46 # translate known '--option=value' arguments into '--option value' to
47 # correctly check them with Nagelfar
48 proc statementRaw {stmt info} {
49 set res {}
50 regexp {^(.+?)\s} $stmt match cmd
51 if {$cmd in {append-path prepend-path remove-path always-load depends-on\
52 module prereq prereq-all prereq-any}} {
53 if {[regsub -all {(--(delim|tag))=} $stmt {\1 } newstmt]} {
54 set res [list replace $newstmt]
55 }
56 }
57 return $res
58 }
59
60 # vim:set tabstop=3 shiftwidth=3 expandtab autoindent: