Skip to content

Somehow notify the developer about package names containing '-' #124

@stefanhaerter

Description

@stefanhaerter

Unfortunately, package names containing a dash, like e.g. 'Statistics-ExtendedQueueStats', do have a few pitfalls.

Perl package names must not contain a dash. As some file types usually contain the package name by convention, this might affect (but not limited to):

  1. Kernel/Language/<language_Abbreviation>_<PackageName>.pm
  2. var/packagesetup/<PackageName>.pm

First implication is that a proper perl language server will warn about invalid package name (not sure if CodePolicy does this), and following an adaption there, CodePolicy will catch mismatches between package name and file name - both together are in my opinion sufficient for Point 1.

By far more nasty is point 2. Here, a proper language server will as well warn you about an invalid package name and CodePolicy about naming mismatch, but usually Code(Install|Reinstall|Uninstall|Update) fragments rely upon the packagesetup file name being identical to the package name:

    <CodeInstall Type="post"><![CDATA[

        # create the package name
        my $CodeModule = 'var::packagesetup::' . $Param{Structure}->{Name}->{Content};

        $Kernel::OM->Get($CodeModule)->CodeInstall();

    ]]></CodeInstall>

Here, you do not get warned that the exact package does not exist anymore in any way, which I consider a mean and nasty thing. I'd find it nice if CodePolicy would check if a package name contains a dash and if so, if the Code blocks are handled properly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions