Overview

Artifact ID: f1ba2668778da4b44fa291fd0cc7b0e39d1d15fcfd98f8da96e238779513c325
Page Name:internal-fields
Date: 2018-07-04 17:03:47
Original User: mario
Mimetype:text/x-markdown
Parent: 771ec87b093f8a2800900d5b6f5cf7f28caae69c0887b6b4db010256e5fafadc (diff)
Next 917d557872a7fa96b1f6811ad74e463bd598e7f3671b3bad6bbb2827412dbd5f
Content

Implicit/internal field names

When plugin meta data comments get extracted into a hashtable, some common attributes might get prepoulated. Either implied from the filename, or from predefined defaults.

# id: basename

With e.g. the depends: field plugins can reference each other. And they typically just list basenames, not full paths. Because the point of PMD is to abstract filenames from plugin names.

  # fn: src/plugin/featurename.rb
  # id: featurename

Albeit one could use a literal # id: override in scripts, it's probably best to avoid ambigious basenames. For the scope of one application API all plugin basenames should be unique.

# fn: .../src/plugin/filename.rb

When a script gets parsed, it's often necessary to retain its exact location. For brevity, I'd usually storel this in an internal field named $meta.fn

# comment: …
… … … … … … …

The remainder of the topmost comment block (after all PMD key:value fields) is meant to contain a longer description. And for my implementatiosn I usually keep it as $meta.comment (albeit also used $meta.doc in some extractors.)