Skip to content

Commit a7c68f6

Browse files
authored
Renaming architecture to layers (#52)
* renaming architecture to layers
1 parent ce239ad commit a7c68f6

5 files changed

Lines changed: 17 additions & 17 deletions

File tree

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
pack_stats (0.1.3)
4+
pack_stats (0.2.0)
55
code_ownership
66
code_teams
77
dogapi

docs/dashboard.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
{
5454
"definition": {
5555
"background_color": "white",
56-
"content": "# Template Variables\nAt the top, there are some template variables you can set to filter the entire dashboard by...\n\n| Key | Default | Examples |\n|---|---|---|\n| *app* (required) | `my_app` | `my_app` |\n| *max_enforcements* | `false` | `false`, `true` |\n| *package* | `*` | `packs/background_jobs` |\n| *team* | `*` | `payments` |\n| *violation_type* | `dependency`,`privacy` | `architecture`,`visibility` |\n\nFor `max_enforcement`, \n - `false` means: Violation counts without changing `enforce_x` in `package.yml` files. Used to track violations we care about.\n - `true` means: Violation counts after changing `enforce_x` to `true` for all packages. Used for \"what if\" scenarios.\n\n# Pro-Tip: Split graph by variables\nClick \"split graph\" in the \"full-screen\" mode of a widget to see a graph broken up by team, violation type, or package. Here's an [example (violations over time)](https://app.datadoghq.com/dashboard/s3q-cb3-bed?fullscreen_end_ts=1683557460383&fullscreen_paused=false&fullscreen_section=split%20graph&fullscreen_start_ts=1683543060383&fullscreen_widget=452601886481639&from_ts=1683543021000&to_ts=1683557421000&live=true).\n\n# Additional Documentation\nMore information at [https://go/packs](https://docs.google.com/document/d/1OGYqV1pt1r6g6LimCDs8RSIR7hBZ7BVO1yohk2Jnu0M/edit#heading=h.4cufcvb5oqvd)\n",
56+
"content": "# Template Variables\nAt the top, there are some template variables you can set to filter the entire dashboard by...\n\n| Key | Default | Examples |\n|---|---|---|\n| *app* (required) | `my_app` | `my_app` |\n| *max_enforcements* | `false` | `false`, `true` |\n| *package* | `*` | `packs/background_jobs` |\n| *team* | `*` | `payments` |\n| *violation_type* | `dependency`,`privacy` | `layer`,`visibility` |\n\nFor `max_enforcement`, \n - `false` means: Violation counts without changing `enforce_x` in `package.yml` files. Used to track violations we care about.\n - `true` means: Violation counts after changing `enforce_x` to `true` for all packages. Used for \"what if\" scenarios.\n\n# Pro-Tip: Split graph by variables\nClick \"split graph\" in the \"full-screen\" mode of a widget to see a graph broken up by team, violation type, or package. Here's an [example (violations over time)](https://app.datadoghq.com/dashboard/s3q-cb3-bed?fullscreen_end_ts=1683557460383&fullscreen_paused=false&fullscreen_section=split%20graph&fullscreen_start_ts=1683543060383&fullscreen_widget=452601886481639&from_ts=1683543021000&to_ts=1683557421000&live=true).\n\n# Additional Documentation\nMore information at [https://go/packs](https://docs.google.com/document/d/1OGYqV1pt1r6g6LimCDs8RSIR7hBZ7BVO1yohk2Jnu0M/edit#heading=h.4cufcvb5oqvd)\n",
5757
"font_size": "14",
5858
"has_padding": true,
5959
"show_tick": false,

lib/pack_stats/private/metrics/packwerk_checker_usage.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module Metrics
99
class PackwerkCheckerUsage
1010
extend T::Sig
1111

12-
# Some violations (e.g. dependency, visibility, architecture) matter for the referencing (outbound) package.
12+
# Some violations (e.g. dependency, visibility, layer) matter for the referencing (outbound) package.
1313
# Other violations (e.g. privacy) matter for the referenced (inbound) package.
1414
class Direction < T::Enum
1515
enums do
@@ -38,7 +38,7 @@ def violation_type_tag
3838
CHECKERS = T.let([
3939
PackwerkChecker.new(key: 'enforce_dependencies', violation_type: 'dependency', direction: Direction::Outbound),
4040
PackwerkChecker.new(key: 'enforce_privacy', violation_type: 'privacy', direction: Direction::Inbound),
41-
PackwerkChecker.new(key: 'enforce_architecture', violation_type: 'architecture', direction: Direction::Outbound),
41+
PackwerkChecker.new(key: 'enforce_layers', violation_type: 'layer', direction: Direction::Outbound),
4242
PackwerkChecker.new(key: 'enforce_visibility', violation_type: 'visibility', direction: Direction::Outbound),
4343
], T::Array[PackwerkChecker])
4444

pack_stats.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Gem::Specification.new do |spec|
22
spec.name = 'pack_stats'
3-
spec.version = '0.1.3'
3+
spec.version = '0.2.0'
44
spec.authors = ['Gusto Engineers']
55
spec.email = ['dev@gusto.com']
66

spec/pack_stats_spec.rb

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -994,7 +994,7 @@ module PackStats # rubocop:disable RSpec/DescribedClassModuleWrapping
994994
write_file('packs/my_pack/package.yml', <<~CONTENTS)
995995
enforce_dependencies: false
996996
enforce_privacy: false
997-
enforce_architecture: true
997+
enforce_layers: true
998998
enforce_visibility: true
999999
layer: utilities
10001000
metadata:
@@ -1013,7 +1013,7 @@ module PackStats # rubocop:disable RSpec/DescribedClassModuleWrapping
10131013
packs/other_pack:
10141014
"SomeConstant":
10151015
violations:
1016-
- architecture
1016+
- layer
10171017
- visibility
10181018
files:
10191019
- some_file.rb
@@ -1022,29 +1022,29 @@ module PackStats # rubocop:disable RSpec/DescribedClassModuleWrapping
10221022
end
10231023

10241024
it 'emits the right metrics' do
1025-
expect(metrics).to include_metric GaugeMetric.for('all_packages.packwerk_checkers.strict.count', 0, Tags.for(['app:MyApp', 'violation_type:architecture']))
1026-
expect(metrics).to include_metric GaugeMetric.for('all_packages.packwerk_checkers.true.count', 1, Tags.for(['app:MyApp', 'violation_type:architecture']))
1025+
expect(metrics).to include_metric GaugeMetric.for('all_packages.packwerk_checkers.strict.count', 0, Tags.for(['app:MyApp', 'violation_type:layer']))
1026+
expect(metrics).to include_metric GaugeMetric.for('all_packages.packwerk_checkers.true.count', 1, Tags.for(['app:MyApp', 'violation_type:layer']))
10271027
expect(metrics).to include_metric GaugeMetric.for('all_packages.packwerk_checkers.strict.count', 0, Tags.for(['app:MyApp', 'violation_type:visibility']))
10281028
expect(metrics).to include_metric GaugeMetric.for('all_packages.packwerk_checkers.true.count', 1, Tags.for(['app:MyApp', 'violation_type:visibility']))
10291029
expect(metrics).to include_metric GaugeMetric.for('all_packages.packwerk_checkers.true.count', 1, Tags.for(['app:MyApp', 'violation_type:visibility']))
1030-
expect(metrics).to include_metric GaugeMetric.for('all_packages.violations.count', 1, Tags.for(['app:MyApp', 'violation_type:architecture']))
1030+
expect(metrics).to include_metric GaugeMetric.for('all_packages.violations.count', 1, Tags.for(['app:MyApp', 'violation_type:layer']))
10311031
expect(metrics).to include_metric GaugeMetric.for('all_packages.violations.count', 1, Tags.for(['app:MyApp', 'violation_type:visibility']))
1032-
expect(metrics).to include_metric GaugeMetric.for('by_team.violations.count', 1, Tags.for(['app:MyApp', 'team:Bar Team', 'violation_type:architecture']))
1032+
expect(metrics).to include_metric GaugeMetric.for('by_team.violations.count', 1, Tags.for(['app:MyApp', 'team:Bar Team', 'violation_type:layer']))
10331033
expect(metrics).to include_metric GaugeMetric.for('by_team.violations.count', 1, Tags.for(['app:MyApp', 'team:Bar Team', 'violation_type:visibility']))
10341034

1035-
expect(metrics).to include_metric GaugeMetric.for('by_package.violations.count', 1, Tags.for(['app:MyApp', 'package:packs/my_pack', 'team:Bar Team', 'violation_type:architecture', 'layer:utilities']))
1035+
expect(metrics).to include_metric GaugeMetric.for('by_package.violations.count', 1, Tags.for(['app:MyApp', 'package:packs/my_pack', 'team:Bar Team', 'violation_type:layer', 'layer:utilities']))
10361036
expect(metrics).to include_metric GaugeMetric.for('by_package.violations.count', 1, Tags.for(['app:MyApp', 'package:packs/my_pack', 'team:Bar Team', 'violation_type:visibility', 'layer:utilities']))
1037-
expect(metrics).to include_metric GaugeMetric.for('by_package.violations.count', 0, Tags.for(['app:MyApp', 'package:packs/other_pack', 'team:Foo Team', 'violation_type:architecture', 'layer:product']))
1037+
expect(metrics).to include_metric GaugeMetric.for('by_package.violations.count', 0, Tags.for(['app:MyApp', 'package:packs/other_pack', 'team:Foo Team', 'violation_type:layer', 'layer:product']))
10381038
expect(metrics).to include_metric GaugeMetric.for('by_package.violations.count', 0, Tags.for(['app:MyApp', 'package:packs/other_pack', 'team:Foo Team', 'violation_type:visibility', 'layer:product']))
10391039

1040-
expect(metrics).to include_metric GaugeMetric.for('by_package.violations.by_other_package.count', 1, Tags.for(['app:MyApp', 'package:packs/my_pack', 'other_package:packs/other_pack', 'team:Bar Team', 'other_team:Foo Team', 'violation_type:architecture', 'layer:utilities']))
1040+
expect(metrics).to include_metric GaugeMetric.for('by_package.violations.by_other_package.count', 1, Tags.for(['app:MyApp', 'package:packs/my_pack', 'other_package:packs/other_pack', 'team:Bar Team', 'other_team:Foo Team', 'violation_type:layer', 'layer:utilities']))
10411041
expect(metrics).to include_metric GaugeMetric.for('by_package.violations.by_other_package.count', 1, Tags.for(['app:MyApp', 'package:packs/my_pack', 'other_package:packs/other_pack', 'team:Bar Team', 'other_team:Foo Team', 'violation_type:visibility', 'layer:utilities']))
1042-
expect(metrics).to_not include_metric GaugeMetric.for('by_package.violations.by_other_package.count', 0, Tags.for(['app:MyApp', 'package:packs/other_pack', 'other_package:packs/my_pack', 'team:Foo Team', 'other_team:Bar Team', 'violation_type:architecture', 'layer:product']))
1042+
expect(metrics).to_not include_metric GaugeMetric.for('by_package.violations.by_other_package.count', 0, Tags.for(['app:MyApp', 'package:packs/other_pack', 'other_package:packs/my_pack', 'team:Foo Team', 'other_team:Bar Team', 'violation_type:layer', 'layer:product']))
10431043
expect(metrics).to_not include_metric GaugeMetric.for('by_package.violations.by_other_package.count', 0, Tags.for(['app:MyApp', 'package:packs/other_pack', 'other_package:packs/my_pack', 'team:Foo Team', 'other_team:Bar Team', 'violation_type:visibility', 'layer:product']))
10441044

1045-
expect(metrics).to_not include_metric GaugeMetric.for('by_team.violations.by_other_team.count', 0, Tags.for(['app:MyApp', 'team:Foo Team', 'other_team:Bar Team', 'violation_type:architecture']))
1045+
expect(metrics).to_not include_metric GaugeMetric.for('by_team.violations.by_other_team.count', 0, Tags.for(['app:MyApp', 'team:Foo Team', 'other_team:Bar Team', 'violation_type:layer']))
10461046
expect(metrics).to_not include_metric GaugeMetric.for('by_team.violations.by_other_team.count', 0, Tags.for(['app:MyApp', 'team:Foo Team', 'other_team:Bar Team', 'violation_type:visibility']))
1047-
expect(metrics).to include_metric GaugeMetric.for('by_team.violations.by_other_team.count', 1, Tags.for(['app:MyApp', 'team:Bar Team', 'other_team:Foo Team', 'violation_type:architecture']))
1047+
expect(metrics).to include_metric GaugeMetric.for('by_team.violations.by_other_team.count', 1, Tags.for(['app:MyApp', 'team:Bar Team', 'other_team:Foo Team', 'violation_type:layer']))
10481048
expect(metrics).to include_metric GaugeMetric.for('by_team.violations.by_other_team.count', 1, Tags.for(['app:MyApp', 'team:Bar Team', 'other_team:Foo Team', 'violation_type:visibility']))
10491049
end
10501050
end

0 commit comments

Comments
 (0)