-
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. added ingore parametrs to some lints
- Loading branch information
shaark
committed
Dec 4, 2024
1 parent
90e083f
commit 6e3342d
Showing
10 changed files
with
134 additions
and
47 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
23 changes: 23 additions & 0 deletions
23
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,23 @@ | ||
import 'package:solid_lints/src/models/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.fromJson( | ||
excludeList: | ||
json[ExcludedIdentifiersListParameter.excludeParameterName] as Iterable? ?? [], | ||
), | ||
); | ||
} | ||
} |
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
12 changes: 12 additions & 0 deletions
12
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,31 @@ | ||
import 'package:solid_lints/src/models/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.fromJson( | ||
excludeList: | ||
json[ExcludedIdentifiersListParameter.excludeParameterName] | ||
as Iterable? ?? | ||
[], | ||
), | ||
); | ||
} |
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
16 changes: 11 additions & 5 deletions
16
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,32 @@ | ||
import 'package:solid_lints/src/models/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.fromJson( | ||
excludeList: | ||
json[ExcludedIdentifiersListParameter.excludeParameterName] | ||
as Iterable? ?? | ||
[], | ||
), | ||
); | ||
} |
24 changes: 24 additions & 0 deletions
24
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,24 @@ | ||
import 'package:solid_lints/src/models/excluded_identifiers_list_parameter.dart'; | ||
|
||
/// A data model class that represents the "avoid returning widgets" 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.fromJson( | ||
excludeList: json[ExcludedIdentifiersListParameter.excludeParameterName] | ||
as Iterable? ?? | ||
[], | ||
), | ||
); | ||
} | ||
} |
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
12 changes: 12 additions & 0 deletions
12
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,31 @@ | ||
import 'package:solid_lints/src/models/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.fromJson( | ||
excludeList: | ||
json[ExcludedIdentifiersListParameter.excludeParameterName] | ||
as Iterable? ?? | ||
[], | ||
), | ||
); | ||
} |
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