Module: ModularizationStatistics::Private::Metrics
- Extended by:
- T::Sig
- Defined in:
- lib/modularization_statistics/private/metrics.rb,
lib/modularization_statistics/private/metrics/files.rb,
lib/modularization_statistics/private/metrics/packages.rb,
lib/modularization_statistics/private/metrics/nested_packs.rb,
lib/modularization_statistics/private/metrics/public_usage.rb,
lib/modularization_statistics/private/metrics/rubocop_usage.rb,
lib/modularization_statistics/private/metrics/packages_by_team.rb,
lib/modularization_statistics/private/metrics/packwerk_checker_usage.rb
Defined Under Namespace
Classes: Files, NestedPacks, Packages, PackagesByTeam, PackwerkCheckerUsage, PublicUsage, RubocopUsage
Constant Summary
collapse
- UNKNOWN_OWNER =
T.let('Unknown', String)
Class Method Summary
collapse
Class Method Details
.file_count(violations) ⇒ Object
39
40
41
|
# File 'lib/modularization_statistics/private/metrics.rb', line 39
def self.file_count(violations)
violations.sum { |v| v.files.count }
end
|
.has_readme?(package) ⇒ Boolean
44
45
46
|
# File 'lib/modularization_statistics/private/metrics.rb', line 44
def self.has_readme?(package)
package.directory.join('README.md').exist?
end
|
.humanized_package_name(name) ⇒ Object
30
31
32
33
34
35
36
|
# File 'lib/modularization_statistics/private/metrics.rb', line 30
def self.humanized_package_name(name)
if name == ParsePackwerk::ROOT_PACKAGE_NAME
'root'
else
name
end
end
|
16
17
18
19
20
21
22
|
# File 'lib/modularization_statistics/private/metrics.rb', line 16
def self.tags_for_package(package, app_name)
[
Tag.new(key: 'package', value: humanized_package_name(package.name)),
Tag.new(key: 'app', value: app_name),
*Metrics.tags_for_team(CodeOwnership.for_package(package)&.name),
]
end
|
11
12
13
|
# File 'lib/modularization_statistics/private/metrics.rb', line 11
def self.tags_for_team(team_name)
[Tag.for('team', team_name || UNKNOWN_OWNER)]
end
|
25
26
27
|
# File 'lib/modularization_statistics/private/metrics.rb', line 25
def self.tags_for_to_team(team_name)
[Tag.for('to_team', team_name || Metrics::UNKNOWN_OWNER)]
end
|