All Projects → JetBrains → qodana-action

JetBrains / qodana-action

Licence: Apache-2.0 License
⚙️ Scan your Java, Kotlin, PHP, Python, JavaScript, TypeScript projects at GitHub with Qodana

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to qodana-action

Reviewdog
🐶 Automated code review tool integrated with any code analysis tools regardless of programming language
Stars: ✭ 4,541 (+3954.46%)
Mutual labels:  static-code-analysis, ci, static-analysis, code-review, code-quality
sonarqube-action
Integrate SonarQube scanner to GitHub Actions
Stars: ✭ 90 (-19.64%)
Mutual labels:  static-analysis, code-review, code-quality, devsecops, github-actions
overview
Automate your workflows with GitHub actions for MATLAB.
Stars: ✭ 40 (-64.29%)
Mutual labels:  continuous-integration, ci, actions, github-actions, github-action
changed-files
Github action to retrieve all (added, copied, modified, deleted, renamed, type changed, unmerged, unknown) files and directories.
Stars: ✭ 733 (+554.46%)
Mutual labels:  continuous-integration, ci, actions, github-actions, github-action
Android-CICD
This repo demonstrates how to work on CI/CD for Mobile Apps 📱 using Github Actions 💊 + Firebase Distribution 🎉
Stars: ✭ 37 (-66.96%)
Mutual labels:  static-code-analysis, continuous-integration, ci, actions, github-actions
xray-action
... a GitHub action to import test results into "Xray" - A complete Test Management tool for Jira.
Stars: ✭ 16 (-85.71%)
Mutual labels:  continuous-integration, ci, actions, github-actions
github-act-runner
act as self-hosted runner
Stars: ✭ 68 (-39.29%)
Mutual labels:  continuous-integration, ci, actions, github-actions
static-code-analysis-plugin
A plugin to simplify Static Code Analysis on Gradle. Not restricted to, but specially useful, in Android projects, by making sure all analysis can access the SDK classes.
Stars: ✭ 36 (-67.86%)
Mutual labels:  static-code-analysis, static-analysis, code-quality
assign-one-project-github-action
Automatically add an issue or pull request to specific GitHub Project(s) when you create and/or label them.
Stars: ✭ 140 (+25%)
Mutual labels:  actions, github-actions, github-action
ssh2actions
Connect to GitHub Actions VM via SSH for interactive debugging
Stars: ✭ 62 (-44.64%)
Mutual labels:  actions, github-actions, github-action
action-junit-report
Reports junit test results as GitHub Pull Request Check
Stars: ✭ 103 (-8.04%)
Mutual labels:  ci, actions, github-actions
jacoco-report
Github action that publishes the JaCoCo report as a comment in the Pull Request
Stars: ✭ 31 (-72.32%)
Mutual labels:  actions, code-quality, github-actions
megalinter
🦙 Mega-Linter analyzes 48 languages, 22 formats, 19 tooling formats, excessive copy-pastes, spelling mistakes and security issues in your repository sources with a GitHub Action, other CI tools or locally.
Stars: ✭ 534 (+376.79%)
Mutual labels:  ci, code-quality, github-actions
link-snitch
GitHub Action to scan your site for broken links so you can fix them 🔗
Stars: ✭ 50 (-55.36%)
Mutual labels:  continuous-integration, actions, github-actions
bump-everywhere
🚀 Automate versioning, changelog creation, README updates and GitHub releases using GitHub Actions,npm, docker or bash.
Stars: ✭ 24 (-78.57%)
Mutual labels:  continuous-integration, github-actions, github-action
prettier
🔨 Native, blazingly-fast Prettier CLI on Github Actions
Stars: ✭ 19 (-83.04%)
Mutual labels:  continuous-integration, ci, github-actions
branch-protection-bot
A bot tool to disable and re-enable "Include administrators" option in branch protection
Stars: ✭ 57 (-49.11%)
Mutual labels:  ci, actions, github-actions
codeclimate-phpcodesniffer
Code Climate Engine for PHP Code Sniffer
Stars: ✭ 27 (-75.89%)
Mutual labels:  static-code-analysis, static-analysis, code-quality
release-helper
🤖 A GitHub Action that help you publish release.
Stars: ✭ 27 (-75.89%)
Mutual labels:  ci, actions, github-actions
setup-scheme
Github Actions CI / CD setup for Scheme
Stars: ✭ 13 (-88.39%)
Mutual labels:  continuous-integration, ci, github-actions

Qodana Scan

official JetBrains project GitHub Discussions Twitter Follow

Qodana is a code quality monitoring tool that identifies and suggests fixes for bugs, security vulnerabilities, duplications, and imperfections. Using this GitHub Action, run Qodana with your GitHub workflow to scan your Java, Kotlin, PHP, Python, JavaScript, TypeScript projects ( and other supported technologies by Qodana).

Table of Contents

Usage

Basic configuration

To configure Qodana Scan, save the .github/workflows/code_quality.yml file containing the workflow configuration:

name: Qodana
on:
  workflow_dispatch:
  pull_request:
  push:
    branches:
      - main
      - 'releases/*'

jobs:
  qodana:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: 'Qodana Scan'
        uses: JetBrains/[email protected]
        with:
          linter: jetbrains/qodana-<linter>

Using this workflow, Qodana will run on the main branch, release branches, and on the pull requests coming to your repository. Inspection results will be available in the GitHub UI. The jetbrains/qodana-<linter> option specifies a Qodana linter.

We recommend that you have a separate workflow file for Qodana because different jobs run in parallel .

GitHub code scanning

You can set up GitHub code scanning for your project using Qodana. To do it, add these lines to the code_quality.yml workflow file right below the basic configuration of Qodana Scan:

      - uses: github/codeql-action/upload-sarif@v1
        with:
          sarif_file: ${{ runner.temp }}/qodana/results/qodana.sarif.json

This sample invokes codeql-action for uploading a SARIF-formatted Qodana report to GitHub, and specifies the report file using the sarif_file key.

💡 GitHub code scanning does not export inspection results to third-party tools, which means that you cannot use this data for further processing by Qodana. In this case, you have to set up baseline and quality gate processing on the Qodana side prior to submitting inspection results to GitHub code scanning, see the Quality gate and baseline section for details.

Pull request quality gate

You can enforce GitHub to block the merge of pull requests if the Qodana quality gate has failed. To do it, create a branch protection rule as described below:

  1. Create a new or open an existing GitHub workflow that invokes the Qodana Scan action.
  2. Set the workflow to run on pull_request events that target the main branch.
on:
  pull_request:
    branches:
      - main

Instead of main, you can specify your branch here.

  1. Set the number of problems (integer) for the Qodana action fail-threshold option.
  2. Under your repository name, click Settings.
  3. On the left menu, click Branches.
  4. In the branch protection rules section, click Add rule.
  5. Add main to Branch name pattern.
  6. Select Require status checks to pass before merging.
  7. Search for the Qodana status check, then check it.
  8. Click Create.

Quality gate and baseline

You can combine the quality gate and baseline features to manage your technical debt, report only new problems, and block pull requests that contain too many problems.

Follow these steps to establish a baseline for your project:

  1. Run Qodana locally over your project:
docker run --rm -v <source-directory>/:/data/project/ \
  -p 8080:8080 jetbrains/qodana-<linter> --show-report
  1. Open your report at http://localhost:8080/, add detected problems to the baseline, and download the qodana.sarif.json file.

  2. Upload the qodana.sarif.json file to your project root folder on GitHub.

  3. Append this line to the Qodana Scan action configuration in the code_quality.yml file:

baseline-path: qodana.sarif.json; 

If you want to update the baseline, you need to repeat these steps once again.

Starting from this, GitHub will generate alters only for the problems that were not added to the baseline as new.

To establish a quality gate additionally to the baseline, add this line to code_quality.yml right after the baseline-path line:

fail-threshold: <number-of-accepted-problems>

Based on this, you will be able to detect only new problems in pull requests that fall beyond the baseline. At the same time, pull requests with new problems exceeding the fail-threshold limit will be blocked and the workflow will fail.

GitHub Pages

If you wish to study Qodana reports directly on GitHub, you can host them on your GitHub Pages repository using this example workflow:

      - name: Deploy to GitHub Pages
        uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ${{ runner.temp }}/qodana/results/report
          destination_dir: ./

Hosting of multiple Qodana reports in a single GitHub Pages repository is not supported.

Get a Qodana badge

You can set up a Qodana workflow badge in your repository:

Qodana

To do it, follow these steps:

  1. Navigate to the workflow run that you previously configured.
  2. On the workflow page, select Create status badge.
  3. Copy the Markdown text to your repository README file.

Creating status badge

Configuration

Name Description Default Value
linter Official Qodana Docker image. Required. jetbrains/qodana-jvm-community:latest
project-dir The project's root directory to be analyzed. Optional ${{ github.workspace }}
results-dir Directory to store the analysis results. Optional. ${{ runner.temp }}/qodana/results
cache-dir Directory to store Qodana caches. Optional. ${{ runner.temp }}/qodana/caches
idea-config-dir IntelliJ IDEA configuration directory. Optional. -
gradle-settings-path Provide path to gradle.properties file. An example: "/your/custom/path/gradle.properties". Optional. -
additional-volumes Mount additional volumes to Docker container. Multiline input variable: specify multiple values with newlines. Optional. -
additional-env-variables Pass additional environment variables to docker container. Multiline input variable: specify multiple values with newlines. Optional. -
fail-threshold Set the number of problems that will serve as a quality gate. If this number is reached, the pipeline run is terminated. Optional. -
inspected-dir Directory to be inspected. If not specified, the whole project is inspected by default. Optional. -
baseline-path Run in baseline mode. Provide the path to an existing SARIF report to be used in the baseline state calculation. Optional. -
baseline-include-absent Include the results from the baseline absent in the current Qodana run in the output report. Optional. false
changes Inspect uncommitted changes and report new problems. Optional. false
script Override the default docker scenario. Optional. -
profile-name Name of a profile defined in the project. Optional. -
profile-path Absolute path to the profile file. Optional. -
token Qodana Cloud token, if specified, the report will be sent to Qodana Cloud. Optional. -
upload-result Upload Qodana results as an artifact to the job. Optional. true
artifact-name Specify Qodana results artifact name, used for results uploading. Optional. Qodana report
use-caches Utilize GitHub caches for Qodana runs. Optional. true
additional-cache-hash Allows customizing the generated cache hash. Optional. ${{ github.sha }}
use-annotations Use annotation to mark the results in the GitHub user interface. Optional. true
github-token GitHub token to be used for uploading results. Optional. ${{ github.token }}

Issue Tracker

All the issues, feature requests, and support related to the Qodana GitHub Action are handled on YouTrack.

If you'd like to file a new issue, please use the link YouTrack | New Issue.

License

The GitHub Action repository

This repository contains source code for Qodana GitHub Action and is licensed under Apache-2.0.

Qodana Docker images

Qodana Community images

View license information for the Qodana Community images.

Qodana Docker images may contain other software which is subject to other licenses, for example, Bash relating to the base distribution or with any direct or indirect dependencies of the primary software.

As for any pre-built image usage, it is the image user's responsibility to ensure that any use of this image complies with any relevant licenses for all software contained within.

Qodana EAP images

Using the Qodana EAP Docker images, you agree to JetBrains EAP user agreement and JetBrains privacy policy. The docker image includes an evaluation license which will expire in 30-day. Please ensure you pull a new image on time.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].