Opened 5 years ago

Closed 4 years ago

#11532 closed bug (fixed)

Fix CodingStyle checking tool for cached directories of vcs

Reported by: LkpPo Owned by: nobody
Priority: low Milestone: R1
Component: - General Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Has a Patch: yes Platform: All

Description

Hello,

Now that development has migrated to git the checkstyle.py tool crashes when invoked on a file. This patch fixes this behaviour and adds support for the most common VCS if someone want to use the one that prefers to code.

I am looking for a sponsor for review and push the patch, please.

Thank you for your help.

-- Stéphane Aulery

Attachments (1)

0001-CodingStyle-checking-tool-directory.patch (1.3 KB ) - added by LkpPo 5 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 by LkpPo, 5 years ago

Has a Patch: set

comment:2 by korli, 5 years ago

I think you can iterate over vcsCacheDirectory and use a try/except.

comment:3 by LkpPo, 5 years ago

I can also simplify the script by a single loop without exception:

     for name in names:
         if name in vcsCacheDirectory:
             print(name + " cache directory has been ignored")
             names.remove(name)
         else:
             path = os.path.join(dir, name)
             if os.path.isfile(path) and os.path.splitext(name)[1] in extensions:
                 print "adding", path
                 result.append(path)

comment:4 by korli, 5 years ago

ok, but what's the point in removing name from names then?

comment:5 by LkpPo, 5 years ago

To avoid recursive exploration of part of the tree in the folder list passed to the function os.path.walk(). See https://docs.python.org/2/library/os.path.html for more information.

comment:6 by pulkomandy, 5 years ago

Hi, Are there plans for an updated version of the patch applying the comments above or should we apply the existing one?

comment:7 by phoudoin, 4 years ago

Sounds good to me.

comment:8 by pulkomandy, 4 years ago

Resolution: fixed
Status: newclosed

Applied in hrev50090.

Note: See TracTickets for help on using tickets.