Class: Dependabot::Maven::Shared::SharedVersionFinder
- Inherits:
-
Package::PackageLatestVersionFinder
- Object
- Package::PackageLatestVersionFinder
- Dependabot::Maven::Shared::SharedVersionFinder
- Extended by:
- 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. They often indicate versions that are not yet stable but that are released to the public 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 | [-._])( # --- Qualifiers that usually REQUIRE a number --- # Examples: "RC1", "BETA2", "M3", "ALPHA-1", "EAP.2" # The number differentiates multiple pre-releases; a version like "1.0.0-RC" (?i)(?:RC|CR|M|MILESTONE|ALPHA|BETA|EA|EAP)(?:[-._]?\d+)? | # --- Qualifiers that do NOT usually have numbers --- DEV| PREVIEW| PRERELEASE| EXPERIMENTAL| UNSTABLE )$ /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
62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/dependabot/maven/shared/shared_version_finder.rb', line 62 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 |