Overview

Artifact ID: 243b1b2b6ce1e1141a2f838051b350d517bec48564461ed993560d3538253c55
Page Name:internal-fields
Date: 2018-07-04 17:30:39
Original User: mario
Mimetype:text/x-markdown
Parent: 2cde645101165a0c164179bb98cf2d6956e0fb3d700e3bab298733f6d6b7ff3e (diff)
Next bc532222ee3354392e588de23cdd52b039938ca318de9dc8e0db8212c7d0a2ea
Content

Implicit/internal field names

When plugin meta data comments get extracted into a hashtable ($meta.*), some common attributes might get populated. 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 identifiers 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 store 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 implementations I usually keep it as $meta.comment (albeit also used $meta.doc in some extractors.)