diff --git a/docs/faq/code-analysis/which-metrics-does-codacy-calculate.md b/docs/faq/code-analysis/which-metrics-does-codacy-calculate.md index 622da79b62..db0d40367e 100644 --- a/docs/faq/code-analysis/which-metrics-does-codacy-calculate.md +++ b/docs/faq/code-analysis/which-metrics-does-codacy-calculate.md @@ -51,7 +51,7 @@ Codacy calculates the number of issues in the following static code analysis cat - **Code style:** Code formatting and syntax problems, such as variable names style and enforcing the use of brackets and quotation marks - **Error prone:** Code that may hide bugs and language keywords that should be used with caution, such as the operator `==` in JavaScript or `Option.get` in Scala -- **Code complexity:** High complexity methods and classes that should be refactored +- **Code complexity:** High complexity files that should be refactored - **Performance:** Code that can have performance problems - **Compatibility:** Mainly for frontend code, compatibility problems across different browser versions - **Unused code:** Unused variables and methods, code that can't be reached @@ -88,8 +88,8 @@ Codacy displays complexity on the following places: |Place|Metric| |-----|------| -|[Commit detail page](../../repositories/commits.md)
[Pull request detail page](../../repositories/pull-requests.md)
[Email notifications](../../account/emails.md#managing-your-email-notifications)|Variation of the complexity value introduced by the commit or pull request| -|[Files page](../../repositories/files.md)|Complexity value of each file| +|[Commit detail page](../../repositories/commits.md)
[Pull request detail page](../../repositories/pull-requests.md)
[Email notifications](../../account/emails.md#managing-your-email-notifications)|The complexity variation introduced by a commit or pull request is defined as the sum of the changes in code complexity for each file modified in the commit or pull request| +|[Files page](../../repositories/files.md)|The file complexity value is the sum of the complexity values of all methods defined within the file| |[Repository Dashboard](../../repositories/repository-dashboard.md)|Percentage of complex files in your repository and how the metric is evolving over time| |[Organization overview](../../organizations/organization-overview.md)|Average percentage of complex files in the repositories in your organization and percentage of complex files in each repository| |[Repositories list page](../../organizations/managing-repositories.md)|Percentage of complex files in each repository in your organization| diff --git a/docs/repositories-configure/codacy-configuration-file.md b/docs/repositories-configure/codacy-configuration-file.md index f96dcfc186..93c209acda 100644 --- a/docs/repositories-configure/codacy-configuration-file.md +++ b/docs/repositories-configure/codacy-configuration-file.md @@ -6,7 +6,7 @@ description: Use the Codacy configuration file to configure advanced features on Codacy supports configuring certain advanced features through a configuration file, such as: -- [Ignoring files](#ignore-files) globally, for duplication, or a specific tool +- [Ignoring files](#ignore-files) globally, for duplication, for cyclomatic complexity, or a specific tool - [Including specific ignored files](#include-files) in the analysis @@ -50,6 +50,12 @@ To use a Codacy configuration file: config: languages: - "ruby" + metric: + exclude_paths: + - "src/test.ts" + config: + languages: + - "typescript" languages: css: extensions: @@ -101,6 +107,24 @@ exclude_paths: - "**/*.resource" ``` +### Syntax for configuring cyclomatic complexity + +Cyclomatic complexity can be disabled or partially ignored for certain paths, files or languages. + +!!! note +Cyclomatic complexity is referred as `metric` in the configuration file. + + ```yaml + --- + engines: + metric: + exclude_paths: + - "src/test.ts" + config: + languages: + - "typescript" + ``` + ## Including specific files using a Codacy configuration file {: id="include-files"} The Codacy configuration file allows you to explicitly specify files or directories to include in the analysis. This is particularly useful for [bypassing files or directories that are ignored by default](./ignoring-files.md#default-ignored-files) or specified in `exclude_paths`.