From 92f8e7962f706173d156f6322a23f79d9f8a270c Mon Sep 17 00:00:00 2001 From: Dmitry Krutskikh Date: Sun, 7 Nov 2021 23:56:10 +0300 Subject: [PATCH] refactor: cleanup anti-patterns documentation --- CHANGELOG.md | 2 +- .../anti_patterns/anti_patterns_list/long_method.dart | 2 -- .../anti_patterns_list/long_parameter_list.dart | 2 -- .../anti_patterns/models/pattern_documentation.dart | 9 +-------- website/docs/anti-patterns/overview.md | 5 +++++ website/docs/metrics/overview.md | 9 +++++++++ 6 files changed, 16 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e82b27e6d..cdfe54fb93 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ ## Unreleased * feat: introduce file metrics -* refactor: cleanup metric documentation +* refactor: cleanup anti-patterns, metrics documentation ## 4.6.0 diff --git a/lib/src/analyzers/lint_analyzer/anti_patterns/anti_patterns_list/long_method.dart b/lib/src/analyzers/lint_analyzer/anti_patterns/anti_patterns_list/long_method.dart index a4a2515038..ee9d589337 100644 --- a/lib/src/analyzers/lint_analyzer/anti_patterns/anti_patterns_list/long_method.dart +++ b/lib/src/analyzers/lint_analyzer/anti_patterns/anti_patterns_list/long_method.dart @@ -39,8 +39,6 @@ class LongMethod extends Pattern { id: patternId, documentation: const PatternDocumentation( name: 'Long Method', - brief: - 'Long blocks of code are difficult to reuse and understand because they are usually responsible for more than one thing. Separating those to several short ones with proper names helps you reuse your code and understand it better without reading methods body.', supportedType: EntityType.methodEntity, ), severity: readSeverity(patternSettings, Severity.none), diff --git a/lib/src/analyzers/lint_analyzer/anti_patterns/anti_patterns_list/long_parameter_list.dart b/lib/src/analyzers/lint_analyzer/anti_patterns/anti_patterns_list/long_parameter_list.dart index 4d1dbafbb5..aa9aa1e08e 100644 --- a/lib/src/analyzers/lint_analyzer/anti_patterns/anti_patterns_list/long_parameter_list.dart +++ b/lib/src/analyzers/lint_analyzer/anti_patterns/anti_patterns_list/long_parameter_list.dart @@ -37,8 +37,6 @@ class LongParameterList extends Pattern { id: patternId, documentation: const PatternDocumentation( name: 'Long Parameter List', - brief: - 'Long parameter lists are difficult to understand and use. Wrapping them into an object allows grouping parameters and change transferred data only by the object modification.', supportedType: EntityType.methodEntity, ), severity: readSeverity(patternSettings, Severity.none), diff --git a/lib/src/analyzers/lint_analyzer/anti_patterns/models/pattern_documentation.dart b/lib/src/analyzers/lint_analyzer/anti_patterns/models/pattern_documentation.dart index 991f52ba69..e5a039bee3 100644 --- a/lib/src/analyzers/lint_analyzer/anti_patterns/models/pattern_documentation.dart +++ b/lib/src/analyzers/lint_analyzer/anti_patterns/models/pattern_documentation.dart @@ -8,18 +8,11 @@ class PatternDocumentation { /// The name of the pattern final String name; - /// The short message with formal statement about the pattern - final String brief; - /// The type of entities which will be analyzed by the pattern. final EntityType supportedType; /// Initialize a newly created [PatternDocumentation]. /// /// This data object is used for a documentation generating from a source code. - const PatternDocumentation({ - required this.name, - required this.brief, - required this.supportedType, - }); + const PatternDocumentation({required this.name, required this.supportedType}); } diff --git a/website/docs/anti-patterns/overview.md b/website/docs/anti-patterns/overview.md index fee7a2a180..d91e59e6a4 100644 --- a/website/docs/anti-patterns/overview.md +++ b/website/docs/anti-patterns/overview.md @@ -10,4 +10,9 @@ Anti-patterns configuration is [described here](../getting-started/configuration Available anti-patterns: - [Long Method](./long-method.md) + + Long blocks of code are difficult to reuse and understand because they are usually responsible for more than one thing. + - [Long Parameter List](./long-parameter-list.md) + + Long parameter lists are difficult to understand and use. diff --git a/website/docs/metrics/overview.md b/website/docs/metrics/overview.md index c52c742276..1853da065d 100644 --- a/website/docs/metrics/overview.md +++ b/website/docs/metrics/overview.md @@ -12,30 +12,39 @@ Metrics configuration is [described here](../getting-started/configuration#confi ## Function specific metrics {#function-specific-metrics} - [Cyclomatic Complexity](./cyclomatic-complexity.md) + The number of linearly-independent paths through a method. - [Halstead Volume](./halstead-volume.md) + The method size, based on the numbers of operators and operands. - [Lines of Code](./lines-of-code.md) + The number of physical lines of code of a method, including blank lines and comments. - [Maintainability Index](./maintainability-index.md) + The indicator which mean how maintainable the source code is. - [Maximum Nesting](./maximum-nesting-level.md) + The maximum nesting level of control structures within a method. - [Number of Parameters](./number-of-parameters.md) + The number of parameters received by a method. - [Source lines of Code](./source-lines-of-code.md) + The approximate number of source code lines in a method, blank lines and comments are not counted. ## Class specific metrics {#class-specific-metrics} - [Number of Methods](./number-of-methods.md) + The number of methods of a class. - [Weight of a Class](./weight-of-class.md) + The number of "functional" public methods divided by the total number of public members.