You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/src/commands/packages/commands/check/commands/licenses.dart
+34-9Lines changed: 34 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -61,6 +61,10 @@ class PackagesCheckLicensesCommand extends Command<int> {
61
61
..addMultiOption(
62
62
'allowed',
63
63
help:'Whitelist of allowed licenses.',
64
+
)
65
+
..addMultiOption(
66
+
'forbidden',
67
+
help:'Blacklist of not allowed licenses.',
64
68
);
65
69
}
66
70
@@ -89,11 +93,21 @@ class PackagesCheckLicensesCommand extends Command<int> {
89
93
final ignoreFailures = _argResults['ignore-failures'] asbool;
90
94
final dependencyTypes = _argResults['dependency-type'] asList<String>;
91
95
final allowedLicenses = _argResults['allowed'] asList<String>;
96
+
final forbiddenLicenses = _argResults['forbidden'] asList<String>;
97
+
98
+
if (allowedLicenses.isNotEmpty && forbiddenLicenses.isNotEmpty) {
99
+
usageException(
100
+
'''Cannot specify both ${styleItalic.wrap('allowed')} and ${styleItalic.wrap('forbidden')} options.''',
101
+
);
102
+
}
92
103
93
-
final invalidLicenses =_invalidLicenses(allowedLicenses);
104
+
final invalidLicenses =_invalidLicenses([
105
+
...allowedLicenses,
106
+
...forbiddenLicenses,
107
+
]);
94
108
if (invalidLicenses.isNotEmpty) {
95
109
_logger.warn(
96
-
'''Some ${styleItalic.wrap('allowed')} licenses failed to be recognized: ${invalidLicenses.stringify()}. Refer to the documentation for a list of valid licenses.''',
110
+
'''Some licenses failed to be recognized: ${invalidLicenses.stringify()}. Refer to the documentation for a list of valid licenses.''',
97
111
);
98
112
}
99
113
@@ -172,9 +186,20 @@ class PackagesCheckLicensesCommand extends Command<int> {
172
186
}
173
187
}
174
188
175
-
final bannedDependencies = allowedLicenses.isNotEmpty
0 commit comments