How to integrate ReSharper Command Line Tools (InspectCode) into GitHub Actions?

Asked -8 seconds ago Updated 5 hours ago 20 views

0

Maintaining high code quality requires automated checks during pull requests. JetBrains provides ReSharper Command Line Tools (CLT), which include the standalone InspectCode utility to run static code analysis in continuous integration pipelines without requiring a Visual Studio installation.

Prerequisites for CI Integration

The ReSharper Command Line Tools can be installed via .NET global tools using the official NuGet package JetBrains.ReSharper.GlobalTools.

GitHub Actions Workflow Configuration

Below is a functional GitHub Actions workflow YAML configuration that executes InspectCode against a .NET solution:

name: ReSharper Code Analysis

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

jobs:
  inspect:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v3

      - name: Setup .NET SDK
        uses: actions/setup-dotnet@v3
        with:
          dotnet-version: '8.0.x'

      - name: Install ReSharper CLT
        run: dotnet tool install --global JetBrains.ReSharper.GlobalTools

      - name: Run InspectCode
        run: jb inspectcode MySolution.sln --output=inspect-results.xml --severity=WARNING

Handling Analysis Results

The generated XML report contains detailed issue locations, warning levels, and rule descriptions. Teams can format this XML into pull request comments or HTML reports using custom scripts or marketplace actions.

0 Answers


Write Your Answer