diff --git a/docs/repositories-configure/images/file-extensions-analyze.png b/docs/assets/images/file-extensions-analyze.png similarity index 100% rename from docs/repositories-configure/images/file-extensions-analyze.png rename to docs/assets/images/file-extensions-analyze.png diff --git a/docs/assets/includes/update-file-extensions-reanalyze.md b/docs/assets/includes/update-file-extensions-reanalyze.md new file mode 100644 index 0000000000..9f9676ea9f --- /dev/null +++ b/docs/assets/includes/update-file-extensions-reanalyze.md @@ -0,0 +1,5 @@ + +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) + diff --git a/docs/getting-started/supported-languages-and-tools.md b/docs/getting-started/supported-languages-and-tools.md index 3de0db4b05..76042b006f 100644 --- a/docs/getting-started/supported-languages-and-tools.md +++ b/docs/getting-started/supported-languages-and-tools.md @@ -555,8 +555,8 @@ The table below lists all languages that Codacy supports and the corresponding t -1: 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). -2: Currently, only YAML file scanning is supported on this platform. +1: 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). +2: Currently, only YAML file scanning is supported on this platform. 3: Supported as a [client-side tool](../repositories-configure/local-analysis/client-side-tools.md). 4: Currently, Cppcheck only supports [checking the MISRA guidelines for C](https://cppcheck.sourceforge.io/misra.php). 5: Currently, Codacy only supports including the packages [lints](https://pub.dev/packages/lints) and [flutter_lints](https://pub.dev/packages/flutter_lints) on dartanalyzer configuration files. diff --git a/docs/organizations/roles-and-permissions-for-organizations.md b/docs/organizations/roles-and-permissions-for-organizations.md index 2034054ccb..5049c8ecb2 100644 --- a/docs/organizations/roles-and-permissions-for-organizations.md +++ b/docs/organizations/roles-and-permissions-for-organizations.md @@ -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) @@ -128,7 +128,7 @@ The table below maps the GitHub Cloud and GitHub Enterprise roles to the corresp Yes - Ignore issues and files,
configure code patterns and file extensions,
manage branches,
reanalyze branches and pull requests + Ignore issues and files,
configure code patterns and languages,
manage branches,
reanalyze branches and pull requests No Configurable Configurable @@ -282,7 +282,7 @@ The table below maps the GitLab Cloud and GitLab Enterprise roles to the corresp Yes - Ignore issues and files,
configure code patterns and file extensions,
manage branches,
reanalyze branches and pull requests + Ignore issues and files,
configure code patterns and languages,
manage branches,
reanalyze branches and pull requests No Configurable Configurable @@ -418,7 +418,7 @@ The table below maps the Bitbucket Cloud and Bitbucket Server roles to the corre Yes - Ignore issues and files,
configure code patterns and file extensions,
manage branches,
reanalyze branches and pull requests + Ignore issues and files,
configure code patterns and languages,
manage branches,
reanalyze branches and pull requests Configurable Inherits original permission Yes diff --git a/docs/repositories-configure/codacy-configuration-file.md b/docs/repositories-configure/codacy-configuration-file.md index 0fe81ede3a..af3b1de884 100644 --- a/docs/repositories-configure/codacy-configuration-file.md +++ b/docs/repositories-configure/codacy-configuration-file.md @@ -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 @@ -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 the language settings from the Codacy configuration file as well as any settings defined [in 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..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..enabled` to `false`. The analysis is enabled by default for all languages. + +For example: + +```yaml +--- +languages: + css: + enabled: false +``` diff --git a/docs/repositories-configure/file-extensions.md b/docs/repositories-configure/file-extensions.md deleted file mode 100644 index 28d703a5de..0000000000 --- a/docs/repositories-configure/file-extensions.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -description: If your repository has source files with unrecognized extensions, you can configure Codacy to include them in the next analysis. ---- - -# Configuring file extensions - -{% include-markdown "../assets/includes/admin-access-control-info.md" %} - -If your repository has source files with unrecognized extensions, you can configure Codacy to include them in the next analysis: - -1. Go to your repository's **Settings**, **File Extensions**. - - ![Configuring file extensions](images/file-extensions.png) - -1. Add the extensions you want to be recognized for each language. - -1. Click **Save** to update your file extension settings. - - 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) - -!!! note - Currently, the [Semgrep](https://github.com/codacy/codacy-semgrep) static analysis tool doesn't support custom file extensions. diff --git a/docs/repositories-configure/images/disable-language.png b/docs/repositories-configure/images/disable-language.png new file mode 100644 index 0000000000..8b9a2a5540 Binary files /dev/null and b/docs/repositories-configure/images/disable-language.png differ diff --git a/docs/repositories-configure/images/file-extensions.png b/docs/repositories-configure/images/file-extensions.png index 38eed6f6d1..3203e65a10 100644 Binary files a/docs/repositories-configure/images/file-extensions.png and b/docs/repositories-configure/images/file-extensions.png differ diff --git a/docs/repositories-configure/languages.md b/docs/repositories-configure/languages.md new file mode 100644 index 0000000000..e26aba23ca --- /dev/null +++ b/docs/repositories-configure/languages.md @@ -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" %} diff --git a/docs/repositories-coverage/files.md b/docs/repositories-coverage/files.md index c076a18717..7f9c7b7115 100644 --- a/docs/repositories-coverage/files.md +++ b/docs/repositories-coverage/files.md @@ -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** diff --git a/docs/repositories/files.md b/docs/repositories/files.md index 38c4947c78..3e78be49f1 100644 --- a/docs/repositories/files.md +++ b/docs/repositories/files.md @@ -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** diff --git a/mkdocs.yml b/mkdocs.yml index b046730233..c7846bffa6 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -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" @@ -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" @@ -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: