@@ -43,6 +43,11 @@ const Set<String> _ignoredFullBasenameList = <String>{
4343 'resource.h' , // Generated by VS.
4444};
4545
46+ // Path parts to ignore. Used to ignore entire subdirectories.
47+ const Set <String > _ignorePathPartList = < String > {
48+ 'FlutterGeneratedPluginSwiftPackage' , // Generated by Flutter tool.
49+ };
50+
4651// Third-party packages where the code doesn't have file-level annotation, just
4752// the package-level LICENSE file. Each entry must be a directory relative to
4853// third_party/packages, as that is the only directory where this is allowed.
@@ -227,7 +232,7 @@ class LicenseCheckCommand extends PackageCommand {
227232 final List <File > unrecognizedThirdPartyFiles = < File > [];
228233
229234 // Most code file types in the repository use '//' comments.
230- final String defaultFirstParyLicenseBlock = _generateLicenseBlock ('// ' );
235+ final String defaultFirstPartyLicenseBlock = _generateLicenseBlock ('// ' );
231236 // A few file types have a different comment structure.
232237 final Map <String , String > firstPartyLicenseBlockByExtension =
233238 < String , String > {
@@ -258,19 +263,19 @@ class LicenseCheckCommand extends PackageCommand {
258263 // still pass since they will be converted back on commit.
259264 content = content.replaceAll ('\r\n ' , '\n ' );
260265
261- final String firstParyLicense =
266+ final String firstPartyLicense =
262267 firstPartyLicenseBlockByExtension[p.extension (file.path)] ??
263- defaultFirstParyLicenseBlock ;
268+ defaultFirstPartyLicenseBlock ;
264269 if (_isThirdParty (file)) {
265270 // Third-party directories allow either known third-party licenses, our
266271 // the first-party license, as there may be local additions.
267272 if (! _thirdPartyLicenseBlockRegexes
268273 .any ((RegExp regex) => regex.hasMatch (content)) &&
269- ! content.contains (firstParyLicense )) {
274+ ! content.contains (firstPartyLicense )) {
270275 unrecognizedThirdPartyFiles.add (file);
271276 }
272277 } else {
273- if (! content.contains (firstParyLicense )) {
278+ if (! content.contains (firstPartyLicense )) {
274279 incorrectFirstPartyFiles.add (file);
275280 }
276281 }
@@ -305,11 +310,24 @@ class LicenseCheckCommand extends PackageCommand {
305310 }
306311
307312 bool _shouldIgnoreFile (File file) {
308- final String path = file.path;
309- return _ignoreBasenameList.contains (p.basenameWithoutExtension (path)) ||
310- _ignoreSuffixList.any ((String suffix) =>
311- path.endsWith (suffix) ||
312- _ignoredFullBasenameList.contains (p.basename (path)));
313+ if (_ignoreBasenameList.contains (p.basenameWithoutExtension (file.path))) {
314+ return true ;
315+ }
316+
317+ if (_ignoreSuffixList.any (file.path.endsWith)) {
318+ return true ;
319+ }
320+
321+ if (_ignoredFullBasenameList.contains (p.basename (file.path))) {
322+ return true ;
323+ }
324+
325+ final List <String > parts = path.split (file.path);
326+ if (parts.any (_ignorePathPartList.contains)) {
327+ return true ;
328+ }
329+
330+ return false ;
313331 }
314332
315333 bool _isThirdParty (File file) {
0 commit comments