Update features/includes test linting to report all unused/unrecognized values

(rather than just the first)
This commit is contained in:
Richard Gibson 2025-04-04 12:29:35 -04:00
parent 1e2f389caa
commit 2f937a61fd
2 changed files with 8 additions and 4 deletions

View File

@ -29,9 +29,9 @@ class CheckFeatures(Check):
if len(features) == 0:
return 'If present, the `features` tag must have at least one member'
for feature in features:
if feature not in self.valid_features:
return 'Unrecognized feature: "%s"' % feature
unrecognized = set(features) - set(self.valid_features)
if len(unrecognized) > 0:
return 'Unrecognized features: %s' % ', '.join(sorted(unrecognized))
if len(set(features)) != len(features):
return 'The `features` tag may not include duplicate entries'

View File

@ -60,6 +60,7 @@ class CheckIncludes(Check):
without_frontmatter = self._remove_frontmatter(source)
unused = []
for harness_file in harness_files:
if harness_file['allow_unused']:
continue
@ -77,4 +78,7 @@ class CheckIncludes(Check):
if self._has_reference(other_harness_file['source'], harness_file['defines']):
break
else:
return 'Unused include: "%s"' % harness_file['name']
unused.append(harness_file['name'])
if len(unused) > 0:
return 'Unused includes: %s' % ', '.join(sorted(unused))