mirror of
https://github.com/catchorg/Catch2.git
synced 2025-05-25 22:19:25 +00:00
Minor fixes to python scripts by pycodestyle
This commit is contained in:
parent
64be2ad96c
commit
9e7c281e6e
9 changed files with 35 additions and 33 deletions
|
@ -4,19 +4,20 @@ from __future__ import print_function
|
|||
import os
|
||||
from scriptCommon import catchPath
|
||||
|
||||
changedFiles = 0
|
||||
|
||||
def isSourceFile( path ):
|
||||
return path.endswith( ".cpp" ) or path.endswith( ".h" ) or path.endswith( ".hpp" )
|
||||
|
||||
def fixAllFilesInDir( dir ):
|
||||
changedFiles = 0
|
||||
for f in os.listdir( dir ):
|
||||
path = os.path.join( dir,f )
|
||||
if os.path.isfile( path ):
|
||||
if isSourceFile( path ):
|
||||
fixFile( path )
|
||||
if fixFile( path ):
|
||||
changedFiles += 1
|
||||
else:
|
||||
fixAllFilesInDir( path )
|
||||
return changedFiles
|
||||
|
||||
def fixFile( path ):
|
||||
f = open( path, 'r' )
|
||||
|
@ -41,8 +42,10 @@ def fixFile( path ):
|
|||
f2.write( line )
|
||||
f2.close()
|
||||
os.remove( altPath )
|
||||
return True
|
||||
return False
|
||||
|
||||
fixAllFilesInDir(catchPath)
|
||||
changedFiles = fixAllFilesInDir(catchPath)
|
||||
if changedFiles > 0:
|
||||
print( "Fixed " + str(changedFiles) + " file(s)" )
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue