From aa8edbc2ba0d363799a7b60ef6edfe2ae1b58102 Mon Sep 17 00:00:00 2001 From: bresch Date: Tue, 26 Mar 2019 17:33:10 +0100 Subject: [PATCH] Parameter update - add -tcpp flag in rg to check C++ files only --- Tools/parameter_update.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Tools/parameter_update.py b/Tools/parameter_update.py index ff212d42a9..d421869f78 100644 --- a/Tools/parameter_update.py +++ b/Tools/parameter_update.py @@ -55,7 +55,7 @@ Usage: The script needs a list of files as an input. To quickly find and feed all the file that it needs to inspect, one can simply pipe the result of a ripgrep -l command as follows: - rg -l '\.[gs]et\(|px4::params::' | python parameter_update.py + rg -l '\.[gs]et\(|px4::params::' -tcpp | python parameter_update.py """ import re @@ -73,7 +73,7 @@ replace_dict = dict() print("Searching for parameters...") for filename in filenames: - print("In {} :".format(filename)) + print(filename) with open(filename, 'r') as f: text = f.read() for match in regex.finditer(text): @@ -84,7 +84,7 @@ for old_var in replace_dict: print("{} -> {}".format(old_var, replace_dict[old_var])) for filename in filenames: - print("In {} :".format(filename)) + print(filename) for old_var in replace_dict: for line in fileinput.input(filename, inplace=1): line = re.sub(r'(>\)\s*)\b' + old_var + r'\b', r'\1' + replace_dict[old_var], line.rstrip()) # replace the declaration