class RuboCop::Cop::Base

A scaffold for concrete cops.

The Cop::Base class is meant to be extended.

Cops track offenses and can autocorrect them on the fly.

A commissioner object is responsible for traversing the AST and invoking the specific callbacks on each cop.

First the callback ‘on_new_investigation` is called; if a cop needs to do its own processing of the AST or depends on something else.

Then callbacks like ‘on_def`, `on_send` (see AST::Traversal) are called with their respective nodes.

Finally the callback ‘on_investigation_end` is called.

Within these callbacks, cops are meant to call ‘add_offense` or `add_global_offense`. Use the `processed_source` method to get the currently processed source being investigated.

In case of invalid syntax / unparsable content, the callback ‘on_other_file` is called instead of all the other `on_…` callbacks.

Private methods are not meant for custom cops consumption, nor are any instance variables.