Skip to content

Commit 1261b55

Browse files
Improve complexity description
1 parent d58d4be commit 1261b55

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

docs/faq/code-analysis/which-metrics-does-codacy-calculate.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Codacy calculates the number of issues in the following static code analysis cat
5151
<!--issue-categories-start-->
5252
- **Code style:** Code formatting and syntax problems, such as variable names style and enforcing the use of brackets and quotation marks
5353
- **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
54-
- **Code complexity:** High complexity methods and classes that should be refactored
54+
- **Code complexity:** High complexity files that should be refactored
5555
- **Performance:** Code that can have performance problems
5656
- **Compatibility:** Mainly for frontend code, compatibility problems across different browser versions
5757
- **Unused code:** Unused variables and methods, code that can't be reached
@@ -88,8 +88,8 @@ Codacy displays complexity on the following places:
8888

8989
|Place|Metric|
9090
|-----|------|
91-
|[Commit detail page](../../repositories/commits.md)<br/>[Pull request detail page](../../repositories/pull-requests.md)<br/>[Email notifications](../../account/emails.md#managing-your-email-notifications)|Variation of the complexity value introduced by the commit or pull request|
92-
|[Files page](../../repositories/files.md)|Complexity value of each file|
91+
|[Commit detail page](../../repositories/commits.md)<br/>[Pull request detail page](../../repositories/pull-requests.md)<br/>[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|
92+
|[Files page](../../repositories/files.md)|The file complexity value is the sum of the complexity values of all methods defined within the file|
9393
|[Repository Dashboard](../../repositories/repository-dashboard.md)|Percentage of complex files in your repository and how the metric is evolving over time|
9494
|[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|
9595
|[Repositories list page](../../organizations/managing-repositories.md)|Percentage of complex files in each repository in your organization|

docs/repositories-configure/codacy-configuration-file.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ description: Use the Codacy configuration file to configure advanced features on
66

77
Codacy supports configuring certain advanced features through a configuration file, such as:
88

9-
- [Ignoring files](#ignore-files) globally, for duplication, or a specific tool
9+
- [Ignoring files](#ignore-files) globally, for duplication, for cyclomatic complexity, or a specific tool
1010

1111
- [Including specific ignored files](#include-files) in the analysis
1212

@@ -50,6 +50,12 @@ To use a Codacy configuration file:
5050
config:
5151
languages:
5252
- "ruby"
53+
metric:
54+
exclude_paths:
55+
- "src/test.ts"
56+
config:
57+
languages:
58+
- "typescript"
5359
languages:
5460
css:
5561
extensions:
@@ -101,6 +107,24 @@ exclude_paths:
101107
- "**/*.resource"
102108
```
103109

110+
### Syntax for configuring cyclomatic complexity
111+
112+
Cyclomatic complexity can be disabled or partially ignored for certain paths, files or languages.
113+
114+
!!! note
115+
Cyclomatic complexity is referred as `metric` in the configuration file.
116+
117+
```yaml
118+
---
119+
engines:
120+
metric:
121+
exclude_paths:
122+
- "src/test.ts"
123+
config:
124+
languages:
125+
- "typescript"
126+
```
127+
104128
## Including specific files using a Codacy configuration file {: id="include-files"}
105129

106130
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`.

0 commit comments

Comments
 (0)