> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coderabbit.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Infer

> CodeRabbit's guide to Infer.

export const ProPlanBadge = ({tip = "This feature is available as part of the Pro, Pro+ and Enterprise plans. Please refer to our pricing page for more information about our plans and features.", title = "Pro Plan", cta = "Read more", href = "https://coderabbit.ai/pricing", disabled = false}) => {
  return <Tooltip tip={tip} cta={cta} href={href}>
        <Badge icon="shield-check" disabled={disabled || undefined}>
            {title}
        </Badge>
    </Tooltip>;
};

export const AllPlatformsBadge = ({tip = "This feature is available on all supported platforms: GitHub, GitLab, Azure DevOps, and Bitbucket.", title = "All Platforms", cta, href, disabled = false}) => {
  return <Tooltip tip={tip} cta={cta} href={href}>
        <Badge icon="globe" disabled={disabled || undefined}>
            {title}
        </Badge>
    </Tooltip>;
};

<AllPlatformsBadge /> | <ProPlanBadge />

[Infer](https://fbinfer.com/) is a static analysis tool for finding bugs in C, C++, and Java code. CodeRabbit uses Infer to report issues such as null dereferences, resource leaks, and concurrency bugs on changed files.

## Files

Infer will run on changed files with the following extensions:

* `.c`
* `.cc`
* `.cpp`
* `.cxx`
* `.h`
* `.hh`
* `.hpp`
* `.hxx`
* `.java`

Java analysis is disabled by default. Enable `reviews.tools.fbinfer.enable_java` when you want CodeRabbit to analyze changed Java files with Infer.

## Configuration

<Tabs>
  <Tab title="Using configuration file">
    ```yaml theme={null}
    reviews:
      tools:
        fbinfer:
          enabled: true
          enable_java: false
    ```
  </Tab>

  <Tab title="Using web interface">
    Enable or disable Infer from **Reviews → Tools → Infer** in CodeRabbit's settings page. Turn on **Enable Java analysis** when Java files should be included.
  </Tab>
</Tabs>

## Compilation database discovery

Infer uses a compilation database when one is available. CodeRabbit checks for `compile_commands.json`, `build/compile_commands.json`, and `compile_commands.json` files inside top-level `cmake-build*` directories.

When no compilation database is available, CodeRabbit falls back to direct compilation for changed `.c`, `.cc`, `.cpp`, and `.cxx` files. Header-only changes need a compilation database. Java files are analyzed only when Java analysis is enabled.

## When we skip Infer

CodeRabbit will skip running Infer when:

* Infer is disabled in CodeRabbit settings or `.coderabbit.yaml`.
* No changed files match the supported file types.
* Java is the only matching language and Java analysis is not enabled.
* Infer is already running in GitHub workflows.
* A header-only C/C++ change has no compilation database available.

## Links

* [Infer documentation](https://fbinfer.com/docs/getting-started)
* [Infer on GitHub](https://github.com/facebook/infer)

## What's next

<CardGroup cols={1}>
  <Card title="Tool catalog" href="/tools/list" icon="list" horizontal>
    Browse all linters, security analyzers, and CI/CD integrations by category and technology.
  </Card>

  <Card title="Tools reference" href="/tools/reference" icon="wrench" horizontal>
    Explore detailed specifications and configuration options for CodeRabbit tools.
  </Card>
</CardGroup>
