-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* issue-167. extract exclude rule code * issue-167. fixed null check * issue-167. fixed after comments * issue-167. fixed after comments * issue-167. added ingore parametrs to some lints * issue-167. fixed comments * issue-167. fixed after comments * issue-167. fixed after comments * issue-167. fixed no_empty_block_rule format * issue-167. fixed after comments * issue-167. fixed after comments * issue-167. chaged test * issue-167. fixed after comments --------- Co-authored-by: shaark <[email protected]>
- Loading branch information
1 parent
3ee83ca
commit 3e1711b
Showing
23 changed files
with
274 additions
and
61 deletions.
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
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), | ||
); | ||
} |
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), | ||
); | ||
} |
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
Oops, something went wrong.