Skip to content

Commit

Permalink
Add examples working with qodana
Browse files Browse the repository at this point in the history
  • Loading branch information
MekhailS committed Aug 13, 2024
1 parent e4f65d5 commit 926c566
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 0 deletions.
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() {
}
}

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"

Check failure on line 7 in kotlin/src/main/kotlin/org/jetbrains/qodana/cloudclient/examples/qodana-example.kt

View workflow job for this annotation

GitHub Actions / Qodana for JVM

Hardcoded passwords

Hardcoded password detected by "slack-user-token" default rule
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()
}
}

0 comments on commit 926c566

Please sign in to comment.