Class: PackStats::Private::Metrics::PackwerkCheckerUsage
- Inherits:
-
Object
- Object
- PackStats::Private::Metrics::PackwerkCheckerUsage
- Extended by:
- T::Sig
- Defined in:
- lib/pack_stats/private/metrics/packwerk_checker_usage.rb
Defined Under Namespace
Classes: Direction, PackwerkChecker
Constant Summary collapse
- CHECKERS =
T.let([ PackwerkChecker.new(key: 'enforce_dependencies', violation_type: 'dependency', direction: Direction::Outbound), PackwerkChecker.new(key: 'enforce_privacy', violation_type: 'privacy', direction: Direction::Inbound), PackwerkChecker.new(key: 'enforce_folder_privacy', violation_type: 'folder_privacy', direction: Direction::Inbound), PackwerkChecker.new(key: 'enforce_layers', violation_type: 'layer', direction: Direction::Outbound), PackwerkChecker.new(key: 'enforce_visibility', violation_type: 'visibility', direction: Direction::Outbound), ], T::Array[PackwerkChecker])
Class Method Summary collapse
Class Method Details
.get_checker_metrics(prefix, packages, package_tags) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/pack_stats/private/metrics/packwerk_checker_usage.rb', line 47 def self.get_checker_metrics(prefix, packages, ) metrics = T.let([], T::Array[GaugeMetric]) CHECKERS.each do |checker| checker_values = packages.map do |package| YAML.load_file(package.yml)[checker.key] end checker_values_tally = checker_values.map(&:to_s).tally ['false', 'true', 'strict'].each do |possible_value| count = checker_values_tally.fetch(possible_value, 0) metric_name = "#{prefix}.packwerk_checkers.#{possible_value}.count" = + [checker.violation_type_tag] metrics << GaugeMetric.for(metric_name, count, ) end end metrics end |