All Projects → codacy → codacy-analysis-cli-action

codacy / codacy-analysis-cli-action

Licence: Apache-2.0 license
GitHub Action for the codacy-analysis-cli

Projects that are alternatives of or similar to codacy-analysis-cli-action

sonarqube-action
Integrate SonarQube scanner to GitHub Actions
Stars: ✭ 90 (+114.29%)
Mutual labels:  static-analysis, github-actions
Setup Php
GitHub action to set up PHP with extensions, php.ini configuration, coverage drivers, and various tools.
Stars: ✭ 1,945 (+4530.95%)
Mutual labels:  static-analysis, github-actions
qodana-action
⚙️ Scan your Java, Kotlin, PHP, Python, JavaScript, TypeScript projects at GitHub with Qodana
Stars: ✭ 112 (+166.67%)
Mutual labels:  static-analysis, github-actions
shell-linter
A Github Action for ShellCheck
Stars: ✭ 58 (+38.1%)
Mutual labels:  static-analysis, github-actions
bridgecrew-action
This Github Action runs Bridgecrew against an Infrastructure-as-Code repository. Bridgecrew performs static security analysis of Terraform & CloudFormation Infrastructure code.
Stars: ✭ 52 (+23.81%)
Mutual labels:  static-analysis, github-actions
mylib
Шаблон кросплатформенного CMake-проекта для языка C++ 🇬🇧 Modern CMake crossplatform project template for C++
Stars: ✭ 49 (+16.67%)
Mutual labels:  static-analysis, github-actions
vscode-tenkawa-php
Visual Studio Code extension integrating Tenkawa PHP language server.
Stars: ✭ 28 (-33.33%)
Mutual labels:  static-analysis
link-snitch
GitHub Action to scan your site for broken links so you can fix them 🔗
Stars: ✭ 50 (+19.05%)
Mutual labels:  github-actions
prettier
🔨 Native, blazingly-fast Prettier CLI on Github Actions
Stars: ✭ 19 (-54.76%)
Mutual labels:  github-actions
eba
EBA is a static bug finder for C.
Stars: ✭ 14 (-66.67%)
Mutual labels:  static-analysis
release-downloader
Github action to download release assets from private or public repositories
Stars: ✭ 33 (-21.43%)
Mutual labels:  github-actions
components-nightly
⚙️ GitHub Action for searching nightly component availability
Stars: ✭ 21 (-50%)
Mutual labels:  github-actions
django-template
The ultimate Django template: production ready Django 3.2 with Docker, HTTPS and CI/CD using Github actions ‎️‍🔥
Stars: ✭ 20 (-52.38%)
Mutual labels:  github-actions
Static-Malware-Analyses
A open source Python script to perform static analysis on a Malware Binary File (portable executable).
Stars: ✭ 15 (-64.29%)
Mutual labels:  static-analysis
private-actions-checkout
GitHub Action to make custom private actions easily available to any workflow
Stars: ✭ 62 (+47.62%)
Mutual labels:  github-actions
pytest-github-actions-annotate-failures
Pytest plugin to annotate failed tests with a workflow command for GitHub Actions
Stars: ✭ 58 (+38.1%)
Mutual labels:  github-actions
hugo-action
Commands to help with building Hugo based static sites
Stars: ✭ 65 (+54.76%)
Mutual labels:  github-actions
cfsec
Static analysis for CloudFormation templates to identify common misconfiguration
Stars: ✭ 53 (+26.19%)
Mutual labels:  static-analysis
analysis-model
A library to read static analysis reports into a Java object model
Stars: ✭ 74 (+76.19%)
Mutual labels:  static-analysis
pull-request-artifacts
GitHub Action to post build artifacts in PR comments.
Stars: ✭ 23 (-45.24%)
Mutual labels:  github-actions

Codacy Analysis CLI GitHub Action

Codacy Badge

GitHub Action for running Codacy static analysis on over 30 supported languages and returning identified issues in the code.


Codacy


Codacy is an automated code review tool that makes it easy to ensure your team is writing high-quality code by analyzing more than 30 programming languages such as PHP, JavaScript, Python, Java, and Ruby. Codacy allows you to define your own quality rules, code patterns and quality settings you'd like to enforce to prevent issues on your codebase.

The Codacy GitHub Action supports the following scenarios:

  • Analysis with default settings: Analyzes each commit and pull request and fails the workflow if it finds issues in your code.
  • Integration with GitHub code scanning: Analyzes each commit and pull request and uploads the results to GitHub, which displays the identified issues under your repository's tab Security.
  • Integration with Codacy for client-side tools: Analyzes each commit and pull request using one of Codacy's client-side tools and uploads the results to Codacy, which displays the identified issues in UI dashboards and can also report the status of the analysis on your pull requests.

Analysis with default settings

By default, the Codacy GitHub Action:

  • Analyzes each commit or pull request by running all supported static code analysis tools for the languages found in your repository.
  • Prints the analysis results on the console, which is visible on the GitHub Action's workflow panel.
  • Fails the workflow if it finds at least one issue in your code.

Failed Codacy analysis workflow

To use the GitHub Action with default settings, add the following to a file .github/workflows/codacy-analysis.yaml in your repository:

name: Codacy Analysis CLI

on: ["push"]

jobs:
  codacy-analysis-cli:
    name: Codacy Analysis CLI
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@main

      - name: Run Codacy Analysis CLI
        uses: codacy/codacy-analysis-cli-action@master

Integration with GitHub code scanning

Integrate the Codacy GitHub Action with GitHub code scanning to display the analysis results on your repository under the tab Security, page Code scanning alerts.

In this scenario, the GitHub Action:

  • Analyzes each commit and pull request to the master or main branch by running all supported static code analysis tools for the languages found in your repository.
  • Outputs the analysis results to a file results.sarif, which is then uploaded to GitHub.

GitHub code scanning integration

To use the GitHub Action with GitHub code scanning integration, add the following to a file .github/workflows/codacy-analysis.yaml in your repository:

name: Codacy Security Scan

on:
  push:
    branches: [ "master", "main" ]
  pull_request:
    branches: [ "master", "main" ]

jobs:
  codacy-security-scan:
    name: Codacy Security Scan
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@main

      - name: Run Codacy Analysis CLI
        uses: codacy/codacy-analysis-cli-action@master
        with:
          output: results.sarif
          format: sarif
          # Adjust severity of non-security issues
          gh-code-scanning-compat: true
          # Force 0 exit code to allow SARIF file generation
          # This will handover control about PR rejection to the GitHub side
          max-allowed-issues: 2147483647
      
      # Upload the SARIF file generated in the previous step
      - name: Upload SARIF results file
        uses: github/codeql-action/upload-sarif@main
        with:
          sarif_file: results.sarif

Integration with Codacy for client-side tools

Use the GitHub Action to run any of the containerized Codacy client-side tools and upload the results of the analysis to Codacy.

In this scenario, the GitHub action:

  • Analyzes each commit or pull request by running a specific client-side tool with the configurations that you defined on Codacy.
  • Uploads the analysis results to Codacy.

After this, Codacy displays the results of the analysis of your commits and pull requests on the UI dashboards, and optionally reports the status of the analysis directly on your GitHub pull requests.

Codacy integration

To use the GitHub Action with Codacy integration:

  1. On Codacy, enable Run analysis through build server in your repository Settings, tab General, Repository analysis.

    This setting enables Codacy to wait for the results of the local analysis before resuming the analysis of your commits.

  2. Set up an API token to allow the GitHub Action to authenticate on Codacy:

    ⚠️ Never write API tokens on your configuration files and keep your API tokens well protected, as they grant owner permissions to your projects on Codacy.

  3. Add the following to a file .github/workflows/codacy-analysis.yaml in your repository, where <CLIENT_SIDE_TOOL_NAME> is the name of the containerized client-side tool that the Codacy Analysis CLI will run locally, or don't specify this parameter to run all tools supported by Codacy:

    name: Codacy Analysis CLI
    
    on: ["push"]
    
    jobs:
      codacy-analysis-cli:
        name: Codacy Analysis CLI
        runs-on: ubuntu-latest
        steps:
          - name: Checkout code
            uses: actions/checkout@main
    
          - name: Run Codacy Analysis CLI
            uses: codacy/codacy-analysis-cli-action@master
            with:
              tool: <CLIENT_SIDE_TOOL_NAME>
              project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
              # or
              # api-token: ${{ secrets.CODACY_API_TOKEN }}
              upload: true
              max-allowed-issues: 2147483647
  4. Optionally, specify the following parameters to run standalone client-side tools:

    run-gosec: "true"
    run-staticcheck: "true"

    Due to the complex orchestration of the tools Clang-Tidy and Faux Pas, in this case the action can receive instead the output files of the tools and uploads them to Codacy:

    clang-tidy-output: "path/to/output"
    faux-pas-output: "path/to/output"

    If you only want to run the standalone client-side tools and not all the containerized tools supported by Codacy, specify:

    run-docker-tools: "false"
  5. Optionally, enable the GitHub integration on Codacy to have information about the analysis of the changed files directly on your pull requests.

Extra configurations

The Codacy GitHub Action is a wrapper for running the Codacy Analysis CLI and supports the same parameters as the command analyze, with the following exceptions:

  • --commit-uuid (the action always analyzes the commit that triggered it)
  • --username and --project (the action automatically uses the owner and name of the repository when you specify the parameter api-token)

Contributing

We love contributions, feedback, and bug reports. If you run into issues while running this action, open an issue in this repository.

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].