Class: Dependabot::Maven::Shared::SharedVersionFinder
- Inherits:
-
Package::PackageLatestVersionFinder
- Object
- Package::PackageLatestVersionFinder
- Dependabot::Maven::Shared::SharedVersionFinder
- Extended by:
- T::Helpers, T::Sig
- Defined in:
- lib/dependabot/maven/shared/shared_version_finder.rb
Direct Known Subclasses
Constant Summary collapse
- MAVEN_RELEASE_QUALIFIERS =
Regex to match common Maven release qualifiers that indicate stable releases. See github.com/apache/maven/blob/848fbb4bf2d427b72bdb2471c22fced7ebd9a7a1/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java#L315-L320
/ ^(?:.+[-._])?( RELEASE|# Official release FINAL| # Final build GA # General Availability )\d*$ /ix- MAVEN_PRE_RELEASE_QUALIFIERS =
Common Maven pre-release qualifiers. Indicate versions not yet stable but released for testing. Examples: 1.0.0-RC1, 2.0.0-ALPHA2, 3.1.0-BETA, 4.0.0-DEV5, etc. See maven.apache.org/guides/mini/guide-naming-conventions.html#version-identifier
/ # Must be at start OR preceded by a delimiter (?: \A | [-._])( # Pre-release qualifiers, each with an optional numeric suffix # (e.g., RC1, BETA2, DEV, PREVIEW1) (?: RC | CR | M | MILESTONE | ALPHA | BETA | EA | EAP | DEV | PREVIEW | PRERELEASE | EXPERIMENTAL | UNSTABLE ) (?:[-._]?\d+)? )$ /ix- MAVEN_SNAPSHOT_QUALIFIER =
/-SNAPSHOT$/i- MIN_GIT_SHA_LENGTH =
Minimum and maximum lengths for Git SHAs
7- MAX_GIT_SHA_LENGTH =
40- GIT_COMMIT =
Regex for a valid Git SHA
-
Only hexadecimal characters (0-9, a-f)
-
Case-insensitive
-
At least one letter a-f to avoid purely numeric strings
-
T.let( /\A(?=[0-9a-f]{#{MIN_GIT_SHA_LENGTH},#{MAX_GIT_SHA_LENGTH}}\z)(?=.*[a-f])/i, Regexp )
Instance Method Summary collapse
Instance Method Details
#matches_dependency_version_type?(comparison_version) ⇒ Boolean
61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/dependabot/maven/shared/shared_version_finder.rb', line 61 def matches_dependency_version_type?(comparison_version) return true unless dependency.version current = dependency.version candidate = comparison_version.to_s return true if pre_release_compatible?(current, candidate) return true if upgrade_to_stable?(current, candidate) suffix_compatible?(current, candidate) end |