From 006a34e40e20edcc8a8230c0c437995b03f7bf6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Aulery?= Date: Sat, 29 Nov 2014 16:42:29 +0100 Subject: [PATCH] CodingStyle checking tool directory: - Don't crash when a [.svn] cache directory is missing - Ignores the cache directories of the main VCS : bazaar, git, mercurial, svn Signed-off-by: Adrien Destugues Fixes #11532. --- src/tools/checkstyle/checkstyle.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/tools/checkstyle/checkstyle.py b/src/tools/checkstyle/checkstyle.py index 7b86341cab..c9021e33cf 100755 --- a/src/tools/checkstyle/checkstyle.py +++ b/src/tools/checkstyle/checkstyle.py @@ -38,7 +38,14 @@ def run(fileSet, rules, outputFileName): def visit(result, dir, names): extensions = [".cpp", ".h"] - names.remove(".git") + vcsCacheDirectory = [".bzr", ".git", ".hg", ".svn"] + + for name in reversed(names): + for vcd in vcsCacheDirectory: + if name == vcd: + print(vcd + " cache directory has been ignored") + names.remove(vcd) + for name in names: path = os.path.join(dir, name) if os.path.isfile(path) and os.path.splitext(name)[1] in extensions: