Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
pack_stats (0.0.5)
pack_stats (0.0.6)
code_ownership
code_teams
dogapi
Expand Down
2 changes: 0 additions & 2 deletions lib/pack_stats/private/datadog_reporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
require 'pack_stats/private/metrics/rubocop_usage'
require 'pack_stats/private/metrics/packages'
require 'pack_stats/private/metrics/packages_by_team'
require 'pack_stats/private/metrics/nested_packs'

module PackStats
module Private
Expand All @@ -29,7 +28,6 @@ def self.get_metrics(source_code_files:, app_name:)
*Metrics::Files.get_metrics(source_code_files, app_name),
*Metrics::Packages.get_package_metrics(packages, app_name),
*Metrics::PackagesByTeam.get_package_metrics_by_team(packages, app_name),
*Metrics::NestedPacks.get_nested_package_metrics(packages, app_name)
]
end

Expand Down
137 changes: 0 additions & 137 deletions lib/pack_stats/private/metrics/nested_packs.rb

This file was deleted.

2 changes: 1 addition & 1 deletion pack_stats.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Gem::Specification.new do |spec|
spec.name = 'pack_stats'
spec.version = '0.0.5'
spec.version = '0.0.6'
spec.authors = ['Gusto Engineers']
spec.email = ['dev@gusto.com']

Expand Down
124 changes: 0 additions & 124 deletions spec/pack_stats_legacy_api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -910,130 +910,6 @@ module PackStats # rubocop:disable RSpec/DescribedClassModuleWrapping
end
end

context 'in an app with nested packs' do
before do
write_package_yml('.')
write_package_yml('packs/fruits')
write_package_yml('packs/fruits/apples')
write_package_yml('packs/fruits/pears')

write_package_yml('packs/vegetables')
write_package_yml('packs/vegetables/broccoli')

write_package_yml('packs/peanuts')
write_package_yml('packs/cashews')

# Represents TWO privacy and TWO dependency violations across pack groups
write_file('package_todo.yml', <<~CONTENTS)
# This file contains a list of dependencies that are not part of the long term plan for ..
# We should generally work to reduce this list, but not at the expense of actually getting work done.
#
# You can regenerate this file using the following command:
#
# bundle exec packwerk update-deprecations .
---
packs/fruits:
"FruitsConstant":
violations:
- dependency
- privacy
files:
- some_file1.rb
- some_file2.rb
CONTENTS

# Represents ONE privacy and ZERO dependency violations across pack groups
write_file('packs/fruits/package_todo.yml', <<~CONTENTS)
# This file contains a list of dependencies that are not part of the long term plan for ..
# We should generally work to reduce this list, but not at the expense of actually getting work done.
#
# You can regenerate this file using the following command:
#
# bundle exec packwerk update-deprecations .
---
packs/fruits/apples:
"ApplesConstant":
violations:
- dependency
- privacy
files:
- some_file1.rb
- some_file2.rb
packs/peanuts:
"PeanutsConstant":
violations:
- privacy
files:
- some_file1.rb
CONTENTS

# Represents ZERO violations across pack groups
write_file('packs/fruits/apples/package_todo.yml', <<~CONTENTS)
# This file contains a list of dependencies that are not part of the long term plan for ..
# We should generally work to reduce this list, but not at the expense of actually getting work done.
#
# You can regenerate this file using the following command:
#
# bundle exec packwerk update-deprecations .
---
packs/fruits:
"FruitsConstant":
violations:
- dependency
- privacy
files:
- packs/fruits/apples/some_file1.rb
- packs/fruits/apples/some_file2.rb
- packs/fruits/apples/some_file3.rb
- packs/fruits/apples/some_file4.rb
packs/fruits/pears:
"PearsConstant":
violations:
- dependency
- privacy
files:
- packs/fruits/apples/some_file1.rb
- packs/fruits/apples/some_file2.rb
- packs/fruits/apples/some_file3.rb
- packs/fruits/apples/some_file4.rb
packs/peanuts:
"PeanutsConstant":
violations:
- dependency
files:
- packs/fruits/apples/some_file1.rb
CONTENTS
end

it 'emits the right metrics' do
expect(metrics).to include_metric GaugeMetric.for('all_packages.count', 8, Tags.for(['app:MyApp']))
expect(metrics).to include_metric GaugeMetric.for('all_pack_groups.count', 5, Tags.for(['app:MyApp']))
expect(metrics).to include_metric GaugeMetric.for('child_packs.count', 3, Tags.for(['app:MyApp']))
expect(metrics).to include_metric GaugeMetric.for('parent_packs.count', 2, Tags.for(['app:MyApp']))

# Notice that this does not use a tag to specify the pack group -- the metric itself only sends information about cross-pack group violations
expect(metrics).to include_metric GaugeMetric.for('all_pack_groups.privacy_violations.count', 3, Tags.for(['app:MyApp']))
expect(metrics).to include_metric GaugeMetric.for('all_pack_groups.dependency_violations.count', 3, Tags.for(['app:MyApp']))

expect(metrics).to include_metric GaugeMetric.for('by_pack_group.outbound_dependency_violations.count', 2, Tags.for(['app:MyApp', 'pack_group:root']))
expect(metrics).to include_metric GaugeMetric.for('by_pack_group.outbound_dependency_violations.count', 1, Tags.for(['app:MyApp', 'pack_group:packs/fruits']))
expect(metrics).to include_metric GaugeMetric.for('by_pack_group.outbound_dependency_violations.count', 0, Tags.for(['app:MyApp', 'pack_group:packs/vegetables']))
expect(metrics).to include_metric GaugeMetric.for('by_pack_group.outbound_dependency_violations.count', 0, Tags.for(['app:MyApp', 'pack_group:packs/peanuts']))
expect(metrics).to include_metric GaugeMetric.for('by_pack_group.outbound_dependency_violations.count', 0, Tags.for(['app:MyApp', 'pack_group:packs/cashews']))

expect(metrics).to include_metric GaugeMetric.for('by_pack_group.inbound_privacy_violations.count', 0, Tags.for(['app:MyApp', 'pack_group:root']))
expect(metrics).to include_metric GaugeMetric.for('by_pack_group.inbound_privacy_violations.count', 2, Tags.for(['app:MyApp', 'pack_group:packs/fruits']))
expect(metrics).to include_metric GaugeMetric.for('by_pack_group.inbound_privacy_violations.count', 0, Tags.for(['app:MyApp', 'pack_group:packs/vegetables']))
expect(metrics).to include_metric GaugeMetric.for('by_pack_group.inbound_privacy_violations.count', 1, Tags.for(['app:MyApp', 'pack_group:packs/peanuts']))
expect(metrics).to include_metric GaugeMetric.for('by_pack_group.inbound_privacy_violations.count', 0, Tags.for(['app:MyApp', 'pack_group:packs/cashews']))

# This does have a tag for pack group, but the metric itself also only sends information about cross-pack group violations.
expect(metrics).to include_metric GaugeMetric.for('by_pack_group.outbound_dependency_violations.per_pack_group.count', 2, Tags.for(['app:MyApp', 'pack_group:root', 'to_pack_group:packs/fruits']))
expect(metrics).to include_metric GaugeMetric.for('by_pack_group.outbound_privacy_violations.per_pack_group.count', 2, Tags.for(['app:MyApp', 'pack_group:root', 'to_pack_group:packs/fruits']))
expect(metrics).to include_metric GaugeMetric.for('by_pack_group.outbound_dependency_violations.per_pack_group.count', 1, Tags.for(['app:MyApp', 'pack_group:packs/fruits', 'to_pack_group:packs/peanuts']))
end
end

context 'in an app with exclusions for rubocop based protections' do
before do
write_package_yml('.')
Expand Down
Loading