Sha256: bf93b6b8eb5255d863dd208d87bb04a4f57265af0013cb8b57748d8ac51c079f

Contents?: true

Size: 853 Bytes

Versions: 5

Compression:

Stored size: 853 Bytes

Contents

# typed: strict
# frozen_string_literal: true

module Packwerk
  module ReferenceChecking
    module Checkers
      # Checks whether a given reference conforms to the configured graph of dependencies.
      class DependencyChecker
        extend T::Sig
        include Checker

        sig { override.returns(ViolationType) }
        def violation_type
          ViolationType::Dependency
        end

        sig do
          override
            .params(reference: Packwerk::Reference)
            .returns(T::Boolean)
        end
        def invalid_reference?(reference)
          return false unless reference.source_package
          return false unless reference.source_package.enforce_dependencies?
          return false if reference.source_package.dependency?(reference.constant.package)
          true
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
packwerk-2.2.0 lib/packwerk/reference_checking/checkers/dependency_checker.rb
packwerk-2.1.1 lib/packwerk/reference_checking/checkers/dependency_checker.rb
packwerk-2.1.0 lib/packwerk/reference_checking/checkers/dependency_checker.rb
packwerk-2.0.0 lib/packwerk/reference_checking/checkers/dependency_checker.rb
packwerk-1.4.0 lib/packwerk/reference_checking/checkers/dependency_checker.rb