From dd9a44fe51b174a494a3c6d6b467d74dc9db6b05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Meyer=20de=20Ville?= Date: Thu, 16 Apr 2020 14:27:04 -0700 Subject: [PATCH 1/2] feature: add provider Heroku CI --- .../rules/commituuid/CommitUUIDProvider.scala | 1 + .../commituuid/providers/HerokuCIProvider.scala | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 src/main/scala/com/codacy/rules/commituuid/providers/HerokuCIProvider.scala diff --git a/src/main/scala/com/codacy/rules/commituuid/CommitUUIDProvider.scala b/src/main/scala/com/codacy/rules/commituuid/CommitUUIDProvider.scala index 4e9125cf..f53950d1 100644 --- a/src/main/scala/com/codacy/rules/commituuid/CommitUUIDProvider.scala +++ b/src/main/scala/com/codacy/rules/commituuid/CommitUUIDProvider.scala @@ -118,6 +118,7 @@ object CommitUUIDProvider extends StrictLogging { new DockerProvider, new GitlabProvider, new GreenhouseCIProvider, + new HerokuCIProvider, new JenkinsProvider, new MagnumCIProvider, new SemaphoreCIProvider, diff --git a/src/main/scala/com/codacy/rules/commituuid/providers/HerokuCIProvider.scala b/src/main/scala/com/codacy/rules/commituuid/providers/HerokuCIProvider.scala new file mode 100644 index 00000000..a73412a2 --- /dev/null +++ b/src/main/scala/com/codacy/rules/commituuid/providers/HerokuCIProvider.scala @@ -0,0 +1,16 @@ +package com.codacy.rules.commituuid.providers + +import com.codacy.model.configuration.CommitUUID +import com.codacy.rules.commituuid.CommitUUIDProvider + +/** Heroku CI provider */ +class HerokuCIProvider extends CommitUUIDProvider { + val name: String = "Heroku CI" + + override def validate(a: Map[String, String]): Boolean = { + a.get("CI").contains("true") && a.get("HEROKU_TEST_RUN_ID").isDefined + } + + override def getUUID(a: Map[String, String]): Either[String, CommitUUID] = + withErrorMessage(a.get("HEROKU_TEST_RUN_COMMIT_VERSION")) +} From fa22fba47fcd4a0e1162928e1c383b4f57badc60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Meyer=20de=20Ville?= Date: Thu, 16 Apr 2020 14:27:22 -0700 Subject: [PATCH 2/2] doc: add provider Heroku CI --- docs/commit_detection.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/commit_detection.md b/docs/commit_detection.md index 17661913..0d773d0d 100644 --- a/docs/commit_detection.md +++ b/docs/commit_detection.md @@ -13,6 +13,7 @@ Codacy automatically detects a commit SHA hash from several sources in the follo - Docker - Gitlab - Greenhouse CI +- Heroku CI - Jenkins - Magnum CI - Semaphore CI