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*$',
113 'CondFormats/JetMETObjects/interface/Linkdef.h',
114 'DataFormats/GeometryVector/interface/Basic3DVectorLD.h',
115 'DataFormats/Scalers/interface/ScalersRaw.h',
116 'FWCore/MessageService/plugins/Module.cc',
117 'GeneratorInterface/RivetInterface/plugins/tinyxml.h',
118 'PerfTools/Callgrind/plugins/CallgrindAnalyzer.cc',
119 'PerfTools/Callgrind/src/ProfilerService.cc',
120 'RecoTracker/TkDetLayers/src/BladeShapeBuilderFromDet.h',
121 'RecoTracker/TkDetLayers/src/BoundDiskSector.h',
122 'RecoTracker/TkDetLayers/src/CompatibleDetToGroupAdder.h',
123 'RecoTracker/TkDetLayers/src/CompositeTECPetal.h',
124 'RecoTracker/TkDetLayers/src/CompositeTECWedge.h',
125 'RecoTracker/TkDetLayers/src/DetGroupMerger.h',
126 'RecoTracker/TkDetLayers/src/DiskSectorBounds.h',
127 'RecoTracker/TkDetLayers/src/ForwardDiskSectorBuilderFromDet.h',
128 'RecoTracker/TkDetLayers/src/ForwardDiskSectorBuilderFromWedges.h',
129 'RecoTracker/TkDetLayers/src/GlobalDetRodRangeZPhi.h',
130 'RecoTracker/TkDetLayers/src/LayerCrossingSide.h',
131 'RecoTracker/TkDetLayers/src/PixelBarrelLayerBuilder.h',
132 'RecoTracker/TkDetLayers/src/PixelBarrelLayer.h',
133 'RecoTracker/TkDetLayers/src/PixelBladeBuilder.h',
134 'RecoTracker/TkDetLayers/src/PixelBlade.h',
135 'RecoTracker/TkDetLayers/src/PixelForwardLayerBuilder.h',
136 'RecoTracker/TkDetLayers/src/PixelForwardLayer.h',
137 'RecoTracker/TkDetLayers/src/PixelForwardLayerPhase1.h',
138 'RecoTracker/TkDetLayers/src/PixelRodBuilder.h',
139 'RecoTracker/TkDetLayers/src/PixelRod.h',
140 'RecoTracker/TkDetLayers/src/SimpleTECWedge.h',
141 'RecoTracker/TkDetLayers/src/SubLayerCrossings.h',
142 'RecoTracker/TkDetLayers/src/TECLayerBuilder.h',
143 'RecoTracker/TkDetLayers/src/TECLayer.h',
144 'RecoTracker/TkDetLayers/src/TECPetalBuilder.h',
145 'RecoTracker/TkDetLayers/src/TECPetal.h',
146 'RecoTracker/TkDetLayers/src/TECWedgeBuilder.h',
147 'RecoTracker/TkDetLayers/src/TECWedge.h',
148 'RecoTracker/TkDetLayers/src/TIBLayerBuilder.h',
149 'RecoTracker/TkDetLayers/src/TIBLayer.h',
150 'RecoTracker/TkDetLayers/src/TIBRingBuilder.h',
151 'RecoTracker/TkDetLayers/src/TIBRing.h',
152 'RecoTracker/TkDetLayers/src/TIDLayerBuilder.h',
153 'RecoTracker/TkDetLayers/src/TIDLayer.h',
154 'RecoTracker/TkDetLayers/src/TIDRingBuilder.h',
155 'RecoTracker/TkDetLayers/src/TkDetUtil.h',
156 'RecoTracker/TkDetLayers/src/TkGeomDetCompatibilityChecker.h',
157 'RecoTracker/TkDetLayers/src/TOBLayerBuilder.h',
158 'RecoTracker/TkDetLayers/src/TOBLayer.h',
159 'RecoTracker/TkDetLayers/src/TOBRodBuilder.h',
160 'RecoTracker/TkDetLayers/src/TOBRod.h',
161 'RecoTracker/TkDetLayers/src/TIDRing.h',
163 Configuration[ruleName][
'skip'] = [comment]
164 Configuration[ruleName][
'filter'] =
'#\s*pragma\s'
165 Configuration[ruleName][
'exceptFilter'] = []
170 rulesNames.append(ruleName)
171 Configuration[ruleName] = {}
173 Configuration[ruleName][
'description'] =
'Search for "flags" statements in BuildFile'
174 Configuration[ruleName][
'filesToMatch'] = [
'BuildFile',
'BuildFile.xml']
175 Configuration[ruleName][
'exceptPaths'] = [
'Utilities/RFIOAdaptor/*BuildFile.xml:.*:NO_LIB_CHECKING=',
176 'Utilities/RFIOAdaptor/*BuildFile.xml:.*:_FILE_OFFSET_BITS=',
177 'Utilities/DCacheAdaptor/*BuildFile.xml:.*:_FILE_OFFSET_BITS=',
178 'Utilities/XrdAdaptor/*BuildFile.xml:.*:_FILE_OFFSET_BITS=',
179 'Utilities/StorageFactory/*BuildFile.xml:.*:_FILE_OFFSET_BITS=',
180 'Utilities/LStoreAdaptor/BuildFile.xml:.*:_FILE_OFFSET_BITS=',
181 'DQM/EcalEndcapMonitorClient/plugins/BuildFile.xml:.*:"WITH_ECAL_COND_DB"',
182 'DQM/EcalBarrelMonitorClient/plugins/BuildFile.xml:.*:"WITH_ECAL_COND_DB"',
183 'DQM/CSCMonitorModule/*BuildFile.xml:.*:="DQMGLOBAL"',
184 'DQMServices/Core/*BuildFile.xml:.*:="-DWITHOUT_CMS_FRAMEWORK=0"',
185 'L1Trigger/CSCTrackFinder/BuildFile.xml:.*:ADD_SUBDIR=',
186 'MagneticField/Interpolation/BuildFile.xml:.*:="-Wno-format"',
187 'MagneticField/Interpolation/test/BuildFile.xml:.*:="-Wno-format"',
188 'GeneratorInterface/Pythia6Interface/plugins/BuildFile.xml:.*:LDFLAGS="\$\(PYTHIA6_BASE\)/lib/pydata.o"',
190 Configuration[ruleName][
'skip'] = [comment]
191 Configuration[ruleName][
'filter'] =
'<\s*(f|F)(l|L)(a|A)(g|G)(s|S)\s+'
192 Configuration[ruleName][
'exceptFilter'] = [
'EDM_PLUGIN',
'RIVET_PLUGIN',
'GENREFLEX_ARGS',
'TEST_RUNNER_ARGS',
'INSTALL_SCRIPTS',
'NO_TESTRUN',
'NO_EXPORT']
195 rulesDescription =
"Rule number Description\n"
196 rulesDescription +=
"----------------------------------------------------------------------------------------\n"
197 for key, value
in Configuration.items():
198 rulesDescription +=
" %s %s\n" %(key, value[
'description'])
201 helpMsg =
"-----------------------------------------------------------HELP-----------------------------------------------------------\n"
202 helpMsg +=
"cmsCodeRulesChecker.py [-h] [-html] [-s [DIRECTORY]] [-S [DIRECTORY]] [-p] [-r ruleNumber[,ruleNumber[, ...]]] [-d DIRECTORY]\n\n"
203 helpMsg +=
"-r Specifies rule or rules to be checked. After this parameter should\n be at least one rule given.\n"
204 helpMsg +=
"-d Specifies that rules should be checked in DIRECTORY. Default \n directory - current directory\n"
205 helpMsg +=
"-S Specifies to save results in python pickle files. Directory specifies\n where to store these files. Default directory - current directory\n"
206 helpMsg +=
"-s Specifies to save results in .txt files. Directory specifies where to\n store these files. Default directory - current directory\n"
207 helpMsg +=
"-p Specifies to print results into a screen\n"
208 helpMsg +=
"-h Prints help message\n"
209 helpMsg +=
"-html Reads pickle files and creates cmsCRPage.html\n\n"
210 helpMsg +=
"By default cmsCodeRulesChecker.py checks all rules in current directory and prints results into screen.\n\n"
211 helpMsg += rulesDescription