-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue 167 1 #186
Merged
yurii-prykhodko-solid
merged 15 commits into
solid-software:master
from
StarovNikita:issue-167-1
Dec 6, 2024
Merged
Issue 167 1 #186
Changes from 13 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
23c62a8
issue-167. extract exclude rule code
bdbfca1
issue-167. fixed null check
5175b01
issue-167. fixed after comments
90e083f
issue-167. fixed after comments
6e3342d
issue-167. added ingore parametrs to some lints
03122d6
issue-167. fixed comments
b8b0a5d
issue-167. fixed after comments
c526e5e
issue-167. fixed after comments
b631295
issue-167. added exclude params to some rules
199cca6
issue-167. fixed after comments
71c28c0
issue-167. fixed no_empty_block_rule format
2cc9b19
issue-167. fixed after comments
1008015
issue-167. fixed after comments
7e614d2
issue-167. chaged test
3e3a4ee
issue-167. fixed after comments
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 7 additions & 3 deletions
10
lib/src/common/parameters/excluded_identifier_parameter.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
lib/src/lints/avoid_unused_parameters/models/avoid_unused_parameters.dart
yurii-prykhodko-solid marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import 'package:solid_lints/src/common/parameters/excluded_identifiers_list_parameter.dart'; | ||
|
||
/// A data model class that represents the "avoid returning widgets" input | ||
/// parameters. | ||
class AvoidUnusedParameters { | ||
/// A list of methods that should be excluded from the lint. | ||
final ExcludedIdentifiersListParameter exclude; | ||
|
||
/// Constructor for [AvoidUnusedParameters] model | ||
AvoidUnusedParameters({ | ||
required this.exclude, | ||
}); | ||
|
||
/// Method for creating from json data | ||
factory AvoidUnusedParameters.fromJson(Map<String, dynamic> json) { | ||
return AvoidUnusedParameters( | ||
exclude: ExcludedIdentifiersListParameter.defaultFromJson(json), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
lib/src/lints/cyclomatic_complexity/models/cyclomatic_complexity_parameters.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,26 @@ | ||
import 'package:solid_lints/src/common/parameters/excluded_identifiers_list_parameter.dart'; | ||
|
||
/// Cyclomatic complexity metric limits configuration. | ||
class CyclomaticComplexityParameters { | ||
/// Threshold cyclomatic complexity level, exceeding it triggers a warning. | ||
final int maxComplexity; | ||
|
||
/// A list of methods that should be excluded from the lint. | ||
final ExcludedIdentifiersListParameter exclude; | ||
|
||
/// Reference: NIST 500-235 item 2.5 | ||
static const _defaultMaxComplexity = 10; | ||
|
||
/// Constructor for [CyclomaticComplexityParameters] model | ||
const CyclomaticComplexityParameters({ | ||
required this.maxComplexity, | ||
required this.exclude, | ||
}); | ||
|
||
/// Method for creating from json data | ||
factory CyclomaticComplexityParameters.fromJson(Map<String, Object?> json) => | ||
CyclomaticComplexityParameters( | ||
maxComplexity: json['max_complexity'] as int? ?? _defaultMaxComplexity, | ||
exclude: ExcludedIdentifiersListParameter.defaultFromJson(json), | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 6 additions & 5 deletions
11
lib/src/lints/function_lines_of_code/models/function_lines_of_code_parameters.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,27 @@ | ||
import 'package:solid_lints/src/common/parameters/excluded_identifiers_list_parameter.dart'; | ||
|
||
/// A data model class that represents the "function lines of code" input | ||
/// parameters. | ||
class FunctionLinesOfCodeParameters { | ||
/// Maximum allowed number of lines of code (LoC) per function, | ||
/// exceeding this limit triggers a warning. | ||
final int maxLines; | ||
|
||
/// Function names to be excluded from the rule check | ||
final List<String> excludeNames; | ||
/// A list of methods that should be excluded from the lint. | ||
final ExcludedIdentifiersListParameter exclude; | ||
|
||
static const _defaultMaxLines = 200; | ||
|
||
/// Constructor for [FunctionLinesOfCodeParameters] model | ||
const FunctionLinesOfCodeParameters({ | ||
required this.maxLines, | ||
required this.excludeNames, | ||
required this.exclude, | ||
}); | ||
|
||
/// Method for creating from json data | ||
factory FunctionLinesOfCodeParameters.fromJson(Map<String, Object?> json) => | ||
FunctionLinesOfCodeParameters( | ||
maxLines: json['max_lines'] as int? ?? _defaultMaxLines, | ||
excludeNames: | ||
List<String>.from(json['excludeNames'] as Iterable? ?? []), | ||
exclude: ExcludedIdentifiersListParameter.defaultFromJson(json), | ||
yurii-prykhodko-solid marked this conversation as resolved.
Show resolved
Hide resolved
|
||
); | ||
} |
20 changes: 20 additions & 0 deletions
20
lib/src/lints/no_empty_block/models/no_empty_block_parameters.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import 'package:solid_lints/src/common/parameters/excluded_identifiers_list_parameter.dart'; | ||
|
||
/// A data model class that represents the "no empty block" lint input | ||
/// parameters. | ||
class NoEmptyBlockParameters { | ||
/// A list of methods that should be excluded from the lint. | ||
final ExcludedIdentifiersListParameter exclude; | ||
|
||
/// Constructor for [NoEmptyBlockParameters] model | ||
NoEmptyBlockParameters({ | ||
required this.exclude, | ||
}); | ||
|
||
/// Method for creating from json data | ||
factory NoEmptyBlockParameters.fromJson(Map<String, dynamic> json) { | ||
return NoEmptyBlockParameters( | ||
exclude: ExcludedIdentifiersListParameter.defaultFromJson(json), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
lib/src/lints/number_of_parameters/models/number_of_parameters_parameters.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,26 @@ | ||
import 'package:solid_lints/src/common/parameters/excluded_identifiers_list_parameter.dart'; | ||
|
||
/// A data model class that represents the "number of parameters" input | ||
/// parameters. | ||
class NumberOfParametersParameters { | ||
/// Maximum number of parameters allowed before a warning is triggered. | ||
final int maxParameters; | ||
|
||
/// A list of methods that should be excluded from the lint. | ||
final ExcludedIdentifiersListParameter exclude; | ||
|
||
static const _defaultMaxParameters = 2; | ||
|
||
/// Constructor for [NumberOfParametersParameters] model | ||
const NumberOfParametersParameters({ | ||
required this.maxParameters, | ||
required this.exclude, | ||
}); | ||
|
||
/// Method for creating from json data | ||
factory NumberOfParametersParameters.fromJson(Map<String, Object?> json) => | ||
NumberOfParametersParameters( | ||
maxParameters: json['max_parameters'] as int? ?? _defaultMaxParameters, | ||
exclude: ExcludedIdentifiersListParameter.defaultFromJson(json), | ||
); | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can replace all this with a call to another factory, to avoid duplication