diff --git a/.github/styles/Microsoft/Auto.yml b/.github/styles/Microsoft/Auto.yml index 4da4393530..66ac0d7369 100644 --- a/.github/styles/Microsoft/Auto.yml +++ b/.github/styles/Microsoft/Auto.yml @@ -9,3 +9,13 @@ action: - simple tokens: - 'auto-\w+' +# "Auto-configure"/"Auto-configuration" is Codacy's own hyphenated feature and +# button name, verified against the shipped product UI — not a style choice +# this rule should flag. +exceptions: + - Auto-configure + - Auto-configuring + - Auto-configuration + - auto-configure + - auto-configuring + - auto-configuration diff --git a/docs/codacy-ai/codacy-ai.md b/docs/codacy-ai/codacy-ai.md index d008ab4dcc..306b0d0876 100644 --- a/docs/codacy-ai/codacy-ai.md +++ b/docs/codacy-ai/codacy-ai.md @@ -126,3 +126,15 @@ Rules for the output: - To enrich the review, the git diff of the Pull Request as well as some related files' contents can be sent as context. No data is stored on our side, or used to train any models. - Prompts are neither stored nor visible to anyone. - As an extra precaution, before any code snippet is sent to the AI model, Codacy automatically redacts secrets (API keys, tokens, credentials, and other high-entropy strings) from the code context. + +### Auto-configure repository {: id="auto-configure-repository"} + +_This feature uses an AI coding agent, and is strictly opt-in: it only runs when someone with permission to configure code patterns starts it for a specific repository._ + +Auto-configure reviews the repository, then applies the same kind of tool and code pattern settings you could otherwise set by hand or through a [Codacy configuration file](../repositories-configure/codacy-configuration-file.md). It also recommends paths to exclude from analysis, which you review and apply yourself. + +More details about [Auto-configure repository here](../repositories-configure/configuring-code-patterns.md#auto-configuring-your-repository). + +**Notes** + +- Codacy does not use your code, repository contents, or comments to train external AI models. No customer code is incorporated into model training. diff --git a/docs/repositories-configure/configuring-code-patterns.md b/docs/repositories-configure/configuring-code-patterns.md index 92359a7295..300cc92d4b 100644 --- a/docs/repositories-configure/configuring-code-patterns.md +++ b/docs/repositories-configure/configuring-code-patterns.md @@ -9,6 +9,7 @@ description: Configure the static analysis tools and code patterns that Codacy u By default, Codacy analyzes your repositories using a subset of the supported analysis tools and code patterns. These defaults are based on current best practices and community feedback, and you can adapt them to your needs as follows: - [Configuring tools and code patterns using the Codacy UI](#configuring-tools-and-code-patterns-using-the-codacy-ui) +- [Auto-configuring your repository](#auto-configuring-your-repository) - [Discover code patterns across all tools](#discover-code-patterns-across-all-tools) - [Customizing applied coding standards](#using-your-own-tool-configuration-files) - [Customizing patterns when following coding standards](#customizing-patterns-following-standards) @@ -39,6 +40,53 @@ To configure the tools and code patterns for a repository using the Codacy UI: 1. Optionally, to take the changes into account immediately, [reanalyze the repository manually](../faq/repositories/how-do-i-reanalyze-my-repository.md). Otherwise, Codacy will use the updated configuration when analyzing new commits and pull requests. +## Auto-configuring your repository {: id="auto-configuring-your-repository"} + +Instead of configuring tools and code patterns by hand, you can have an AI agent review your repository and apply the settings for you. The agent applies the same kind of tool and code pattern settings described above — the same settings you could otherwise set through the Codacy UI or a [Codacy configuration file](codacy-configuration-file.md). It also recommends [paths to exclude](ignoring-files.md) from analysis, which you review and apply yourself. Auto-configure does not change patterns that come from a [coding standard](../organizations/using-coding-standards.md). + +There are two ways to run it. + +### Running it from Codacy {: id="running-it-from-codacy"} + +{% + include-markdown "../assets/includes/paid.md" + start="" + end="" +%} + +1. On your repository's **Code patterns** page, select **Auto-configure**. + + ![The Code patterns page, with the repository's issue count and the Auto-configure button](images/auto-configure-code-patterns.png) + + ![The Auto-configure button on the Code patterns page](images/auto-configure-button.png) + +1. In the dialog, on the **Run here** tab, select **Run auto-configure**. +1. Follow the run's status (queued, running, successful, or failed) on this page. +1. Once the run finishes, the same button reads **Review auto-configuration** — select it to see a summary of what changed, including any recommended paths to exclude. + +**Notes** + +- You can start at most one run per repository per day. +- A run takes several minutes. You can leave this page — the results appear here when the run finishes. +- Your repository's metrics and issue counts may fluctuate while a run is in progress. +- Codacy limits how many runs happen at the same time, both for the organization and across Codacy, so runs stay fast for everyone. If you start a run while one is already queued or running for the same repository, Codacy queues it instead of starting it immediately. +- Each run has a fixed amount of time and AI usage it can use, so a run always finishes or fails instead of continuing indefinitely. +- You can start a new run at any time; it replaces the configuration from the previous run. +- The agent only has access to the repository's code during that one run. It's immediately discarded when the run ends. + +### Running it with Codacy Skills {: id="running-it-with-codacy-skills"} + +If you'd rather run auto-configuration locally with your own AI agent, use the `configure-codacy` [skill](../codacy-cloud-cli/index.md#install-the-codacy-skills) instead. This option is open-source and isn't limited to paid plans. + +1. [Install the Codacy Skills](../codacy-cloud-cli/index.md#install-the-codacy-skills). +1. Open a terminal in your repository's root directory and run the skill: + + ```bash + claude /configure-codacy + ``` + + The configuration process may take a while. + ## Discover code patterns across all tools {: id="discover-code-patterns-across-all-tools"} To discover code patterns across all tools, click **Discover patterns** at the top of the **Tools** list. diff --git a/docs/repositories-configure/images/auto-configure-button.png b/docs/repositories-configure/images/auto-configure-button.png new file mode 100644 index 0000000000..df7463e38f Binary files /dev/null and b/docs/repositories-configure/images/auto-configure-button.png differ diff --git a/docs/repositories-configure/images/auto-configure-code-patterns.png b/docs/repositories-configure/images/auto-configure-code-patterns.png new file mode 100644 index 0000000000..80d9d7d8c9 Binary files /dev/null and b/docs/repositories-configure/images/auto-configure-code-patterns.png differ