lib/rubocop/cop/packs/namespace_convention.rb in rubocop-packs-0.0.9 vs lib/rubocop/cop/packs/namespace_convention.rb in rubocop-packs-0.0.10
- old
+ new
@@ -35,9 +35,12 @@
# This cop only works for files ruby files in `app`
return if !relative_filename.include?('app/') || relative_filepath.extname != '.rb'
relative_filename = relative_filepath.to_s
package_for_path = ParsePackwerk.package_from_path(relative_filename)
+ # If a pack is using automatic pack namespaces, this protection is a no-op since zeitwerk will enforce single namespaces in that case.
+ return if package_for_path.metadata['automatic_pack_namespace']
+
return if package_for_path.nil?
namespace_context = desired_zeitwerk_api.for_file(relative_filename, package_for_path)
return if namespace_context.nil?