Skip to content
This repository was archived by the owner on Jul 16, 2023. It is now read-only.

refactor: cleanup anti-patterns documentation #548

Merged
merged 1 commit into from
Nov 8, 2021
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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Unreleased

* feat: introduce file metrics
* refactor: cleanup metric documentation
* refactor: cleanup anti-patterns, metrics documentation

## 4.6.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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});
}
5 changes: 5 additions & 0 deletions website/docs/anti-patterns/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
9 changes: 9 additions & 0 deletions website/docs/metrics/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.