fun verify()

in intellij-plugin-structure/structure-intellij/src/main/java/com/jetbrains/plugin/structure/intellij/verifiers/ProductReleaseVersionVerifier.kt [12:43]


  fun verify(plugin: PluginBean, descriptorPath: String, problemRegistrar: ProblemRegistrar): VerificationResult {
    if (plugin.productDescriptor == null) return VerificationResult.NotApplicable

    val releaseVersionValue = plugin.productDescriptor?.releaseVersion
    if (releaseVersionValue.isNullOrEmpty()) {
      return Invalid("Attribute '$RELEASE_VERSION_ATTRIBUTE_NAME' is missing").also {
        problemRegistrar.registerProblem(PropertyNotSpecified(RELEASE_VERSION_ATTRIBUTE_NAME, descriptorPath))
      }
    }

    return try {
      ProductReleaseVersion.parse(releaseVersionValue).run {
        if (isSingleDigit) {
          Invalid("Attribute '$RELEASE_VERSION_ATTRIBUTE_NAME' must have two or more digits: '$releaseVersionValue'").also {
            problemRegistrar.registerProblem(ReleaseVersionWrongFormat(descriptorPath, releaseVersionValue))
          }
        } else {
          verifyPluginVersionAndReleaseVersionMatch(
            plugin,
            productReleaseVersion = this,
            descriptorPath,
            problemRegistrar
          )
          VerificationResult.Valid(this)
        }
      }
    } catch (e: NumberFormatException) {
      Invalid("Attribute '$RELEASE_VERSION_ATTRIBUTE_NAME' is not an integer: '$releaseVersionValue'").also {
        problemRegistrar.registerProblem(NotNumber(RELEASE_VERSION_ATTRIBUTE_NAME, descriptorPath))
      }
    }
  }