#1189 prosodyctl check should complain about '.lua' in modules_enabled

Reporter Zash
Owner Nobody
Created
Updated
Stars ★★ (2)
Tags
  • Difficulty-Easy
  • Status-Accepted
  • Priority-Medium
  • Type-Enhancement
  1. Zash on

    Like the check for the 'mod_' prefix, but for the '.lua' file extension. Eg "mod_foo.lua" in modules_enabled produces this warning: Modules in modules_enabled should not have the 'mod_' prefix included. Change 'mod_foo.lua' to 'foo.lua'. It should suggest stripping ".lua" as well.

  2. Zash on

    Changes
    • tags Difficulty-Easy
  3. Torro on

    diff -r b6b09dace24b util/prosodyctl/check.lua --- a/util/prosodyctl/check.lua +++ b/util/prosodyctl/check.lua @@ -612,10 +612,18 @@ all_modules:include(set.new(config[host].modules_enabled)); end for mod in all_modules do - if mod:match("^mod_") then + if mod:match("^mod_.*%.lua$") then + print(""); + print(" Modules in modules_enabled should not have the 'mod_' prefix or the '.lua' affix included."); + print(" Change '"..mod.."' to '"..mod:match("^mod_(.*)%.lua$").."'."); + elseif mod:match("^mod_") then print(""); print(" Modules in modules_enabled should not have the 'mod_' prefix included."); print(" Change '"..mod.."' to '"..mod:match("^mod_(.*)").."'."); + elseif mod:match(".lua$") then + print(""); + print(" Modules in modules_enabled should not have the '*.lua' affix included."); + print(" Change '"..mod.."' to '"..mod:match("(.*).lua$").."'."); elseif mod:match("^auth_") then print(""); print(" Authentication modules should not be added to modules_enabled,");

New comment

Not published. Used for spam prevention and optional update notifications.