visualize_packs 0.5.12 → 0.5.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/visualize_packs.rb +16 -13
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8017d316d5d179efe32200f2152bb0abb1c8a3b3299ba8f777a604c07165660e
4
- data.tar.gz: 5f306bd08bdc5cb70eee69ea23a9233ba03ad8d13bd7c6c75c92a39a18f3f1f6
3
+ metadata.gz: fd8d04886b359c5fe0ee721ba30aa63a82cf15cbbd49f4f22aae9bb122d746da
4
+ data.tar.gz: f3e546e753e571226f782fe8aa2ae9cbee845c3629964cd8eedaf1527fc77f90
5
5
  SHA512:
6
- metadata.gz: e9c0773394b6f17466e75e00c825dfcca7a1d359922988b257a08e59fb1ce76e2c373cfe968783d87f3ec8da5b9f500d53d64dcfc74946a3ac804376e22bdeb3
7
- data.tar.gz: aff8ae19a21ca89a91331c2c2679fc64e15c5151e5f59a72a7dc35b7d5df72680e0627d6462ec6b5cc519098263210c60994445a563fc6aa95149be7a4d4c684
6
+ metadata.gz: 23b4d5aeb2ac339bb16a731d66733b47dd4d3583adbd099064a3bcd2c2cd77d56ded62cd64128cf7e992108227f91fa32667622e461e42ed49dcee60cf16fc7d
7
+ data.tar.gz: 3c07f47b89313c37d062550289ca28591a0d2a2023c7fb3f23f401a27710cad28eff6df42775108429af7193374088d0ad9c690599c64c2ad8b0352e921c076c
@@ -12,13 +12,12 @@ module VisualizePacks
12
12
  sig { params(options: Options, raw_config: T::Hash[String, T.untyped], packages: T::Array[ParsePackwerk::Package]).returns(String) }
13
13
  def self.package_graph!(options, raw_config, packages)
14
14
  all_packages = filtered(packages, options).compact.sort_by {|x| x.name }
15
- all_package_names = all_packages.map &:name
16
-
17
15
  all_packages = remove_nested_packs(all_packages, options)
16
+ all_package_names = all_packages.map &:name
18
17
 
19
18
  show_edge = show_edge_builder(options, all_package_names)
20
19
  node_color = node_color_builder()
21
- max_todo_count = max_todo_count(all_packages, show_edge)
20
+ max_todo_count = max_todo_count(all_packages, show_edge, options)
22
21
 
23
22
  title = diagram_title(options, max_todo_count)
24
23
 
@@ -130,17 +129,21 @@ module VisualizePacks
130
129
  end
131
130
  end
132
131
 
133
- sig { params(all_packages: T::Array[ParsePackwerk::Package], show_edge: T.proc.params(arg0: String, arg1: String).returns(T::Boolean)).returns(T.nilable(Integer)) }
134
- def self.max_todo_count(all_packages, show_edge)
132
+ sig { params(all_packages: T::Array[ParsePackwerk::Package], show_edge: T.proc.params(arg0: String, arg1: String).returns(T::Boolean), options: Options).returns(T.nilable(Integer)) }
133
+ def self.max_todo_count(all_packages, show_edge, options)
135
134
  todo_counts = {}
136
- all_packages.each do |package|
137
- todos_by_package = package.violations&.group_by(&:to_package_name)
138
- todos_by_package&.keys&.each do |todos_to_package|
139
- todo_types = todos_by_package&& todos_by_package[todos_to_package]&.group_by(&:type)
140
- todo_types&.keys&.each do |todo_type|
141
- if show_edge.call(package.name, todos_to_package)
142
- key = "#{package.name}->#{todos_to_package}:#{todo_type}"
143
- todo_counts[key] = todo_types && todo_types[todo_type]&.count
135
+ if options.show_todos
136
+ all_packages.each do |package|
137
+ todos_by_package = package.violations&.group_by(&:to_package_name)
138
+ todos_by_package&.keys&.each do |todos_to_package|
139
+ todo_types = todos_by_package&& todos_by_package[todos_to_package]&.group_by(&:type)
140
+ todo_types&.keys&.each do |todo_type|
141
+ if options.only_todo_types.empty? || options.only_todo_types.include?(todo_type)
142
+ if show_edge.call(package.name, todos_to_package)
143
+ key = "#{package.name}->#{todos_to_package}:#{todo_type}"
144
+ todo_counts[key] = todo_types && todo_types[todo_type]&.count
145
+ end
146
+ end
144
147
  end
145
148
  end
146
149
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: visualize_packs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.12
4
+ version: 0.5.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gusto Engineers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-02 00:00:00.000000000 Z
11
+ date: 2023-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler