| 1 |
##Nagelfar Plugin : modulefile-specific notices |
| 2 |
# |
| 3 |
# PLUGIN_MODULEFILE.tcl, Nagelfar plugin to lint modulefiles |
| 4 |
# Copyright (C) 2022-2025 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 |
module-log - module-trace - module-user - module-verbosity { |
| 26 |
set res [list warning "Command \"[lindex $words 0]\" is deprecated\ |
| 27 |
and not implemented"] |
| 28 |
} |
| 29 |
module-info { |
| 30 |
if {[lindex $words 1] in {flags trace tracepat user}} { |
| 31 |
set res [list warning "Command \"[lrange $words 0 1]\" is\ |
| 32 |
deprecated and not implemented"] |
| 33 |
} |
| 34 |
} |
| 35 |
remove-property { |
| 36 |
set res [list warning "Command \"[lindex $words 0]\" is not\ |
| 37 |
implemented"] |
| 38 |
} |
| 39 |
module { |
| 40 |
if {[lindex $words 1] in {aliases available avail show display\ |
| 41 |
initload initadd initclear initlist initprepend initunload initrm\ |
| 42 |
initswitch list purge reload restore save savelist saverm\ |
| 43 |
saveshow search test whatis}} { |
| 44 |
set res [list warning "Command \"[lrange $words 0 1]\" should not\ |
| 45 |
be used in modulefile"] |
| 46 |
} |
| 47 |
} |
| 48 |
} |
| 49 |
return $res |
| 50 |
} |
| 51 |
|
| 52 |
# translate known '--option=value' arguments into '--option value' to |
| 53 |
# correctly check them with Nagelfar |
| 54 |
proc statementRaw {stmt info} { |
| 55 |
set res {} |
| 56 |
regexp {^(.+?)\s} $stmt match cmd |
| 57 |
if {$cmd in {append-path prepend-path remove-path always-load depends-on\ |
| 58 |
module prereq prereq-all prereq-any}} { |
| 59 |
if {[regsub -all {(--(delim|tag))=} $stmt {\1 } newstmt]} { |
| 60 |
set res [list replace $newstmt] |
| 61 |
} |
| 62 |
} |
| 63 |
return $res |
| 64 |
} |
| 65 |
|
| 66 |
# vim:set tabstop=3 shiftwidth=3 expandtab autoindent: |