@@ -136,11 +136,17 @@ def __call__(self, parser, namespace, values, option_string=None):
136136 action = commandline .StoreRepoObject , repo_type = 'ebuild-raw' , allow_external_repos = True ,
137137 help = 'repo to pull packages from' )
138138main_options .add_argument (
139- '-f' , '--filter' , choices = ('repo' ,),
140- help = "enable all license and visibility filtering for packages" ,
139+ '-f' , '--filter' , choices = ('latest' , ' repo' ,),
140+ help = 'limit targeted packages for scanning' ,
141141 docs = """
142- Enable all package filtering mechanisms such as ACCEPT_KEYWORDS,
143- ACCEPT_LICENSE, and package.mask.
142+ Support limiting targeted packages for scanning using a chosen filter.
143+
144+ If the 'repo' argument is used, all package visibility mechanisms used
145+ by the package manager when resolving package dependencies such as
146+ ACCEPT_KEYWORDS, ACCEPT_LICENSE, and package.mask will be enabled.
147+
148+ If the 'latest' argument is used, only the latest package per slot of
149+ both VCS and non-VCS types will be scanned.
144150 """ )
145151main_options .add_argument (
146152 '--sorted' , action = 'store_true' ,
@@ -514,6 +520,11 @@ def restrictions():
514520 namespace .enabled_checks = [
515521 c for c in namespace .enabled_checks if not c .skip (namespace )]
516522
523+ # only run version scope checks when using a package filter
524+ if namespace .filter in ('latest' ,):
525+ namespace .enabled_checks = [
526+ c for c in namespace .enabled_checks if c .scope == base .version_scope ]
527+
517528 if not namespace .enabled_checks :
518529 parser .error ('no active checks' )
519530
0 commit comments