-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement
exclude
property for the function_lines_of_code
rule
- Loading branch information
Showing
9 changed files
with
95 additions
and
68 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
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
25 changes: 12 additions & 13 deletions
25
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,25 @@ | ||
/// A data model class that represents the "function lines of code" input | ||
import 'package:solid_lints/src/lints/function_lines_of_code/models/max_lines_parameters.dart'; | ||
import 'package:solid_lints/src/models/ignored_entities_model/ignored_entities_model.dart'; | ||
|
||
/// A data model class that represents the `function_lines_of_code` config | ||
/// 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; | ||
/// The `max_lines` configuration | ||
final MaxLinesParameters maxLinesModel; | ||
|
||
static const _defaultMaxLines = 200; | ||
/// The `exclude` configuration | ||
final IgnoredEntitiesModel ignoredEntitiesModel; | ||
|
||
/// Constructor for [FunctionLinesOfCodeParameters] model | ||
const FunctionLinesOfCodeParameters({ | ||
required this.maxLines, | ||
required this.excludeNames, | ||
required this.maxLinesModel, | ||
required this.ignoredEntitiesModel, | ||
}); | ||
|
||
/// 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? ?? []), | ||
maxLinesModel: MaxLinesParameters.fromJson(json), | ||
ignoredEntitiesModel: IgnoredEntitiesModel.fromJson(json), | ||
); | ||
} |
20 changes: 20 additions & 0 deletions
20
lib/src/lints/function_lines_of_code/models/max_lines_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 @@ | ||
/// Data model that represents the limit for the amount of lines within a | ||
/// function. | ||
class MaxLinesParameters { | ||
/// Maximum allowed number of lines of code (LoC) per function, | ||
/// exceeding this limit triggers a warning. | ||
final int maxLines; | ||
|
||
static const _defaultMaxLines = 200; | ||
|
||
/// | ||
const MaxLinesParameters({ | ||
required this.maxLines, | ||
}); | ||
|
||
/// Method for creating from json data | ||
factory MaxLinesParameters.fromJson(Map<String, Object?> json) => | ||
MaxLinesParameters( | ||
maxLines: json['max_lines'] as int? ?? _defaultMaxLines, | ||
); | ||
} |
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