-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial Snyk integraiton #24
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: "Snyk Monitor" | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
security-events: write | ||
checks: write | ||
issues: read | ||
pull-requests: write | ||
statuses: write | ||
id-token: write | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
snyk-monitor: | ||
name: Snyk Monitor | ||
uses: ./.github/workflows/comp-compile-pbj-code.yaml | ||
with: | ||
custom-job-label: Standard | ||
enable-snyk-monitor: true | ||
secrets: | ||
access-token: ${{ secrets.GITHUB_TOKEN }} | ||
snyk-token: ${{ secrets.SNYK_TOKEN }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -706,3 +706,6 @@ Temporary Items | |
|
||
### Generated Protobuf Files | ||
/tests/src/main/proto/ | ||
|
||
### Snyk binary | ||
snyk |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,63 @@ | ||||||||||||||||||||||||||
/*- | ||||||||||||||||||||||||||
* | ||||||||||||||||||||||||||
* Hedera Mirror Node | ||||||||||||||||||||||||||
* | ||||||||||||||||||||||||||
* Copyright (C) 2019 - 2023 Hedera Hashgraph, LLC | ||||||||||||||||||||||||||
* | ||||||||||||||||||||||||||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||||||||||||||||||||||||||
* you may not use this file except in compliance with the License. | ||||||||||||||||||||||||||
* You may obtain a copy of the License at | ||||||||||||||||||||||||||
* | ||||||||||||||||||||||||||
* http://www.apache.org/licenses/LICENSE-2.0 | ||||||||||||||||||||||||||
* | ||||||||||||||||||||||||||
* Unless required by applicable law or agreed to in writing, software | ||||||||||||||||||||||||||
* distributed under the License is distributed on an "AS IS" BASIS, | ||||||||||||||||||||||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||||||||||||||||||||||
* See the License for the specific language governing permissions and | ||||||||||||||||||||||||||
* limitations under the License. | ||||||||||||||||||||||||||
* | ||||||||||||||||||||||||||
*/ | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
plugins { | ||||||||||||||||||||||||||
id("io.snyk.gradle.plugin.snykplugin") | ||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
abstract class SnykCodeTask : io.snyk.gradle.plugin.SnykTask() { | ||||||||||||||||||||||||||
@TaskAction | ||||||||||||||||||||||||||
fun doSnykTest() { | ||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The issue highlighted by the linter detekt is that the To fix this issue, you should add a documentation comment to the Here's an example of how you can add documentation to the
Suggested change
Adding documentation comments like the one above will resolve the issue reported by detekt and improve the maintainability of your code. This comment was generated by an experimental AI tool. |
||||||||||||||||||||||||||
log.debug("Snyk Code Test Task") | ||||||||||||||||||||||||||
authentication() | ||||||||||||||||||||||||||
val output: io.snyk.gradle.plugin.Runner.Result = runSnykCommand("code test") | ||||||||||||||||||||||||||
log.lifecycle(output.output) | ||||||||||||||||||||||||||
if (output.exitcode > 0) { | ||||||||||||||||||||||||||
throw GradleException("Snyk Code Test failed") | ||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
tasks.register<SnykCodeTask>("snyk-code") { | ||||||||||||||||||||||||||
dependsOn("snyk-check-binary") | ||||||||||||||||||||||||||
doFirst { | ||||||||||||||||||||||||||
snyk { | ||||||||||||||||||||||||||
setSeverity("high") | ||||||||||||||||||||||||||
setArguments("--all-sub-projects --sarif-file-output=build/reports/snyk-code.sarif") | ||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
tasks.`snyk-monitor` { | ||||||||||||||||||||||||||
doFirst { | ||||||||||||||||||||||||||
snyk { | ||||||||||||||||||||||||||
setArguments("--all-sub-projects") | ||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
tasks.`snyk-test` { | ||||||||||||||||||||||||||
doFirst { | ||||||||||||||||||||||||||
snyk { | ||||||||||||||||||||||||||
setSeverity("high") | ||||||||||||||||||||||||||
setArguments("--all-sub-projects --json-file-output=build/reports/snyk-test.json") | ||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue reported by the linter detekt is that the
SnykCodeTask
abstract class is missing required documentation. In Kotlin, as in many other programming languages, it is considered good practice to document classes, interfaces, functions, etc., especially when they are part of a public API or intended to be used by other developers. This documentation usually takes the form of a comment block above the class declaration that explains the purpose and usage of the class.To fix this issue, you should add a KDoc comment block above the
SnykCodeTask
class declaration. KDoc is Kotlin's documentation system, which uses a syntax similar to Java's Javadoc. This comment should provide a clear description of what the class is for and any important information that a developer using this class should know.Here is an example of how you might document the
SnykCodeTask
class:By adding this documentation, you will resolve the linter issue, and other developers will have a better understanding of the purpose and functionality of the
SnykCodeTask
class.This comment was generated by an experimental AI tool.