-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
kotlin/src/main/kotlin/org/jetbrains/qodana/cloudclient/examples/gift.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
@file:Suppress("UNUSED_PARAMETER", "unused", "UnusedReceiverParameter") | ||
|
||
package org.jetbrains.qodana.cloudclient.examples | ||
|
||
class QodanaPage(val url: String) | ||
|
||
fun QodanaPage.buyUltimatePlus(): BuyPage { | ||
return BuyPage() | ||
} | ||
|
||
class BuyPage | ||
|
||
fun BuyPage.applyAnnualDiscountForThreeContributors(discountCode: String) { | ||
} | ||
|
||
fun BuyPage.fillPaymentDetails() {} | ||
|
||
fun BuyPage.orderAndPay(): String { | ||
return "" | ||
} | ||
|
||
fun getQodanaCloudProjectToken(license: String): String { | ||
return "token" | ||
} | ||
|
||
fun analyzeRepository(url: String, qodanaLicense: String, block: AnalyzeRepository.() -> Unit): AnalyzeRepository { | ||
return AnalyzeRepository(url, qodanaLicense) | ||
} | ||
|
||
class AnalyzeRepository(val url: String, qodanaLicense: String) { | ||
fun checkLicensesCompliance() { | ||
} | ||
|
||
fun checkVulnerabilities() { | ||
} | ||
|
||
fun checkCodeStyle() { | ||
} | ||
|
||
fun checkBugs() { | ||
|
||
} | ||
|
||
fun checkCoverage() { | ||
} | ||
|
||
fun setQualityGate() { | ||
} | ||
} | ||
|
25 changes: 25 additions & 0 deletions
25
kotlin/src/main/kotlin/org/jetbrains/qodana/cloudclient/examples/qodana-example.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package org.jetbrains.qodana.cloudclient.examples | ||
|
||
fun main() { | ||
val qodanaPage = QodanaPage("https://www.jetbrains.com/qodana/") | ||
val buyPage = qodanaPage.buyUltimatePlus() | ||
|
||
val qodanaFullDiscountCoupon = "xoxp-12345678901-987654321012-987654321012-1234123412341234567890abcdef12345" | ||
buyPage.applyAnnualDiscountForThreeContributors(qodanaFullDiscountCoupon) | ||
buyPage.fillPaymentDetails() | ||
val qodanaLicense = buyPage.orderAndPay() | ||
enjoy(qodanaLicense) | ||
} | ||
|
||
private fun enjoy(qodanaLicense: String) { | ||
val token = getQodanaCloudProjectToken(qodanaLicense) | ||
analyzeRepository("https://github.com/my-project", token) { | ||
checkLicensesCompliance() | ||
checkVulnerabilities() | ||
checkCodeStyle() | ||
checkCoverage() | ||
checkBugs() | ||
|
||
setQualityGate() | ||
} | ||
} |