Class: Standard::Performance::Plugin

Inherits:
LintRoller::Plugin
  • Object
show all
Defined in:
lib/standard/performance/plugin.rb

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Plugin

Returns a new instance of Plugin.



5
6
7
8
# File 'lib/standard/performance/plugin.rb', line 5

def initialize(config)
  @config = config
  @builds_ruleset = BuildsRuleset.new
end

Instance Method Details

#aboutObject



10
11
12
13
14
15
16
17
# File 'lib/standard/performance/plugin.rb', line 10

def about
  LintRoller::About.new(
    name: "standard-performance",
    version: VERSION,
    homepage: "https://github.com/testdouble/standard-performance",
    description: "Configuration for rubocop-performance's rules"
  )
end

#rules(context) ⇒ Object



23
24
25
26
27
28
29
30
31
# File 'lib/standard/performance/plugin.rb', line 23

def rules(context)
  trick_rubocop_into_thinking_we_required_rubocop_performance!

  LintRoller::Rules.new(
    type: :object,
    config_format: :rubocop,
    value: @builds_ruleset.build(context.target_ruby_version)
  )
end

#supported?(context) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/standard/performance/plugin.rb', line 19

def supported?(context)
  true
end