Ticket #11532: 0001-CodingStyle-checking-tool-directory.patch

File 0001-CodingStyle-checking-tool-directory.patch, 1.3 KB (added by LkpPo, 9 years ago)
  • src/tools/checkstyle/checkstyle.py

    From 0345f6f35ef5e0c95dcafc845095e03d1d72b3cc Mon Sep 17 00:00:00 2001
    From: =?UTF-8?q?St=C3=A9phane=20Aulery?= <saulery@free.fr>
    Date: Sat, 29 Nov 2014 16:42:29 +0100
    Subject: CodingStyle checking tool directory:
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    
    - 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: Stéphane Aulery <saulery@free.fr>
    ---
     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 3cdcee1..d4c135d 100644
    a b def run(fileSet, rules, outputFileName):  
    3737
    3838def visit(result, dir, names):
    3939    extensions = [".cpp", ".h"]
    40     names.remove(".svn")
     40    vcsCacheDirectory = [".bzr", ".git", ".hg", ".svn"]
     41
     42    for name in reversed(names):
     43        for vcd in vcsCacheDirectory:
     44            if name == vcd:
     45                print(vcd + " cache directory has been ignored")
     46                names.remove(vcd)
     47
    4148    for name in names:
    4249        path = os.path.join(dir, name)
    4350        if os.path.isfile(path) and os.path.splitext(name)[1] in extensions: