From 1bbb7efb5ead729887495c6080c295039245ad6f Mon Sep 17 00:00:00 2001 From: Dmitry Zhifarsky Date: Thu, 5 Aug 2021 16:09:44 +0300 Subject: [PATCH 1/4] docs: update readme after website release --- README.md | 45 ++++++++++++++++++++------------------------- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 22d7aa6463..c98c52e1f1 100644 --- a/README.md +++ b/README.md @@ -8,10 +8,12 @@ # Dart Code Metrics -[Configuration](#configuration) | -[Rules](#rules) | -[Metrics](#metrics) | -[Anti-patterns](#anti-patterns) +> [Read the full documentation on the website](https://dartcodemetrics.dev/docs/getting-started/introduction) + +[Configuration](https://dartcodemetrics.dev/docs/getting-started/configuration) | +[Rules](https://dartcodemetrics.dev/docs/rules/overview) | +[Metrics](https://dartcodemetrics.dev/docs/metrics/overview) | +[Anti-patterns](https://dartcodemetrics.dev/docs/anti-patterns/overivew) [noted, warning, alarm] ``` +<<<<<<< Updated upstream ### Library [See `example/example.dart`](https://github.com/dart-code-checker/dart-code-metrics/blob/master/example/example.dart). @@ -377,6 +370,8 @@ Like rules, anti-patterns display issues in IDE, except that their configuration - [long-method](https://github.com/dart-code-checker/dart-code-metrics/blob/master/doc/anti-patterns/long-method.md) - [long-parameter-list](https://github.com/dart-code-checker/dart-code-metrics/blob/master/doc/anti-patterns/long-parameter-list.md) +======= +>>>>>>> Stashed changes ## Troubleshooting Please read [the following guide](./TROUBLESHOOTING.md) if the plugin is not working as you'd expect it to work. From 54dc68ecfdd1c264db361ad35478ebd01e948f9e Mon Sep 17 00:00:00 2001 From: Dmitry Zhifarsky Date: Thu, 5 Aug 2021 16:18:06 +0300 Subject: [PATCH 2/4] docs: update font size --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c98c52e1f1..9144b12960 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ # Dart Code Metrics -> [Read the full documentation on the website](https://dartcodemetrics.dev/docs/getting-started/introduction) +> [Read the full documentation on the website](https://dartcodemetrics.dev/docs/getting-started/introduction) [Configuration](https://dartcodemetrics.dev/docs/getting-started/configuration) | [Rules](https://dartcodemetrics.dev/docs/rules/overview) | From 6c344323dbfda767fabe4029bf6c4b8805ce1310 Mon Sep 17 00:00:00 2001 From: Dmitry Zhifarsky Date: Thu, 5 Aug 2021 16:25:14 +0300 Subject: [PATCH 3/4] docs: change font size --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9144b12960..57b7ef70e5 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,8 @@ # Dart Code Metrics -> [Read the full documentation on the website](https://dartcodemetrics.dev/docs/getting-started/introduction) - +> ### Read [the full documentation on the website](https://dartcodemetrics.dev/docs/getting-started/introduction) +\ [Configuration](https://dartcodemetrics.dev/docs/getting-started/configuration) | [Rules](https://dartcodemetrics.dev/docs/rules/overview) | [Metrics](https://dartcodemetrics.dev/docs/metrics/overview) | From 25169eb82b551d70d7df6aa59f4af406ecbdb27f Mon Sep 17 00:00:00 2001 From: Dmitry Zhifarsky Date: Thu, 5 Aug 2021 17:02:57 +0300 Subject: [PATCH 4/4] chore: resolve conflicts --- README.md | 204 ------------------------------------------------------ 1 file changed, 204 deletions(-) diff --git a/README.md b/README.md index 57b7ef70e5..07f338aa8a 100644 --- a/README.md +++ b/README.md @@ -168,210 +168,6 @@ Usage: metrics [arguments...] [noted, warning, alarm] ``` -<<<<<<< Updated upstream -### Library - -[See `example/example.dart`](https://github.com/dart-code-checker/dart-code-metrics/blob/master/example/example.dart). - -## Configuration - -To configure the package add the `dart_code_metrics` entry to the `analysis_options.yaml` and update plugins list of the analyzer. - -```yaml -analyzer: - plugins: - - dart_code_metrics - -dart_code_metrics: - anti-patterns: - - ... # add this entry to configure the list of anti-patterns - metrics: - ... # add this entry to configure the list of reported metrics - metrics-exclude: - - ... # add this entry to configure the list of files that should be ignored by metrics - rules: - - ... # add this entry to configure the list of rules -``` - -Basic config example: - -```yaml -analyzer: - plugins: - - dart_code_metrics - -dart_code_metrics: - anti-patterns: - - long-method - - long-parameter-list - metrics: - cyclomatic-complexity: 20 - number-of-arguments: 4 - maximum-nesting-level: 5 - metrics-exclude: - - test/** - rules: - - newline-before-return - - no-boolean-literal-compare - - no-empty-block - - prefer-trailing-comma - - prefer-conditional-expressions - - no-equal-then-else -``` - -### Configuring a rules entry - -To enable a rule add its id to the `rules` entry. All rules have severity which can be overridden with `severity` config entry. For example, - -```yaml -dart_code_metrics: - rules: - - newline-before-return: - severity: style -``` - -will set severity to `style`. Available severity values: none, style, performance, warning, error. - -Rules with a `configurable` badge have additional configuration, check out their docs for more information. - -### Configuring a metrics entry - -To enable a metric add its id to the `metrics` entry in the `analysis_options.yaml`. All metrics can take a threshold value. If no value was provided, the default value will be used. - -### Configuring a metrics-exclude entry - -To exclude files from a metrics report provide a list of regular expressions for ignored files. For example: - -```yaml -dart_code_metrics: - metrics-exclude: - - test/** - - lib/src/some_file.dart -``` - -### Configuring an anti-pattern entry - -To enable an anti-pattern add its id to the `anti-patterns` entry. - -## Ignoring a rule or anti-pattern - -If a specific rule or anti-pattern warning should be ignored, it can be flagged with a comment. For example, - -```dart -// ignore: no-empty-block -void emptyFunction() {} -``` - -tells the analyzer to ignore this instance of the `no-empty-block` warning. - -End-of-line comments are supported as well. The following communicates the same thing: - -```dart -void emptyFunction() {} // ignore: no-empty-block -``` - -To ignore a rule for an entire file, use the `ignore_for_file` comment flag. For example, - -```dart -// ignore_for_file: no-empty-block -... - -void emptyFunction() {} -``` - -tells the analyzer to ignore all occurrences of the kebab-case-types warning in this file. - -It's the same approach that the dart linter package [use](https://github.com/dart-lang/linter#usage). - -Additionally, `exclude` entry for the analyzer config can be used to ignore files. For example, - -```yaml -analyzer: - exclude: - - example/** -``` - -will work both for the analyzer and for this plugin. - -If you want a specific rule to ignore files, you can configure `exclude` entry for it. For example, - -```yaml -dart_code_metrics: - rules: - no-equal-arguments: - exclude: - - test/** -``` - -## Metrics - -Metrics configuration is [described here](#configuring-a-metrics-entry). - -Available metrics: - -- [Cyclomatic Complexity](https://github.com/dart-code-checker/dart-code-metrics/blob/master/doc/metrics/cyclomatic-complexity.md) -- [Lines of Code](https://github.com/dart-code-checker/dart-code-metrics/blob/master/doc/metrics/lines-of-code.md) -- [Maximum Nesting](https://github.com/dart-code-checker/dart-code-metrics/blob/master/doc/metrics/maximum-nesting-level.md) -- [Number of Methods](https://github.com/dart-code-checker/dart-code-metrics/blob/master/doc/metrics/number-of-methods.md) -- [Number of Parameters](https://github.com/dart-code-checker/dart-code-metrics/blob/master/doc/metrics/number-of-parameters.md) -- [Source lines of Code](https://github.com/dart-code-checker/dart-code-metrics/blob/master/doc/metrics/source-lines-of-code.md) -- [Weight of a Class](https://github.com/dart-code-checker/dart-code-metrics/blob/master/doc/metrics/weight-of-class.md) - -## Rules - -Rules are grouped by a category to help you understand their purpose. - -Right now auto-fixes are available through an IDE context menu (ex. VS Code Quick Fix). - -Rules configuration is [described here](#configuring-a-rules-entry). - -### Common - -- [avoid-late-keyword](https://github.com/dart-code-checker/dart-code-metrics/blob/master/doc/rules/avoid-late-keyword.md) -- [avoid-non-null-assertion](https://github.com/dart-code-checker/dart-code-metrics/blob/master/doc/rules/avoid-non-null-assertion.md) -- [avoid-unused-parameters](https://github.com/dart-code-checker/dart-code-metrics/blob/master/doc/rules/avoid-unused-parameters.md) -- [binary-expression-operand-order](https://github.com/dart-code-checker/dart-code-metrics/blob/master/doc/rules/binary-expression-operand-order.md)   ![Has auto-fix](https://img.shields.io/badge/-has%20auto--fix-success) -- [double-literal-format](https://github.com/dart-code-checker/dart-code-metrics/blob/master/doc/rules/double-literal-format.md)   ![Has auto-fix](https://img.shields.io/badge/-has%20auto--fix-success) -- [member-ordering](https://github.com/dart-code-checker/dart-code-metrics/blob/master/doc/rules/member-ordering.md)   [![Configurable](https://img.shields.io/badge/-configurable-informational)](https://github.com/dart-code-checker/dart-code-metrics/blob/master/doc/rules/member-ordering.md#config-example) -- [member-ordering-extended](https://github.com/dart-code-checker/dart-code-metrics/blob/master/doc/rules/member-ordering-extended.md)   [![Configurable](https://img.shields.io/badge/-configurable-informational)](https://github.com/dart-code-checker/dart-code-metrics/blob/master/doc/rules/member-ordering-extended.md#config-example) -- [newline-before-return](https://github.com/dart-code-checker/dart-code-metrics/blob/master/doc/rules/newline-before-return.md) -- [no-boolean-literal-compare](https://github.com/dart-code-checker/dart-code-metrics/blob/master/doc/rules/no-boolean-literal-compare.md)   ![Has auto-fix](https://img.shields.io/badge/-has%20auto--fix-success) -- [no-empty-block](https://github.com/dart-code-checker/dart-code-metrics/blob/master/doc/rules/no-empty-block.md) -- [no-equal-arguments](https://github.com/dart-code-checker/dart-code-metrics/blob/master/doc/rules/no-equal-arguments.md)   ![Configurable](https://img.shields.io/badge/-configurable-informational) -- [no-equal-then-else](https://github.com/dart-code-checker/dart-code-metrics/blob/master/doc/rules/no-equal-then-else.md) -- [no-magic-number](https://github.com/dart-code-checker/dart-code-metrics/blob/master/doc/rules/no-magic-number.md)   [![Configurable](https://img.shields.io/badge/-configurable-informational)](https://github.com/dart-code-checker/dart-code-metrics/blob/master/doc/rules/no-magic-number.md#config-example) -- [no-object-declaration](https://github.com/dart-code-checker/dart-code-metrics/blob/master/doc/rules/no-object-declaration.md) -- [prefer-conditional-expressions](https://github.com/dart-code-checker/dart-code-metrics/blob/master/doc/rules/prefer-conditional-expressions.md)   ![Has auto-fix](https://img.shields.io/badge/-has%20auto--fix-success) -- [prefer-trailing-comma](https://github.com/dart-code-checker/dart-code-metrics/blob/master/doc/rules/prefer-trailing-comma.md)   [![Configurable](https://img.shields.io/badge/-configurable-informational)](https://github.com/dart-code-checker/dart-code-metrics/blob/master/doc/rules/prefer-trailing-comma.md#config-example)   ![Has auto-fix](https://img.shields.io/badge/-has%20auto--fix-success) - -### Flutter specific - -- [always-remove-listener](https://github.com/dart-code-checker/dart-code-metrics/blob/master/doc/rules/always-remove-listener.md) -- [avoid-returning-widgets](https://github.com/dart-code-checker/dart-code-metrics/blob/master/doc/rules/avoid-returning-widgets.md)   [![Configurable](https://img.shields.io/badge/-configurable-informational)](https://github.com/dart-code-checker/dart-code-metrics/blob/master/doc/rules/avoid-returning-widgets.md#config-example) -- [avoid-unnecessary-setstate](https://github.com/dart-code-checker/dart-code-metrics/blob/master/doc/rules/avoid-unnecessary-setstate.md) -- [avoid-wrapping-in-padding](https://github.com/dart-code-checker/dart-code-metrics/blob/master/doc/rules/avoid-wrapping-in-padding.md) -- [prefer-extracting-callbacks](https://github.com/dart-code-checker/dart-code-metrics/blob/master/doc/rules/prefer-extracting-callbacks.md)   [![Configurable](https://img.shields.io/badge/-configurable-informational)](https://github.com/dart-code-checker/dart-code-metrics/blob/master/doc/rules/prefer-extracting-callbacks.md#config-example) - -### Intl specific - -- [prefer-intl-name](https://github.com/dart-code-checker/dart-code-metrics/blob/master/doc/rules/prefer-intl-name.md)   ![Has auto-fix](https://img.shields.io/badge/-has%20auto--fix-success) -- [provide-correct-intl-args](https://github.com/dart-code-checker/dart-code-metrics/blob/master/doc/rules/provide-correct-intl-args.md) - -### Angular specific - -- [avoid-preserve-whitespace-false](https://github.com/dart-code-checker/dart-code-metrics/blob/master/doc/rules/avoid-preserve-whitespace-false.md) -- [component-annotation-arguments-ordering](https://github.com/dart-code-checker/dart-code-metrics/blob/master/doc/rules/component-annotation-arguments-ordering.md)   [![Configurable](https://img.shields.io/badge/-configurable-informational)](https://github.com/dart-code-checker/dart-code-metrics/blob/master/doc/rules/component-annotation-arguments-ordering.md#config-example) -- [prefer-on-push-cd-strategy](https://github.com/dart-code-checker/dart-code-metrics/blob/master/doc/rules/prefer-on-push-cd-strategy.md) - -## Anti-patterns - -Like rules, anti-patterns display issues in IDE, except that their configuration is based on a `metrics` entry in the config. - -- [long-method](https://github.com/dart-code-checker/dart-code-metrics/blob/master/doc/anti-patterns/long-method.md) -- [long-parameter-list](https://github.com/dart-code-checker/dart-code-metrics/blob/master/doc/anti-patterns/long-parameter-list.md) - -======= ->>>>>>> Stashed changes ## Troubleshooting Please read [the following guide](./TROUBLESHOOTING.md) if the plugin is not working as you'd expect it to work.