Class: Dependabot::Nuget::CompatibilityChecker
- Inherits:
-
Object
- Object
- Dependabot::Nuget::CompatibilityChecker
- Extended by:
- T::Sig
- Defined in:
- lib/dependabot/nuget/update_checker/compatibility_checker.rb
Instance Method Summary collapse
- #compatible?(version) ⇒ Boolean
-
#initialize(dependency_urls:, dependency:) ⇒ CompatibilityChecker
constructor
A new instance of CompatibilityChecker.
Constructor Details
#initialize(dependency_urls:, dependency:) ⇒ CompatibilityChecker
Returns a new instance of CompatibilityChecker.
24 25 26 27 |
# File 'lib/dependabot/nuget/update_checker/compatibility_checker.rb', line 24 def initialize(dependency_urls:, dependency:) @dependency_urls = dependency_urls @dependency = dependency end |
Instance Method Details
#compatible?(version) ⇒ Boolean
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/dependabot/nuget/update_checker/compatibility_checker.rb', line 30 def compatible?(version) nuspec_xml = NuspecFetcher.fetch_nuspec(dependency_urls, dependency.name, version) return false unless nuspec_xml # development dependencies are packages such as analyzers which need to be compatible with the compiler not the # project itself, but some packages that report themselves as development dependencies still contain target # framework dependencies and should be checked for compatibility through the regular means return true if pure_development_dependency?(nuspec_xml) package_tfms = parse_package_tfms(nuspec_xml) package_tfms = fetch_package_tfms(version) if package_tfms.empty? # nil is a special return value that indicates that the package is likely a development dependency return true if package_tfms.nil? return false if package_tfms.empty? return false if project_tfms.nil? || project_tfms&.empty? TfmComparer.are_frameworks_compatible?(T.must(project_tfms), package_tfms) end |