2 __date__ =
"$2010-08-06 14.27.51$"
6 from Utilities.ReleaseScripts.cmsCodeRules.cppFunctionSkipper
import filterFiles
as function
7 ordering = [
'1',
'2',
'3',
'4',
'5',
'6']
11 checkPath = os.getcwd()
12 picklePath = os.getcwd()
14 htmlPath = os.getcwd()
31 rulesNames.append(ruleName)
32 Configuration[ruleName] = {}
34 Configuration[ruleName][
'description'] =
'Search for "using namespace" or "using std::" in header files'
35 Configuration[ruleName][
'filesToMatch'] = [
'*.h']
36 Configuration[ruleName][
'exceptPaths'] = []
37 Configuration[ruleName][
'skip'] = [comment, function]
38 Configuration[ruleName][
'filter'] =
'(\susing|\Ausing)\s+(namespace|std::)'
39 Configuration[ruleName][
'exceptFilter'] = []
46 rulesNames.append(ruleName)
47 Configuration[ruleName] = {}
49 Configuration[ruleName][
'description'] =
'Search for CXXFLAGS flags that are set to -g or -O0 in BuildFile'
50 Configuration[ruleName][
'filesToMatch'] = [
'BuildFile',
'BuildFile.xml']
51 Configuration[ruleName][
'exceptPaths'] = []
52 Configuration[ruleName][
'skip'] = [comment]
53 Configuration[ruleName][
'filter'] =
'\s(CXXFLAGS|CPPFLAGS)(\+|=|\w|\"|\'|-|\s)*(-g|-O0)(\s|\'|\")'
54 Configuration[ruleName][
'exceptFilter'] = []
61 rulesNames.append(ruleName)
62 Configuration[ruleName] = {}
64 Configuration[ruleName][
'description'] =
'Search for "catch(...)" statements in *.cc, *.cxx files'
65 Configuration[ruleName][
'filesToMatch'] = [
'*.cc',
'*.cxx']
66 Configuration[ruleName][
'exceptPaths'] = [
'FWCore/*',
'EventFilter/*',
'*/*/test/*',
'*/*/bin/*']
67 Configuration[ruleName][
'skip'] = [comment]
68 Configuration[ruleName][
'filter'] =
'catch\s*\(\s*\.\.\.\s*\)'
69 Configuration[ruleName][
'exceptFilter'] = []
75 rulesNames.append(ruleName)
76 Configuration[ruleName] = {}
78 Configuration[ruleName][
'description'] =
'Search for "copyright" declaration in *.c, *.cc, *.cxx, *.h files'
79 Configuration[ruleName][
'filesToMatch'] = [
'*.h',
'*.c',
'*.cc',
'*.cxx']
80 Configuration[ruleName][
'exceptPaths'] = [
81 'FWCore/Utilities/interface/math_private.h',
82 'FWCore/Utilities/interface/md5.h',
83 'FWCore/Utilities/interface/tinyxml.h',
84 'FWCore/Utilities/src/md5.c',
85 'FWCore/Utilities/src/tinyxml.cc',
86 'FWCore/Utilities/src/tinyxmlerror.cc',
87 'FWCore/Utilities/src/tinyxmlparser.cc',
88 'DataFormats/Common/interface/Trie.h',
89 'DataFormats/Math/interface/sse_mathfun.h',
90 'EventFilter/Processor/src/procUtils.cc',
91 'CondCore/ORA/src/GenMD5.cc',
92 'PhysicsTools/JetMCUtils/interface/combination.h',
94 Configuration[ruleName][
'skip'] = []
95 Configuration[ruleName][
'filter'] =
'(\A|\W)(c|C)(o|O)(p|P)(y|Y)(r|R)(i|I)(g|G)(h|H)(t|T)\W(\+|=|\w|\"|\'|-|\s)*(\((c|C)\)|\d{4})'
96 Configuration[ruleName][
'exceptFilter'] = []
103 rulesNames.append(ruleName)
104 Configuration[ruleName] = {}
106 Configuration[ruleName][
'description'] =
'Search for "pragma" statement in *.c, *.cc, *.cxx, *.h files'
107 Configuration[ruleName][
'filesToMatch'] = [
'*.h',
'*.c',
'*.cc',
'*.cxx']
108 Configuration[ruleName][
'exceptPaths'] = [
'*/*LinkDef.h',
109 'FWCore/Utilities/interface/tinyxml.h',
110 'Utilities/StorageFactory/src/LocalFileSystem.cc:.*:#\s*pragma\s+GCC\s+diagnostic\s+ignored',
111 'RecoVertex/BeamSpotProducer/test/scripts/BSVectorDict.h',
112 'FWCore/Utilities/*/*:.*:#\s*pragma\s+GCC\s+visibility\s+(push\\(default\\)|pop)\s*$',
114 Configuration[ruleName][
'skip'] = [comment]
115 Configuration[ruleName][
'filter'] =
'#\s*pragma\s'
116 Configuration[ruleName][
'exceptFilter'] = []
121 rulesNames.append(ruleName)
122 Configuration[ruleName] = {}
124 Configuration[ruleName][
'description'] =
'Search for "flags" statements in BuildFile'
125 Configuration[ruleName][
'filesToMatch'] = [
'BuildFile',
'BuildFile.xml']
126 Configuration[ruleName][
'exceptPaths'] = [
'Utilities/RFIOAdaptor/*BuildFile.xml:.*:NO_LIB_CHECKING=',
127 'Utilities/RFIOAdaptor/*BuildFile.xml:.*:_FILE_OFFSET_BITS=',
128 'Utilities/DCacheAdaptor/*BuildFile.xml:.*:_FILE_OFFSET_BITS=',
129 'Utilities/XrdAdaptor/*BuildFile.xml:.*:_FILE_OFFSET_BITS=',
130 'Utilities/StorageFactory/*BuildFile.xml:.*:_FILE_OFFSET_BITS=',
131 'Utilities/LStoreAdaptor/BuildFile.xml:.*:_FILE_OFFSET_BITS=',
132 'DQM/EcalEndcapMonitorClient/plugins/BuildFile.xml:.*:"WITH_ECAL_COND_DB"',
133 'DQM/EcalBarrelMonitorClient/plugins/BuildFile.xml:.*:"WITH_ECAL_COND_DB"',
134 'DQM/CSCMonitorModule/*BuildFile.xml:.*:="DQMGLOBAL"',
135 'DQMServices/Core/*BuildFile.xml:.*:="-DWITHOUT_CMS_FRAMEWORK=0"',
136 'L1Trigger/CSCTrackFinder/BuildFile.xml:.*:ADD_SUBDIR=',
137 'MagneticField/Interpolation/BuildFile.xml:.*:="-Wno-format"',
138 'MagneticField/Interpolation/test/BuildFile.xml:.*:="-Wno-format"',
139 'GeneratorInterface/Pythia6Interface/plugins/BuildFile.xml:.*:LDFLAGS="\$\(PYTHIA6_BASE\)/lib/pydata.o"',
141 Configuration[ruleName][
'skip'] = [comment]
142 Configuration[ruleName][
'filter'] =
'<\s*(f|F)(l|L)(a|A)(g|G)(s|S)\s+'
143 Configuration[ruleName][
'exceptFilter'] = [
'EDM_PLUGIN',
'RIVET_PLUGIN',
'GENREFLEX_ARGS',
'TEST_RUNNER_ARGS',
'INSTALL_SCRIPTS',
'NO_TESTRUN',
'NO_EXPORT']
146 rulesDescription =
"Rule number Description\n"
147 rulesDescription +=
"----------------------------------------------------------------------------------------\n"
148 for key, value
in Configuration.items():
149 rulesDescription +=
" %s %s\n" %(key, value[
'description'])
152 helpMsg =
"-----------------------------------------------------------HELP-----------------------------------------------------------\n"
153 helpMsg +=
"cmsCodeRulesChecker.py [-h] [-html] [-s [DIRECTORY]] [-S [DIRECTORY]] [-p] [-r ruleNumber[,ruleNumber[, ...]]] [-d DIRECTORY]\n\n"
154 helpMsg +=
"-r Specifies rule or rules to be checked. After this parameter should\n be at least one rule given.\n"
155 helpMsg +=
"-d Specifies that rules should be checked in DIRECTORY. Default \n directory - current directory\n"
156 helpMsg +=
"-S Specifies to save results in python pickle files. Directory specifies\n where to store these files. Default directory - current directory\n"
157 helpMsg +=
"-s Specifies to save results in .txt files. Directory specifies where to\n store these files. Default directory - current directory\n"
158 helpMsg +=
"-p Specifies to print results into a screen\n"
159 helpMsg +=
"-h Prints help message\n"
160 helpMsg +=
"-html Reads pickle files and creates cmsCRPage.html\n\n"
161 helpMsg +=
"By default cmsCodeRulesChecker.py checks all rules in current directory and prints results into screen.\n\n"
162 helpMsg += rulesDescription