Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Disable language analysis for a repository DOCS-686 #2112

Merged
merged 22 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
234f690
feat: Update file extensions content to reflect languages
May 27, 2024
125ceed
Merge branch 'master' into DOCS-686-disable-language
claudiacarpinteiro May 27, 2024
126d3de
feat: Update page description
May 28, 2024
f759e61
Merge branch 'master' into DOCS-686-disable-language
claudiacarpinteiro May 28, 2024
acfb525
feat: Update feature name on roles and permissions
May 28, 2024
70aa84a
feat: Rename feature MD file
May 28, 2024
b5c0a1a
feat: Update screenshots
May 28, 2024
6bc4556
Merge branch 'master' into DOCS-686-disable-language
claudiacarpinteiro May 29, 2024
4b65793
clean: Tweaks for clarity and fix typo
May 29, 2024
ca95eca
Merge branch 'DOCS-686-disable-language' of github.com:codacy/docs in…
May 29, 2024
d253248
clean: Reuse content
May 29, 2024
50f7ad1
feat: Fix "end" bug
nicklem May 29, 2024
de7f10f
Merge branch 'master' into DOCS-686-disable-language
claudiacarpinteiro May 29, 2024
513dfd8
clean: Formatting tweaks
May 29, 2024
887de37
feat: Add languages configuration through the configuration file
May 29, 2024
66cc04c
clean: Tweak for clarity
claudiacarpinteiro Jun 4, 2024
a39255c
clean: Tweak for clarity
claudiacarpinteiro Jun 4, 2024
4f1bf59
Merge branch 'master' into DOCS-686-disable-language
claudiacarpinteiro Jun 4, 2024
b51a99d
Merge branch 'master' into DOCS-686-disable-language
claudiacarpinteiro Jun 5, 2024
9912d76
clean: Tweak for clarity
claudiacarpinteiro Jun 6, 2024
b9a9f98
Merge branch 'master' into DOCS-686-disable-language
claudiacarpinteiro Jun 6, 2024
3002df2
Merge branch 'master' into DOCS-686-disable-language
pedrocodacy Jun 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/assets/includes/update-file-extensions-reanalyze.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<!--updated-settings-start-->
The updated settings will be used on the next analysis, but you can click **reanalyze the latest commit of your branches now** on the notification that appears at the bottom of the page to trigger an analysis immediately.

![Analyze now](../images/file-extensions-analyze.png)
<!--updated-settings-end-->
2 changes: 1 addition & 1 deletion docs/getting-started/supported-languages-and-tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ The table below lists all languages that Codacy supports and the corresponding t
</tbody>
</table>

<sup><span id="semgrep">1</span></sup>: Semgrep supports additional security rules when signing up for [Semgrep Pro](https://semgrep.dev/pricing/). This tool doesn't support [custom file extensions](../repositories-configure/file-extensions.md).
<sup><span id="semgrep">1</span></sup>: Semgrep supports additional security rules when signing up for [Semgrep Pro](https://semgrep.dev/pricing/). This tool doesn't support [custom file extensions](../repositories-configure/languages.md#configuring-file-extensions).
<sup><span id="yaml-only">2</span></sup>: Currently, Trivy only supports scanning YAML files on this platform.
<sup><span id="client-side">3</span></sup>: Supported as a [client-side tool](../repositories-configure/local-analysis/client-side-tools.md).
<sup><span id="cppcheck-misra">4</span></sup>: Currently, Cppcheck only supports [checking the MISRA guidelines for C](https://cppcheck.sourceforge.io/misra.php).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ To change this, open your organization **Settings**, page **Roles and permission
- [Ignore issues](../repositories/issues.md#ignoring-and-managing-issues)
- [Ignore files](../repositories-configure/ignoring-files.md)
- [Configure code patterns](../repositories-configure/configuring-code-patterns.md)
- [Configure file extensions](../repositories-configure/file-extensions.md)
- [Configure languages](../repositories-configure/languages.md)
- [Manage branches](../repositories-configure/managing-branches.md)
- [Reanalyze branches and pull requests](../faq/repositories/how-do-i-reanalyze-my-repository.md)

Expand Down Expand Up @@ -128,7 +128,7 @@ The table below maps the GitHub Cloud and GitHub Enterprise roles to the corresp
<td class="yes">Yes</td>
</tr>
<tr>
<td>Ignore issues and files,<br/>configure code patterns and file extensions,<br/>manage branches,<br/>reanalyze branches and pull requests</td>
<td>Ignore issues and files,<br/>configure code patterns and languages,<br/>manage branches,<br/>reanalyze branches and pull requests</td>
<td class="no">No</td>
<td colspan="2" class="maybe"><a href="#change-analysis-configuration">Configurable</a></td>
<td colspan="2" class="maybe"><a href="#change-analysis-configuration">Configurable</a></td>
Expand Down Expand Up @@ -282,7 +282,7 @@ The table below maps the GitLab Cloud and GitLab Enterprise roles to the corresp
<td colspan="2" class="yes">Yes</td>
</tr>
<tr>
<td>Ignore issues and files,<br/>configure code patterns and file extensions,<br/>manage branches,<br/>reanalyze branches and pull requests</td>
<td>Ignore issues and files,<br/>configure code patterns and languages,<br/>manage branches,<br/>reanalyze branches and pull requests</td>
<td class="no">No</td>
<td colspan="2" class="maybe"><a href="#change-analysis-configuration">Configurable</a></td>
<td class="maybe"><a href="#change-analysis-configuration">Configurable</a></td>
Expand Down Expand Up @@ -418,7 +418,7 @@ The table below maps the Bitbucket Cloud and Bitbucket Server roles to the corre
<td class="yes">Yes</td>
</tr>
<tr>
<td>Ignore issues and files,<br/>configure code patterns and file extensions,<br/>manage branches,<br/>reanalyze branches and pull requests</td>
<td>Ignore issues and files,<br/>configure code patterns and languages,<br/>manage branches,<br/>reanalyze branches and pull requests</td>
<td colspan="2" class="maybe"><a href="#change-analysis-configuration">Configurable</a></td>
<td class="maybe">Inherits original permission</td>
<td class="yes">Yes</td>
Expand Down
39 changes: 38 additions & 1 deletion docs/repositories-configure/codacy-configuration-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ Codacy supports configuring certain advanced features through a configuration fi

- Configuring a specific repository directory on which to start the analysis

- Adding custom file extensions to languages, keeping in mind that some tools might not work out of the box with those extensions
- [Configuring the languages](#languages) that Codacy analyzes in your repository:

- [Adding custom file extensions](#file-extensions) to languages
- [Disabling the analysis](#disable-language) of a specific language

## Using a Codacy configuration file

Expand Down Expand Up @@ -249,3 +252,37 @@ engines:
ignoreAnnotations: false
ignoreUsings: false
```

## Configuring languages using a Codacy configuration file {: id="languages"}

You can use a Codacy configuration file to manage the languages that Codacy analyzes in your repository.

!!! note
Codacy applies both language settings defined in the Codacy configuration file and any other language setting defined [on the Codacy UI](languages.md).

### Adding custom file extensions {: id="file-extensions"}

To [add custom file extensions to languages](languages.md#configuring-file-extensions) using a Codacy configuration file, you must define one or more extensions under `languages.<LANGUAGE>.extensions`. Keep in mind that some tools might not work out of the box with those extensions.

For example:

```yaml
---
languages:
css:
extensions:
- ".scss"
```

### Disabling analysis of a language {: id="disable-language"}

To [disable the analysis of a specific language](languages.md#disable-language) using a Codacy configuration file, set `languages.<LANGUAGE>.enabled` to `false`. The analysis is enabled by default for all languages.

For example:

```yaml
---
languages:
css:
enabled: false
```
24 changes: 0 additions & 24 deletions docs/repositories-configure/file-extensions.md

This file was deleted.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/repositories-configure/images/file-extensions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions docs/repositories-configure/languages.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
description: Configure the languages that Codacy analyzes in your repository. You can configure Codacy to include unrecognized file extensions, or disable the analysis of specific languages.
---

# Configuring languages

{% include-markdown "../assets/includes/admin-access-control-info.md" %}

Codacy automatically detects and analyzes languages in your repository based on a list of supported file extensions. On the repository **Settings**, tab **Languages**, you can see the list of languages that Codacy detected and will include in the next analysis.

By default, the analysis is enabled for all languages that Codacy detects in you repository. You can adapt this configuration to your needs as follows:

- [Configure Codacy to include unrecognized extensions](#configuring-file-extensions)
- [Disable the analysis of specific languages](#disable-language)

!!! note
Codacy applies the language settings defined in the Codacy UI as well as any settings defined using a [Codacy configuration file](codacy-configuration-file.md#languages).

## Configuring file extensions

If your repository contains source files with extensions not supported by Codacy, associate these extensions with their respective languages to ensure Codacy analyzes them in the next analysis:

1. Go to your repository's **Settings**, **Languages**.

1. Add the extensions you want to be recognized for each language.

1. Click **Save changes** to update your file extension settings.

![Configuring file extensions](images/file-extensions.png)

{% include-markdown "../assets/includes/update-file-extensions-reanalyze.md" %}

!!! note
Currently, the [Semgrep](https://github.com/codacy/codacy-semgrep) static analysis tool doesn't support custom file extensions.

## Disabling analysis of a language {: id="disable-language"}

By default, Codacy analyzes all languages detected in your repository. To disable the analysis of a specific language, do the following:

1. Go to your repository's **Settings**, **Languages**.

1. Use the toggle next to the language to disable its analysis.

1. Click **Save changes** to update your settings.

![Disabling language](images/disable-language.png)

{% include-markdown "../assets/includes/update-file-extensions-reanalyze.md" %}
2 changes: 1 addition & 1 deletion docs/repositories-coverage/files.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ The Files page only displays files in your repository that were analyzed by Coda

- **The file has an extension that is not on the list of supported extensions**

Codacy has a [list of file extensions](../repositories-configure/file-extensions.md) associated with each language. Codacy doesn't analyze or display files with extensions that aren't associated with a language.
Codacy supports a [list of file extensions](../repositories-configure/languages.md#configuring-file-extensions) associated with each language. Codacy doesn't analyze or display files with extensions that aren't associated with a language.

- **The file might be too big**

Expand Down
2 changes: 1 addition & 1 deletion docs/repositories/files.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ The Files page only displays files in your repository that were analyzed by Coda

- **The file has an extension that is not on the list of supported extensions**

Codacy has a [list of file extensions](../repositories-configure/file-extensions.md) associated with each language. Codacy doesn't analyze or display files with extensions that aren't associated with a language.
Codacy supports a [list of file extensions](../repositories-configure/languages.md#configuring-file-extensions) associated with each language. Codacy doesn't analyze or display files with extensions that aren't associated with a language.

- **The file might be too big**

Expand Down
9 changes: 5 additions & 4 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ plugins:
"hc/en-us/articles/207994025-Commits-View.md": "repositories/commits.md"
"hc/en-us/articles/207994335.md": "repositories-configure/configuring-code-patterns.md"
"hc/en-us/articles/207994335-Code-Patterns.md": "repositories-configure/configuring-code-patterns.md"
"hc/en-us/articles/207994395.md": "repositories-configure/file-extensions.md"
"hc/en-us/articles/207994395-File-Extensions.md": "repositories-configure/file-extensions.md"
"hc/en-us/articles/207994395-Language-Extensions.md": "repositories-configure/file-extensions.md"
"hc/en-us/articles/207994395.md": "repositories-configure/languages.md"
"hc/en-us/articles/207994395-File-Extensions.md": "repositories-configure/languages.md"
"hc/en-us/articles/207994395-Language-Extensions.md": "repositories-configure/languages.md"
"hc/en-us/articles/207994675.md": "codacy-api/api-tokens.md"
"hc/en-us/articles/207994675-Project-API.md": "codacy-api/api-tokens.md"
"hc/en-us/articles/207994725.md": "getting-started/supported-languages-and-tools.md#docker-images-of-supported-tools"
Expand Down Expand Up @@ -547,6 +547,7 @@ plugins:
"codacy-api/examples/creating-project-api-tokens-programmatically.md": "codacy-api/examples/creating-repository-api-tokens-programmatically.md"
"repositories/security-monitor.md": "organizations/managing-security-and-risk.md"
"organizations/copying-code-patterns-between-repositories.md": "organizations/using-coding-standards.md"
"repositories-configure/file-extensions.md": "repositories-configure/languages.md"

nav:
- Documentation home: "index.md"
Expand Down Expand Up @@ -580,7 +581,7 @@ nav:
- repositories-configure/integrations/bitbucket-integration.md
- repositories-configure/integrations/post-commit-hooks.md
- repositories-configure/ignoring-files.md
- repositories-configure/file-extensions.md
- repositories-configure/languages.md
- repositories-configure/adjusting-quality-gates.md
- repositories-configure/adjusting-quality-goals.md
- Setting up code coverage:
Expand Down
Loading