Skip to content
This repository has been archived by the owner on Oct 14, 2021. It is now read-only.

Commit

Permalink
linter changes (#157)
Browse files Browse the repository at this point in the history
* linter changes

* add github action

* simplify ktlint

* fix lint error
  • Loading branch information
gdams committed Apr 8, 2020
1 parent 26fe502 commit 419790f
Show file tree
Hide file tree
Showing 112 changed files with 786 additions and 930 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ jobs:
- uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: ktlint
run: curl -sSLO https://github.com/pinterest/ktlint/releases/download/0.35.0/ktlint && chmod a+x ktlint && ./ktlint
- name: Extract openapi doc
run: cd adoptopenjdk-api-v3-frontend && unzip target/adoptopenjdk-api-v3-frontend-*-runner.jar META-INF/quarkus-generated-openapi-doc.YAML
- name:
run: cd adoptopenjdk-api-v3-frontend && ../mvnw org.openapitools:openapi-generator-maven-plugin:4.2.2:generate -Dopenapi.generator.maven.plugin.inputSpec=META-INF/quarkus-generated-openapi-doc.YAML
- name: Zip Javascript client
run: zip javascript-client.zip adoptopenjdk-api-v3-frontend/target/generated-sources/openapi
run: zip javascript-client.zip adoptopenjdk-api-v3-frontend/target/generated-sources/openapi
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@ object OpenApiDocs {
"""<p>Details of maven version ranges can be found at <a href="https://maven.apache.org/enforcer/enforcer-rules/versionRanges.html">https://maven.apache.org/enforcer/enforcer-rules/versionRanges.html<a>.</p>"""

const val RELEASE_TYPE = """<p>Type of release. Either a release version, known as General Availability(ga) or an Early Access(ea) </p>"""

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package net.adoptopenjdk.api.v3

import javax.ws.rs.ApplicationPath
import javax.ws.rs.container.ContainerRequestContext
import javax.ws.rs.container.ContainerResponseContext
import javax.ws.rs.container.ContainerResponseFilter
import javax.ws.rs.core.Application
import net.adoptopenjdk.api.v3.dataSources.APIDataStore
import net.adoptopenjdk.api.v3.routes.AssetsResource
import net.adoptopenjdk.api.v3.routes.BinaryResource
Expand All @@ -13,11 +18,6 @@ import net.adoptopenjdk.api.v3.routes.stats.DownloadStatsResource
import org.eclipse.microprofile.openapi.annotations.OpenAPIDefinition
import org.eclipse.microprofile.openapi.annotations.info.Info
import org.eclipse.microprofile.openapi.annotations.servers.Server
import javax.ws.rs.ApplicationPath
import javax.ws.rs.container.ContainerRequestContext
import javax.ws.rs.container.ContainerResponseContext
import javax.ws.rs.container.ContainerResponseFilter
import javax.ws.rs.core.Application

object ServerConfig {
const val SERVER = "https://api.adoptopenjdk.net"
Expand All @@ -44,7 +44,7 @@ class V3 : Application() {
}
})

//Eagerly fetch repo from db on app startup
// Eagerly fetch repo from db on app startup
APIDataStore.getAdoptRepos()

resourceClasses = setOf(
Expand All @@ -67,4 +67,3 @@ class V3 : Application() {
return resourceClasses
}
}

Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package net.adoptopenjdk.api.v3.filters

import java.util.function.Predicate
import net.adoptopenjdk.api.v3.models.Architecture
import net.adoptopenjdk.api.v3.models.Binary
import net.adoptopenjdk.api.v3.models.HeapSize
import net.adoptopenjdk.api.v3.models.ImageType
import net.adoptopenjdk.api.v3.models.JvmImpl
import net.adoptopenjdk.api.v3.models.OperatingSystem
import net.adoptopenjdk.api.v3.models.Project
import java.util.function.Predicate

class BinaryFilter : Predicate<Binary> {

Expand All @@ -19,12 +19,12 @@ class BinaryFilter : Predicate<Binary> {
private val project: Project

constructor(
os: OperatingSystem?,
arch: Architecture?,
imageType: ImageType?,
jvmImpl: JvmImpl?,
heapSize: HeapSize?,
project: Project?
os: OperatingSystem?,
arch: Architecture?,
imageType: ImageType?,
jvmImpl: JvmImpl?,
heapSize: HeapSize?,
project: Project?
) {
this.os = os
this.arch = arch
Expand All @@ -42,5 +42,4 @@ class BinaryFilter : Predicate<Binary> {
(heapSize == null || binary.heap_size == heapSize) &&
(binary.project == project)
}

}
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
package net.adoptopenjdk.api.v3.filters

import java.util.function.Predicate
import net.adoptopenjdk.api.v3.dataSources.APIDataStore
import net.adoptopenjdk.api.v3.models.Release
import net.adoptopenjdk.api.v3.models.ReleaseType
import net.adoptopenjdk.api.v3.models.Vendor
import java.util.function.Predicate

class ReleaseFilter(private val releaseType: ReleaseType? = null,
private val featureVersion: Int? = null,
private val releaseName: String? = null,
private val vendor: Vendor? = null,
private val versionRange: VersionRangeFilter? = null,
private val lts: Boolean? = null) : Predicate<Release> {
class ReleaseFilter(
private val releaseType: ReleaseType? = null,
private val featureVersion: Int? = null,
private val releaseName: String? = null,
private val vendor: Vendor? = null,
private val versionRange: VersionRangeFilter? = null,
private val lts: Boolean? = null
) : Predicate<Release> {

override fun test(release: Release): Boolean {

Expand All @@ -29,5 +31,4 @@ class ReleaseFilter(private val releaseType: ReleaseType? = null,
(versionRange == null || versionRange.test(release.version_data)) &&
ltsFilter
}

}
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package net.adoptopenjdk.api.v3.filters

import java.util.function.Predicate
import net.adoptopenjdk.api.v3.models.VersionData
import org.apache.maven.artifact.versioning.DefaultArtifactVersion
import org.apache.maven.artifact.versioning.VersionRange
import java.util.function.Predicate

class VersionRangeFilter(range: String?) : Predicate<VersionData> {

val rangeMatcher: VersionRange?
val exactMatcher: DefaultArtifactVersion?


init {
// default range behaviour of a solid version is stupid:
// https://cwiki.apache.org/confluence/display/MAVENOLD/Dependency+Mediation+and+Conflict+Resolution#DependencyMediationandConflictResolution-DependencyVersionRanges
Expand All @@ -36,4 +35,4 @@ class VersionRangeFilter(range: String?) : Predicate<VersionData> {
return true
}
}
}
}
Loading

0 comments on commit 419790f

Please sign in to comment.