Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report] - Packwerk::NodeHelpers::TypeError #299

Open
huguesbr opened this issue Feb 2, 2023 · 3 comments
Open

[Bug Report] - Packwerk::NodeHelpers::TypeError #299

huguesbr opened this issue Feb 2, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@huguesbr
Copy link

huguesbr commented Feb 2, 2023

Description
When running bin/packwerk check I got the following error

bin/packwerk check
[TEST PROF INFO] Spring detected
📦 Packwerk is inspecting 4433 files
...........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................Traceback (most recent call last):
	140: from bin/packwerk:27:in `<main>'
	139: from bin/packwerk:27:in `load'
	138: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/exe/packwerk:12:in `<top (required)>'
	137: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/_methods.rb:275:in `block in _on_method_added'
	136: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation.rb:256:in `validate_call'
	135: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation.rb:256:in `bind_call'
	134: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/cli.rb:43:in `run'
	133: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/_methods.rb:275:in `block in _on_method_added'
	132: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation.rb:256:in `validate_call'
	131: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation.rb:256:in `bind_call'
	130: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/cli.rb:54:in `execute_command'
	129: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/_methods.rb:275:in `block in _on_method_added'
	128: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation.rb:256:in `validate_call'
	127: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation.rb:256:in `bind_call'
	126: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/parse_run.rb:68:in `check'
	125: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/_methods.rb:275:in `block in _on_method_added'
	124: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation.rb:256:in `validate_call'
	123: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation.rb:256:in `bind_call'
	122: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/parse_run.rb:97:in `find_offenses'
	121: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/2.7.0/benchmark.rb:308:in `realtime'
	120: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/parse_run.rb:99:in `block in find_offenses'
	119: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/parallel-1.22.1/lib/parallel.rb:307:in `flat_map'
	118: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/parallel-1.22.1/lib/parallel.rb:294:in `map'
	117: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/parallel-1.22.1/lib/parallel.rb:457:in `work_in_processes'
	116: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/parallel-1.22.1/lib/parallel.rb:518:in `create_workers'
	115: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/parallel-1.22.1/lib/parallel.rb:518:in `each_with_index'
	114: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/parallel-1.22.1/lib/parallel.rb:518:in `each'
	113: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/parallel-1.22.1/lib/parallel.rb:519:in `block in create_workers'
	112: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/parallel-1.22.1/lib/parallel.rb:528:in `worker'
	111: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/parallel-1.22.1/lib/parallel.rb:528:in `fork'
	110: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/parallel-1.22.1/lib/parallel.rb:537:in `block in worker'
	109: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/parallel-1.22.1/lib/parallel.rb:557:in `process_incoming_jobs'
	108: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/parallel-1.22.1/lib/parallel.rb:587:in `call_with_index'
	107: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/parse_run.rb:91:in `block in find_offenses'
	106: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation.rb:95:in `block in create_validator_slow_skip_block_type'
	105: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation.rb:153:in `validate_call_skip_block_type'
	104: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation.rb:153:in `bind_call'
	103: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/run_context.rb:83:in `process_file'
	102: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation_2_7.rb:106:in `block in create_validator_method_fast1'
	101: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation_2_7.rb:106:in `bind_call'
	100: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/file_processor.rb:46:in `call'
	 99: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation.rb:177:in `block in create_validator_slow'
	 98: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation.rb:256:in `validate_call'
	 97: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation.rb:256:in `bind_call'
	 96: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/cache.rb:78:in `with_cache'
	 95: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/file_processor.rb:50:in `block in call'
	 94: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation_2_7.rb:764:in `block in create_validator_method_medium2'
	 93: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation_2_7.rb:764:in `bind_call'
	 92: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/file_processor.rb:66:in `references_from_ast'
	 91: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation.rb:95:in `block in create_validator_slow_skip_block_type'
	 90: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation.rb:153:in `validate_call_skip_block_type'
	 89: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation.rb:153:in `bind_call'
	 88: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/node_processor_factory.rb:15:in `for'
	 87: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation.rb:95:in `block in create_validator_slow_skip_block_type'
	 86: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation.rb:153:in `validate_call_skip_block_type'
	 85: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation.rb:153:in `bind_call'
	 84: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/node_processor_factory.rb:24:in `reference_extractor'
	 83: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/node_processor_factory.rb:24:in `new'
	 82: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation.rb:95:in `block in create_validator_slow_skip_block_type'
	 81: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation.rb:153:in `validate_call_skip_block_type'
	 80: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation.rb:153:in `bind_call'
	 79: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/reference_extractor.rb:66:in `initialize'
	 78: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/reference_extractor.rb:66:in `new'
	 77: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/parsed_constant_definitions.rb:27:in `initialize'
	 76: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/parsed_constant_definitions.rb:55:in `collect_local_definitions_from_root'
	 75: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation_2_7.rb:703:in `block in create_validator_method_medium1'
	 74: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation_2_7.rb:703:in `bind_call'
	 73: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/node_helpers.rb:67:in `each_child'
	 72: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/node_helpers.rb:67:in `each'
	 71: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/node_helpers.rb:68:in `block in each_child'
	 70: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/parsed_constant_definitions.rb:55:in `block in collect_local_definitions_from_root'
	 69: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/parsed_constant_definitions.rb:55:in `collect_local_definitions_from_root'
	 68: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation_2_7.rb:703:in `block in create_validator_method_medium1'
	 67: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation_2_7.rb:703:in `bind_call'
	 66: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/node_helpers.rb:67:in `each_child'
	 65: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/node_helpers.rb:67:in `each'
	 64: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/node_helpers.rb:68:in `block in each_child'
	 63: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/parsed_constant_definitions.rb:55:in `block in collect_local_definitions_from_root'
	 62: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/parsed_constant_definitions.rb:55:in `collect_local_definitions_from_root'
	 61: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation_2_7.rb:703:in `block in create_validator_method_medium1'
	 60: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation_2_7.rb:703:in `bind_call'
	 59: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/node_helpers.rb:67:in `each_child'
	 58: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/node_helpers.rb:67:in `each'
	 57: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/node_helpers.rb:68:in `block in each_child'
	 56: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/parsed_constant_definitions.rb:55:in `block in collect_local_definitions_from_root'
	 55: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/parsed_constant_definitions.rb:55:in `collect_local_definitions_from_root'
	 54: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation_2_7.rb:703:in `block in create_validator_method_medium1'
	 53: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation_2_7.rb:703:in `bind_call'
	 52: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/node_helpers.rb:67:in `each_child'
	 51: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/node_helpers.rb:67:in `each'
	 50: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/node_helpers.rb:68:in `block in each_child'
	 49: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/parsed_constant_definitions.rb:55:in `block in collect_local_definitions_from_root'
	 48: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/parsed_constant_definitions.rb:55:in `collect_local_definitions_from_root'
	 47: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation_2_7.rb:703:in `block in create_validator_method_medium1'
	 46: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation_2_7.rb:703:in `bind_call'
	 45: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/node_helpers.rb:67:in `each_child'
	 44: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/node_helpers.rb:67:in `each'
	 43: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/node_helpers.rb:68:in `block in each_child'
	 42: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/parsed_constant_definitions.rb:55:in `block in collect_local_definitions_from_root'
	 41: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/parsed_constant_definitions.rb:55:in `collect_local_definitions_from_root'
	 40: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation_2_7.rb:703:in `block in create_validator_method_medium1'
	 39: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation_2_7.rb:703:in `bind_call'
	 38: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/node_helpers.rb:67:in `each_child'
	 37: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/node_helpers.rb:67:in `each'
	 36: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/node_helpers.rb:68:in `block in each_child'
	 35: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/parsed_constant_definitions.rb:55:in `block in collect_local_definitions_from_root'
	 34: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/parsed_constant_definitions.rb:55:in `collect_local_definitions_from_root'
	 33: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation_2_7.rb:703:in `block in create_validator_method_medium1'
	 32: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation_2_7.rb:703:in `bind_call'
	 31: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/node_helpers.rb:67:in `each_child'
	 30: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/node_helpers.rb:67:in `each'
	 29: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/node_helpers.rb:68:in `block in each_child'
	 28: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/parsed_constant_definitions.rb:55:in `block in collect_local_definitions_from_root'
	 27: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/parsed_constant_definitions.rb:55:in `collect_local_definitions_from_root'
	 26: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation_2_7.rb:703:in `block in create_validator_method_medium1'
	 25: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation_2_7.rb:703:in `bind_call'
	 24: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/node_helpers.rb:67:in `each_child'
	 23: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/node_helpers.rb:67:in `each'
	 22: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/node_helpers.rb:68:in `block in each_child'
	 21: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/parsed_constant_definitions.rb:55:in `block in collect_local_definitions_from_root'
	 20: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/parsed_constant_definitions.rb:55:in `collect_local_definitions_from_root'
	 19: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation_2_7.rb:703:in `block in create_validator_method_medium1'
	 18: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation_2_7.rb:703:in `bind_call'
	 17: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/node_helpers.rb:67:in `each_child'
	 16: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/node_helpers.rb:67:in `each'
	 15: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/node_helpers.rb:68:in `block in each_child'
	 14: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/parsed_constant_definitions.rb:55:in `block in collect_local_definitions_from_root'
	 13: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/parsed_constant_definitions.rb:55:in `collect_local_definitions_from_root'
	 12: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation_2_7.rb:703:in `block in create_validator_method_medium1'
	 11: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation_2_7.rb:703:in `bind_call'
	 10: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/node_helpers.rb:67:in `each_child'
	  9: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/node_helpers.rb:67:in `each'
	  8: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/node_helpers.rb:68:in `block in each_child'
	  7: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/parsed_constant_definitions.rb:55:in `block in collect_local_definitions_from_root'
	  6: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/parsed_constant_definitions.rb:43:in `collect_local_definitions_from_root'
	  5: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation_2_7.rb:106:in `block in create_validator_method_fast1'
	  4: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation_2_7.rb:106:in `bind_call'
	  3: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/node_helpers.rb:53:in `constant_name'
	  2: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation_2_7.rb:106:in `block in create_validator_method_fast1'
	  1: from /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.10647/lib/types/private/methods/call_validation_2_7.rb:106:in `bind_call'
/Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/node_helpers.rb:60:in `constant_name': Packwerk::NodeHelpers::TypeError (Packwerk::NodeHelpers::TypeError)

To Reproduce
Unsure

Expected Behaviour
Running the check properly

Screenshots
If applicable, add screenshots to help explain your problem.

Version Information

  • Packwerk: 2.2.2
  • Ruby 2.7.7

Additional Context
I've added some debug statement where the error is raised

def constant_name(constant_node)
        case type_of(constant_node)
        when CONSTANT_ROOT_NAMESPACE
          ""
        when CONSTANT, CONSTANT_ASSIGNMENT, SELF
          # (const nil :Foo)
          #   "Foo"
          # (const (cbase) :Foo)
          #   "::Foo"
          # (const (lvar :a) :Foo)
          #   "a::Foo"
          # (casgn nil :Foo (int 1))
          #   "Foo = 1"
          # (casgn (cbase) :Foo (int 1))
          #   "::Foo = 1"
          # (casgn (lvar :a) :Foo (int 1))
          #   "a::Foo = 1"
          # (casgn (self) :Foo (int 1))
          #   "self::Foo = 1"
          namespace, name = constant_node.children

          if namespace
            [constant_name(namespace), name].join("::")
          else
            name.to_s
          end
        else
          puts "constant_node: #{constant_node}"
          puts "type_of(constant_node): #{type_of(constant_node)}"
          raise TypeError
        end
      end

And I got the following logs

constant_node: (send
  (self) :class)
type_of(constant_node): send
constant_node: (send nil :described_class)
type_of(constant_node): send

Because packwerk seems to leverage parallel, it's a bit harder to debug using binding.pry

The described_class leads me to believe packwerk doesn't some of my specs files...

@huguesbr huguesbr added the bug Something isn't working label Feb 2, 2023
@huguesbr
Copy link
Author

huguesbr commented Feb 2, 2023

Reading about the parallel gem, I've set the env variable export PARALLEL_PROCESSOR_COUNT=1 and use binding.pry to get more insight on the failure

hugues@macbook-pro-hugues:~/Developer/babylist-web|packwerk⚡ ⇒  bin/packwerk check
[TEST PROF INFO] Spring detected
📦 Packwerk is inspecting 4433 files
.......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
From: /Users/hugues/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/packwerk-2.2.2/lib/packwerk/node_helpers.rb:59 Packwerk::NodeHelpers.constant_name:

    54:           else
    55:             name.to_s
    56:           end
    57:         else
    58:           binding.pry
 => 59:           raise TypeError
    60:         end
    61:       end
    62:
    63:       sig { params(node: AST::Node).returns(T.untyped) }
    64:       def each_child(node)

[babylist-web][test] Packwerk::NodeHelpers:0> constant_node
=> s(:send,
  s(:self), :class)
[babylist-web][test] Packwerk::NodeHelpers:0> type_of(constant_node)
=> :send

@huguesbr huguesbr changed the title [Bug Report] [Bug Report] - Packwerk::NodeHelpers::TypeError Feb 2, 2023
@huguesbr
Copy link
Author

huguesbr commented Feb 2, 2023

The source of the issue is indeed in the spec, excluding the spec directory in packwerk.yml "fix" the issue

# packwerk.yml
 exclude:
 - "{spec}/**/*"

@jamesbrauman
Copy link

I'm getting the same error with my spec directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants