Class: Central::Devtools::Rake::Flay

Inherits:
Object
  • Object
show all
Includes:
Adamantium
Defined in:
lib/central/devtools/rake/flay.rb

Overview

Flay metric runner

Constant Summary collapse

BELOW_THRESHOLD =
'Adjust flay threshold down to %d'.freeze
TOTAL_MISMATCH =
'Flay total is now %d, but expected %d'.freeze
ABOVE_THRESHOLD =
'%d chunks have a duplicate mass > %d'.freeze

Instance Method Summary collapse

Instance Method Details

#verifyundefined

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Verify code specified by files does not violate flay expectations

rubocop:disable MethodLength

Returns:

  • (undefined)

    otherwise

Raises:

  • (SystemExit)

    if a violation is found



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/central/devtools/rake/flay.rb', line 24

def verify
  # Run flay first to ensure the max mass matches the threshold
  Central::Devtools.notify_metric_violation(
    BELOW_THRESHOLD % largest_mass
  ) if below_threshold?

  Central::Devtools.notify_metric_violation(
    TOTAL_MISMATCH % [total_mass, total_score]
  ) if total_mismatch?

  # Run flay a second time with the threshold set
  return unless above_threshold?

  restricted_flay_scale.flay_report
  Central::Devtools.notify_metric_violation(
    ABOVE_THRESHOLD % [restricted_mass_size, threshold]
  )
end