@@ -31,41 +31,45 @@ def package(name)
3131 Packages . where ( name : name ) . first
3232 end
3333
34- # All violations for a pack
34+ # Get all violations where other packages access code from this package
35+ # (i.e., this package is the producer, others are consumers)
3536 sig { params ( pack_name : String ) . returns ( QueryPackwerk ::Violations ) }
3637 def violations_for ( pack_name )
3738 QueryPackwerk ::Violations . where ( producing_pack : full_name ( pack_name ) )
3839 end
3940
41+ # Get all todos where this package accesses code from other packages
42+ # (i.e., this package is the consumer, others are producers)
43+ sig { params ( pack_name : String ) . returns ( QueryPackwerk ::Violations ) }
4044 def todos_for ( pack_name )
41- package ( pack_name ) . todos
45+ QueryPackwerk :: Violations . where ( consuming_pack : full_name ( pack_name ) )
4246 end
4347
44- # Where the violations occurred
48+ # Get where the violations occurred (where other packages access this package)
4549 sig { params ( pack_name : String ) . returns ( T ::Hash [ String , T ::Array [ String ] ] ) }
4650 def violation_sources_for ( pack_name )
4751 violations_for ( pack_name ) . sources_with_locations
4852 end
4953
50- # How often the violations occurred
54+ # Get how often the violations occurred
5155 sig { params ( pack_name : String , threshold : Integer ) . returns ( T ::Hash [ String , T ::Hash [ String , Integer ] ] ) }
5256 def violation_counts_for ( pack_name , threshold : 0 )
5357 violations_for ( pack_name ) . source_counts ( threshold : threshold )
5458 end
5559
56- # The " shape" of all of the occurring violations
60+ # Get the ' shape' of all violations (how other packages access this package)
5761 sig { params ( pack_name : String ) . returns ( T ::Hash [ String , T ::Array [ String ] ] ) }
5862 def anonymous_violation_sources_for ( pack_name )
5963 violations_for ( pack_name ) . anonymous_sources
6064 end
6165
62- # How often each of those shapes occurs
66+ # Get how often each 'shape' of violation occurs (counts of how other packages access this package)
6367 sig { params ( pack_name : String , threshold : Integer ) . returns ( T ::Hash [ String , T ::Hash [ String , Integer ] ] ) }
6468 def anonymous_violation_counts_for ( pack_name , threshold : 0 )
6569 violations_for ( pack_name ) . anonymous_source_counts ( threshold : threshold )
6670 end
6771
68- # Who consumes this pack?
72+ # Get which packages consume code from this package (who depends on this package)
6973 sig { params ( pack_name : String , threshold : Integer ) . returns ( T ::Hash [ String , Integer ] ) }
7074 def consumers ( pack_name , threshold : 0 )
7175 violations_for ( pack_name ) . consumers ( threshold : threshold )
0 commit comments