Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,6 @@ object RuleSetPagePrinter : DocumentationPrinter<RuleSetPage> {
}
}

if (rule.severity.isNotEmpty()) {
paragraph {
"${bold { "Severity" }}: ${rule.severity}"
}
}

if (rule.debt.isNotEmpty()) {
paragraph {
"${bold { "Debt" }}: ${rule.debt}"
Expand Down
2 changes: 0 additions & 2 deletions detekt-generator/src/test/resources/RuleSet.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ style rule set

a wildcard import

**Severity**: Defect

**Debt**: 10min

**Aliases**: alias1, alias2
Expand Down
5 changes: 1 addition & 4 deletions docs/_data/sidebars/home_sidebar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ entries:
- title: Pre 1.0 Release Notes
url: /changelog-rc.html
output: web
- title: detekt Configuration File
- title: Configuration File
url: /configurations.html
output: web
- title: Suppressing Issues in Code
Expand All @@ -26,9 +26,6 @@ entries:
- title: Suppressing Issues via Baseline File
url: /baseline.html
output: web
- title: Configure Build Failure Thresholds
url: /failonbuild.html
output: web
- title: Extending detekt
url: /extensions.html
output: web
Expand Down
55 changes: 40 additions & 15 deletions docs/pages/configurations.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@ _detekt_ uses a yaml style configuration file for various things:

- rule set and rule properties
- build failure
- Kotlin file processors
- console and output formats
- console reports
- output reports
- processors

See the [default-detekt-config.yml](https://github.com/detekt/detekt/blob/master/detekt-core/src/main/resources/default-detekt-config.yml) file for all defined configuration options and their default values.
See the [default-detekt-config.yml](https://github.com/detekt/detekt/blob/master/detekt-core/src/main/resources/default-detekt-config.yml)
file for all defined configuration options and their default values.

_Note:_ When using a custom config file, the default values are ignored unless you also set the `--build-upon-default-config` flag.

#### Rule sets and rules
## Rule sets and rules

_detekt_ allows easily to just pick the rules you want and configure them the way you like.
For example if you want to allow up to 20 functions inside a Kotlin file instead of the default threshold of 10, write:
Expand All @@ -30,9 +32,11 @@ complexity:

To read about all supported rule sets and rules, use the side navigation `Rule Sets`.

#### Path Filters / Excludes / Includes
### Path Filters / Excludes / Includes

Starting with version **RC15** fine grained path filters can be defined for each rule or rule set:
Fine grained path filters can be defined for each rule or rule set through globing patterns.
This gives the user more freedom in analyzing only specific files
and rule authors the ability to write *library only* rules.

```yaml
complexity:
Expand All @@ -42,13 +46,31 @@ complexity:
includes: ['**/internal/util/NeedsToBeChecked.kt']
```

This gives the user more freedom in analyzing only specific files
and rule authors the ability to write *library only* rules.
This is the replacement for the `test-pattern` feature.
## Build failure

_Detekt_ supports the option to fail your build if a threshold of code smell issues is met.

For this the following code must be inside the detekt config:

```yaml
build:
maxIssues: 10 # break the build if ten weighted issues are found
weights:
complexity: 2 # every rule of the complexity rule set should count as if two issues were found...
LongParameterList: 1 # ...with the exception of the LongParameterList rule.
comments: 0 # comment rules are just a nice to know?!
```

Every rule and rule set can be attached with an integer value which is the weight of the finding.
For example: If you have 5 findings of the category _complexity_, then your failThreshold of 10 is reached as
5 x 2 = 10.

Be aware that detekt now expects globing patterns instead of regular expressions!
Weights are respected in the following priority order:
- The specified weight for a rule
- The specified weight for a rule set
- By default, the weight is 1.

#### Console Reports
## Console Reports

Uncomment the reports you don't care about.

Expand Down Expand Up @@ -76,7 +98,7 @@ It's simply a way of alerting users to information that they have opted-in to.
**FileBasedFindingsReport** is similar to the FindingsReport shown above.
The rule violations are grouped by file location.

#### Output Reports
## Output Reports

Uncomment the reports you don't care about.

Expand All @@ -102,7 +124,7 @@ Rule violations show the name of the violated rule and in which file the issue h
The mentioned metrics show detailed statistics concerning the analyzed code.
For instance the source lines of code and the McCabe complexity are calculated.

#### Processors
## Processors

Count processors are used to calculate project metrics.
For example, when all count processors are enabled, a detekt html report might look like this:
Expand All @@ -125,11 +147,14 @@ processors:
# - 'KtFileCountProcessor'
```

#### Config JSON Schema
## Config JSON Schema

A JSON Schema for the config file is available on: [json.schemastore.org/detekt](https://json.schemastore.org/detekt).

You can configured your IDE (e.g. IntelliJ or Android Studio have built-in support) to use that schema to give you **autocompletion** capabilities on your config file. More details on the IntelliJ support are available [at this page](https://www.jetbrains.com/help/ruby/yaml.html#remote_json).
You can configure your IDE (e.g. IntelliJ or Android Studio have built-in support)
to use that schema to give you **autocompletion** capabilities on your config file.
More details on the IntelliJ support are available
[on this page](https://www.jetbrains.com/help/ruby/yaml.html#remote_json).

![JSON Schema validator on IntelliJ](../images/json_schema_validator_intellij.png)

Expand Down
27 changes: 0 additions & 27 deletions docs/pages/failonbuild.md

This file was deleted.