code_style.py: Apply exclusions to the file list
This commit rename `--files` options to `--subset` and it means to check a subset of the files known to git. Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
This commit is contained in:
parent
10ada35019
commit
8c6325cc8e
1 changed files with 9 additions and 12 deletions
|
@ -174,22 +174,19 @@ def main() -> int:
|
||||||
parser.add_argument('-f', '--fix', action='store_true',
|
parser.add_argument('-f', '--fix', action='store_true',
|
||||||
help=('modify source files to fix the code style '
|
help=('modify source files to fix the code style '
|
||||||
'(default: print diff, do not modify files)'))
|
'(default: print diff, do not modify files)'))
|
||||||
# --files is almost useless: it only matters if there are no files
|
parser.add_argument('--subset', action='store_true',
|
||||||
# ('code_style.py' without arguments checks all files known to Git,
|
help=('check a subset of the files known to git '
|
||||||
# 'code_style.py --files' does nothing). In particular,
|
'(default: empty FILE means full set)'))
|
||||||
# 'code_style.py --fix --files ...' is intended as a stable ("porcelain")
|
|
||||||
# way to restyle a possibly empty set of files.
|
|
||||||
parser.add_argument('--files', action='store_true',
|
|
||||||
help='only check the specified files (default with non-option arguments)')
|
|
||||||
parser.add_argument('operands', nargs='*', metavar='FILE',
|
parser.add_argument('operands', nargs='*', metavar='FILE',
|
||||||
help='files to check (if none: check files that are known to git)')
|
help='files to check')
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
if args.files or args.operands:
|
all_src_files = get_src_files()
|
||||||
src_files = args.operands
|
src_files = args.operands if args.operands else all_src_files
|
||||||
else:
|
if args.subset:
|
||||||
src_files = get_src_files()
|
# We are to check a subset of the default list
|
||||||
|
src_files = [f for f in args.operands if f in all_src_files]
|
||||||
|
|
||||||
if args.fix:
|
if args.fix:
|
||||||
# Fix mode
|
# Fix mode
|
||||||
|
|
Loading…
Reference in a new issue