author | vrany |
Wed, 31 Oct 2012 18:31:02 +0100 | |
changeset 2966 | bf5ea36104cd |
parent 2965 | bd6117e07789 |
child 2967 | c5f1d6853ad1 |
permissions | -rw-r--r-- |
2797 | 1 |
" |
2 |
COPYRIGHT (c) 2006 by eXept Software AG |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
2707 | 12 |
"{ Package: 'stx:libbasic3' }" |
13 |
||
14 |
Object subclass:#ProjectChecker |
|
2966
bf5ea36104cd
Fix in #checkClassListConsistency - care about classes with nil superclass (Autoload/Object)
vrany
parents:
2965
diff
changeset
|
15 |
instanceVariableNames:'package packageDef classes methods problems phase' |
bf5ea36104cd
Fix in #checkClassListConsistency - care about classes with nil superclass (Autoload/Object)
vrany
parents:
2965
diff
changeset
|
16 |
classVariableNames:'' |
bf5ea36104cd
Fix in #checkClassListConsistency - care about classes with nil superclass (Autoload/Object)
vrany
parents:
2965
diff
changeset
|
17 |
poolDictionaries:'' |
bf5ea36104cd
Fix in #checkClassListConsistency - care about classes with nil superclass (Autoload/Object)
vrany
parents:
2965
diff
changeset
|
18 |
category:'System-Support-Projects' |
2707 | 19 |
! |
20 |
||
2797 | 21 |
!ProjectChecker class methodsFor:'documentation'! |
22 |
||
23 |
copyright |
|
24 |
" |
|
25 |
COPYRIGHT (c) 2006 by eXept Software AG |
|
26 |
All Rights Reserved |
|
27 |
||
28 |
This software is furnished under a license and may be used |
|
29 |
only in accordance with the terms of that license and with the |
|
30 |
inclusion of the above copyright notice. This software may not |
|
31 |
be provided or otherwise made available to, or used by, any |
|
32 |
other person. No title to or ownership of the software is |
|
33 |
hereby transferred. |
|
34 |
" |
|
2707 | 35 |
! |
36 |
||
37 |
documentation |
|
38 |
" |
|
39 |
A simple project checker that can search whole projects or individual |
|
2853 | 40 |
classes or methods for various problems that may cause build problems such |
41 |
as: |
|
42 |
- inconsistent/messed up project definition class |
|
43 |
- method code problems |
|
2707 | 44 |
|
45 |
NOTE: Not yet finished. This code is meant as a single central entry for all the |
|
46 |
source code management tools like SCM Utilities, NewSystemBrowser ets. That code |
|
2797 | 47 |
will be refactored later once this tool prooves itself useful and mature enough. |
2707 | 48 |
|
49 |
[author:] |
|
50 |
Jan Vrany <jan.vrany@fit.cvut.cz> |
|
51 |
||
52 |
[instance variables:] |
|
53 |
||
54 |
[class variables:] |
|
55 |
||
56 |
[see also:] |
|
2853 | 57 |
Tools::ProjectCheckerBrowser |
2707 | 58 |
|
59 |
" |
|
60 |
! |
|
61 |
||
62 |
examples |
|
63 |
||
64 |
" |
|
65 |
ProjectChecker check: 'stx:libbasic' |
|
2797 | 66 |
ProjectChecker check: 'stx:libtool' |
67 |
ProjectChecker check: 'stx:libbasic3' |
|
2707 | 68 |
" |
69 |
! ! |
|
70 |
||
2853 | 71 |
!ProjectChecker class methodsFor:'instance creation'! |
72 |
||
73 |
forPackage: packageId |
|
74 |
^self new |
|
75 |
package: packageId; |
|
76 |
yourself. |
|
77 |
||
78 |
"Created: / 25-07-2012 / 18:00:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2910 | 79 |
! |
80 |
||
81 |
new |
|
82 |
"return an initialized instance" |
|
83 |
||
84 |
^ self basicNew initialize. |
|
2853 | 85 |
! ! |
86 |
||
2707 | 87 |
!ProjectChecker class methodsFor:'checking'! |
88 |
||
89 |
check: package |
|
90 |
||
91 |
^self new check: package |
|
92 |
||
93 |
"Created: / 11-01-2012 / 16:46:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
94 |
! ! |
|
95 |
||
2910 | 96 |
!ProjectChecker class methodsFor:'others'! |
97 |
||
98 |
version_CVS |
|
2966
bf5ea36104cd
Fix in #checkClassListConsistency - care about classes with nil superclass (Autoload/Object)
vrany
parents:
2965
diff
changeset
|
99 |
^ '$Header: /cvs/stx/stx/libbasic3/ProjectChecker.st,v 1.10 2012-10-31 17:31:02 vrany Exp $' |
2910 | 100 |
! ! |
101 |
||
2707 | 102 |
!ProjectChecker methodsFor:'accessing'! |
103 |
||
2797 | 104 |
classes: aCollection |
105 |
classes := aCollection. |
|
106 |
||
107 |
"Created: / 13-02-2012 / 17:06:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
108 |
! |
|
109 |
||
110 |
methods |
|
111 |
^ methods |
|
112 |
! |
|
113 |
||
114 |
methods:something |
|
115 |
methods := something. |
|
116 |
! |
|
117 |
||
2707 | 118 |
package |
119 |
^ package |
|
120 |
! |
|
121 |
||
122 |
package:packageId |
|
2853 | 123 |
package := packageId asSymbol. |
124 |
||
125 |
"Modified: / 11-04-2012 / 16:00:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2797 | 126 |
! |
127 |
||
128 |
problems |
|
2853 | 129 |
^ problems |
2797 | 130 |
|
131 |
"Modified: / 23-02-2012 / 15:14:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2707 | 132 |
! ! |
133 |
||
134 |
!ProjectChecker methodsFor:'checking'! |
|
135 |
||
136 |
check |
|
137 |
||
2910 | 138 |
problems removeAll. |
2797 | 139 |
packageDef := ProjectDefinition definitionClassForPackage: package. |
140 |
packageDef isNil ifTrue:[ |
|
141 |
self addProblem: |
|
142 |
(ProjectProblem newProjectDefinitionDoesNotExist package: package). |
|
143 |
^self |
|
144 |
]. |
|
145 |
||
2707 | 146 |
self |
147 |
checkPackage; |
|
148 |
checkClasses; |
|
149 |
checkMethods |
|
150 |
||
151 |
"Created: / 11-01-2012 / 16:47:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
152 |
! |
|
153 |
||
154 |
check: package |
|
155 |
||
156 |
self package: package. |
|
157 |
self check. |
|
158 |
||
159 |
"Created: / 11-01-2012 / 16:47:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
160 |
! ! |
|
161 |
||
162 |
!ProjectChecker methodsFor:'checks-individual'! |
|
163 |
||
164 |
checkClassListConsistency |
|
165 |
"Checks whether all classes listed in #classNamesAndAttributes are present |
|
166 |
and if all present classes are listed" |
|
167 |
||
2910 | 168 |
|classesInImage classesInDescription classesInDescriptionChecked onlyInDescription| |
2707 | 169 |
"WARNING: Copy/paste of ProjectDefinition>>validateDescription" |
170 |
||
171 |
classesInImage := Smalltalk allClasses select:[:cls | (cls package = self package) and:[cls isPrivate not]]. |
|
172 |
"/ classesInDescription := self classes asIdentitySet. |
|
2910 | 173 |
classesInDescription := OrderedCollection new. |
2707 | 174 |
((packageDef compiled_classNamesForPlatform:(OperatingSystem platformName)) |
175 |
, (packageDef compiled_classNames_common) |
|
176 |
, (packageDef autoloaded_classNames)) do:[:nm | |
|
177 |
|cls| |
|
178 |
||
179 |
cls := Smalltalk at:nm asSymbol. |
|
180 |
cls isNil ifTrue:[ |
|
2797 | 181 |
self addProblem: |
182 |
(ProjectProblem newClassListedButDoesNotExist className: nm) |
|
2707 | 183 |
] ifFalse:[ |
184 |
classesInDescription add:cls. |
|
185 |
]. |
|
186 |
]. |
|
187 |
||
2910 | 188 |
classesInDescriptionChecked := OrderedCollection new. |
2707 | 189 |
classesInDescription do:[:eachClass | |
2910 | 190 |
(classesInDescriptionChecked includes: eachClass) ifTrue:[ |
191 |
self addProblem: |
|
192 |
(ProjectProblem newClassListedMultipleTimes |
|
193 |
className: eachClass name) |
|
194 |
]. |
|
195 |
||
2707 | 196 |
eachClass sharedPoolNames do:[:eachPoolName | |
197 |
|pool| |
|
198 |
||
199 |
pool := eachClass nameSpace classNamed:eachPoolName. |
|
200 |
pool isNil ifTrue:[ |
|
201 |
eachClass nameSpace ~~ Smalltalk ifTrue:[ |
|
202 |
pool := Smalltalk classNamed:eachPoolName. |
|
203 |
] |
|
204 |
]. |
|
205 |
pool isNil ifTrue:[ |
|
2797 | 206 |
self addProblem: |
207 |
(ProjectProblem newClassUsesPoolButItDoesNotExist |
|
208 |
className: eachClass name; |
|
209 |
poolName: eachPoolName). |
|
2707 | 210 |
] ifFalse:[ |
211 |
pool isSharedPool ifFalse:[ |
|
2797 | 212 |
self addProblem: |
213 |
(ProjectProblem newClassUsesPoolButItIsNotASharedPool |
|
214 |
className: eachClass name; |
|
215 |
poolName: eachPoolName). |
|
2707 | 216 |
]. |
217 |
]. |
|
218 |
]. |
|
2910 | 219 |
|
2966
bf5ea36104cd
Fix in #checkClassListConsistency - care about classes with nil superclass (Autoload/Object)
vrany
parents:
2965
diff
changeset
|
220 |
(eachClass superclass notNil "/Care about classes with nil superclass - Object & Autoload |
bf5ea36104cd
Fix in #checkClassListConsistency - care about classes with nil superclass (Autoload/Object)
vrany
parents:
2965
diff
changeset
|
221 |
and:[eachClass superclass package == eachClass package]) ifTrue:[ |
2910 | 222 |
(classesInDescriptionChecked includes: eachClass superclass) ifFalse:[ |
223 |
self addProblem: |
|
224 |
(ProjectProblem newClassListedBeforeItsSuperclass |
|
225 |
className: eachClass name; |
|
226 |
superClassName: eachClass superclass name) |
|
227 |
]. |
|
228 |
]. |
|
229 |
eachClass sharedPools do:[:eachPool| |
|
230 |
eachPool package == eachClass package ifTrue:[ |
|
231 |
(classesInDescriptionChecked includes: eachPool) ifFalse:[ |
|
232 |
self addProblem: |
|
233 |
(ProjectProblem newClassListedBeforeItsPool |
|
234 |
className: eachClass name; |
|
235 |
poolName: eachPool name) |
|
236 |
]. |
|
237 |
]. |
|
238 |
]. |
|
239 |
||
240 |
classesInDescriptionChecked add: eachClass. |
|
2707 | 241 |
]. |
242 |
||
243 |
classesInImage ~= classesInDescription ifTrue:[ |
|
2856
a1cee28488c0
changed: #checkClassListConsistency - do not warn about not-listed classes twice
vrany
parents:
2853
diff
changeset
|
244 |
"This is done later in checkClassesListedInProjectDefinition:" |
a1cee28488c0
changed: #checkClassListConsistency - do not warn about not-listed classes twice
vrany
parents:
2853
diff
changeset
|
245 |
"/ onlyInImage := (classesInImage reject:[:cls | classesInDescription includes:cls]). |
a1cee28488c0
changed: #checkClassListConsistency - do not warn about not-listed classes twice
vrany
parents:
2853
diff
changeset
|
246 |
"/ onlyInImage do:[:cls| |
a1cee28488c0
changed: #checkClassListConsistency - do not warn about not-listed classes twice
vrany
parents:
2853
diff
changeset
|
247 |
"/ self addProblem: |
a1cee28488c0
changed: #checkClassListConsistency - do not warn about not-listed classes twice
vrany
parents:
2853
diff
changeset
|
248 |
"/ (ProjectProblem newClassNotListed className: cls name). |
a1cee28488c0
changed: #checkClassListConsistency - do not warn about not-listed classes twice
vrany
parents:
2853
diff
changeset
|
249 |
"/ ]. |
2707 | 250 |
onlyInDescription := (classesInDescription reject:[:cls | classesInImage includes:cls]). |
251 |
onlyInDescription do:[:cls| |
|
2797 | 252 |
self addProblem: |
253 |
(ProjectProblem newClassListedButDoesNotExist className: cls name) |
|
2707 | 254 |
]. |
255 |
]. |
|
256 |
||
257 |
"Created: / 11-01-2012 / 17:14:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2966
bf5ea36104cd
Fix in #checkClassListConsistency - care about classes with nil superclass (Autoload/Object)
vrany
parents:
2965
diff
changeset
|
258 |
"Modified: / 26-10-2012 / 12:59:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2718 | 259 |
! |
260 |
||
2910 | 261 |
checkClassesForMethodsInNoProject:classesToCheck |
262 |
| checker | |
|
263 |
||
264 |
checker := [:cls | |
|
265 |
cls |
|
266 |
selectorsAndMethodsDo:[:sel :mth | |
|
267 |
(mth package isNil or:[ mth package == PackageId noProjectID ]) ifTrue:[ |
|
268 |
"Sigh, special hack for Expecco" |
|
269 |
((cls name = 'Expecco::AbstractApplication class' and:[ sel = 'flags' ]) or:[ |
|
270 |
(cls name = 'Expecco::Browser class' and:[ sel = 'flags' ])]) ifFalse:[ |
|
271 |
self addProblem:(ProjectProblem newMethodInNoPackage className:cls name |
|
272 |
selector:sel). |
|
273 |
] |
|
274 |
] |
|
275 |
] |
|
276 |
]. |
|
277 |
classesToCheck do:[:class | |
|
278 |
checker value:class theMetaclass. |
|
279 |
checker value:class theNonMetaclass. |
|
280 |
] |
|
281 |
||
282 |
"Created: / 13-02-2012 / 18:18:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
283 |
! |
|
284 |
||
285 |
checkClassesForNonQualifiedSharedPools: classesToCheck |
|
286 |
||
287 |
classesToCheck do:[:cls| |
|
288 |
cls sharedPoolNames do:[:poolName| |
|
289 |
(Smalltalk at: poolName asSymbol) isNil ifTrue:[ |
|
290 |
| ns | |
|
291 |
||
292 |
ns := cls nameSpace. |
|
293 |
(ns ~~ Smalltalk and:[(ns at: poolName asSymbol) notNil]) ifTrue:[ |
|
294 |
self addProblem: |
|
295 |
(ProjectProblem newClassUsesPoolButItIsNotASharedPool |
|
296 |
className: cls name; |
|
297 |
poolName: poolName) |
|
298 |
] |
|
299 |
] |
|
300 |
] |
|
301 |
]. |
|
302 |
||
303 |
"Created: / 13-09-2012 / 16:34:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
304 |
! |
|
305 |
||
2797 | 306 |
checkClassesListedInProjectDefinition: classesToCheck |
307 |
||
308 |
| classNamesListed | |
|
309 |
||
310 |
classNamesListed := packageDef classNames. |
|
311 |
||
312 |
classesToCheck do:[:class| |
|
313 |
(class isPrivate not and:[(classNamesListed includes: class name) not]) ifTrue:[ |
|
314 |
self addProblem: |
|
315 |
(ProjectProblem newClassNotListed className: class name). |
|
316 |
] |
|
317 |
]. |
|
318 |
||
319 |
"Created: / 13-02-2012 / 18:18:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
320 |
! |
|
321 |
||
2718 | 322 |
checkExtensionsListConsistency |
323 |
"Checks whether all extensions listed in #extensionMethodNames are present |
|
324 |
and if all extension methods are listed" |
|
325 |
||
326 |
| extensionsListed extensionsPresent | |
|
327 |
||
328 |
extensionsListed := OrderedCollection new. |
|
329 |
packageDef extensionMethodNames pairWiseDo:[:cls :sel| |
|
330 |
extensionsListed add: (Array with: cls with: sel) |
|
331 |
]. |
|
332 |
extensionsPresent := OrderedCollection new. |
|
333 |
packageDef searchForExtensions do:[:each| |
|
2910 | 334 |
"JV@2012-09-07: Do not take Java methods into an account, they |
335 |
should not be listed in extensionMethodNames. |
|
336 |
They are loaded lazily by JavaClassReader and if listed here, |
|
337 |
they would cause an error if the package is loaded from source. |
|
338 |
Sort of a HACK, indeed" |
|
339 |
each mclass isJavaClass ifFalse:[ |
|
340 |
extensionsPresent add: (Array with: each mclass name with: each selector) |
|
341 |
]. |
|
2718 | 342 |
]. |
343 |
||
344 |
(extensionsListed \ extensionsPresent) do:[:clsAndSel| |
|
2797 | 345 |
self addProblem: |
346 |
(ProjectProblem newExtensionMethodListedButDoesNotExist |
|
347 |
className: clsAndSel first selector: clsAndSel second). |
|
2718 | 348 |
]. |
349 |
||
350 |
(extensionsPresent \ extensionsListed) do:[:clsAndSel| |
|
2797 | 351 |
self addProblem: |
352 |
(ProjectProblem newExtensionMethodNotListed |
|
353 |
className: clsAndSel first selector: clsAndSel second). |
|
2718 | 354 |
]. |
355 |
||
356 |
"Created: / 12-01-2012 / 12:31:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
357 |
! |
|
358 |
||
359 |
checkExtensionsPrerequisites |
|
360 |
"Checks whether packages of all extensions method classes are listed |
|
361 |
in package prerequisites" |
|
362 |
||
363 |
packageDef searchForExtensions do:[:mthd| |
|
364 |
(packageDef preRequisites includes: mthd mclass package) ifFalse:[ |
|
2797 | 365 |
"/ self problem: ('%3 required by extension method but not in prerequisites' bindWith: mthd mclass package) |
366 |
"/ description: ('An extension method %1>>%2 extends class in package %3 but the package is not listed in package''s prerequisited. This leads into missing methods and strange bugs when application is compiled and run!!' bindWith: mthd class with: mthd selector with: mthd class package) |
|
367 |
"/ severity: #error data: mthd |
|
2718 | 368 |
]. |
369 |
] |
|
370 |
||
371 |
"Created: / 12-01-2012 / 12:41:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2797 | 372 |
! |
373 |
||
2853 | 374 |
checkMethodCodingStyle: method |
375 |
"Checks for various coding style violations such as 'self halt' or |
|
376 |
improper indentation :-)" |
|
377 |
||
378 |
"To be implemented" |
|
379 |
||
380 |
"Created: / 11-04-2012 / 12:38:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
381 |
! |
|
382 |
||
383 |
checkMethodSTCCompilability1: method into: problem |
|
384 |
"Checks is the method can be compiled by STC based on Parser error/warnings" |
|
385 |
||
386 |
| lang | |
|
387 |
lang := method programmingLanguage. |
|
388 |
lang isSmalltalk ifFalse:[ ^ self ]. |
|
389 |
||
390 |
lang compilerClass new |
|
391 |
compile:method source |
|
392 |
forClass:method mclass |
|
393 |
inCategory:'others' |
|
394 |
notifying:problem |
|
395 |
install:false |
|
396 |
skipIfSame:false |
|
397 |
silent:false |
|
398 |
foldConstants:true |
|
399 |
ifFail:[ ] |
|
400 |
||
401 |
"Created: / 11-04-2012 / 15:31:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
402 |
! |
|
403 |
||
404 |
checkMethodSTCCompilability2: method into: problem |
|
405 |
"Checks is the method can be compiled by STC based on selected lint rules" |
|
406 |
||
407 |
"Not yet implemented" |
|
408 |
||
409 |
"Created: / 11-04-2012 / 15:54:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
410 |
! |
|
411 |
||
412 |
checkMethodSTCCompilability: method |
|
413 |
"Checks is the method can be compiled by STC (since STC won't compile |
|
414 |
everything bytecode compiler/jit compiler does, sigh" |
|
415 |
||
416 |
| issue | |
|
417 |
||
418 |
"No need to check the method if the class is autoloaded" |
|
419 |
(packageDef autoloaded_classNames includes: method mclass theNonMetaclass name) ifTrue:[ |
|
420 |
^ self |
|
421 |
]. |
|
422 |
||
423 |
issue := ProjectProblem newMethodCompilabilityIssue. |
|
424 |
issue method: method. |
|
425 |
self checkMethodSTCCompilability1: method into: issue. |
|
426 |
self checkMethodSTCCompilability2: method into: issue. |
|
427 |
issue hasIssue ifTrue:[ |
|
428 |
self addProblem: issue |
|
429 |
] |
|
430 |
||
431 |
"Created: / 11-04-2012 / 12:37:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
432 |
! |
|
433 |
||
434 |
checkMethodSourceCode: method |
|
435 |
"Checks, whether method's source code is both |
|
436 |
available and parseable. Return true if the code |
|
2966
bf5ea36104cd
Fix in #checkClassListConsistency - care about classes with nil superclass (Autoload/Object)
vrany
parents:
2965
diff
changeset
|
437 |
is syntactically correct, false otherwise" |
2853 | 438 |
|
439 |
| source | |
|
440 |
||
441 |
[ |
|
442 |
source := method source. |
|
443 |
] on: Error do:[ |
|
444 |
self addProblem: |
|
445 |
(ProjectProblem newMethodSourceNotAvailable method: method). |
|
446 |
^false |
|
447 |
]. |
|
2913 | 448 |
method programmingLanguage isSmalltalk ifFalse:[ ^ false ]. |
449 |
||
2853 | 450 |
[ |
451 |
(Parser parseMethod: method source) == #Error ifTrue:[ |
|
452 |
self addProblem: |
|
453 |
(ProjectProblem newMethodSourceCorrupted method: method). |
|
454 |
^false. |
|
455 |
] |
|
456 |
] on: Error do:[ |
|
457 |
self addProblem: |
|
458 |
(ProjectProblem newMethodSourceCorrupted method: method). |
|
459 |
^false. |
|
460 |
]. |
|
461 |
||
462 |
^true |
|
463 |
||
464 |
"Created: / 11-04-2012 / 12:29:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2707 | 465 |
! ! |
466 |
||
467 |
!ProjectChecker methodsFor:'checks-private'! |
|
468 |
||
469 |
checkClasses |
|
2797 | 470 |
|
471 |
classes notNil ifTrue:[ |
|
472 |
self checkClasses: classes |
|
473 |
] ifFalse:[ |
|
474 |
self checkClasses: (Smalltalk allClasses select:[:cls | (cls package = self package)]). |
|
475 |
]. |
|
2707 | 476 |
|
477 |
"Created: / 11-01-2012 / 16:55:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
478 |
! |
|
479 |
||
2797 | 480 |
checkClasses: classesToCheck |
481 |
||
482 |
self checkClassesListedInProjectDefinition: classesToCheck. |
|
2910 | 483 |
self checkClassesForMethodsInNoProject:classesToCheck. |
484 |
self checkClassesForNonQualifiedSharedPools:classesToCheck. |
|
2797 | 485 |
|
486 |
"Created: / 13-02-2012 / 18:18:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
487 |
! |
|
488 |
||
2853 | 489 |
checkMethod: method |
490 |
||
491 |
(self checkMethodSourceCode: method) ifTrue:[ |
|
492 |
"/OK, method's source is OK, perform further checks |
|
493 |
self checkMethodSTCCompilability: method. |
|
494 |
self checkMethodCodingStyle: method. |
|
495 |
] |
|
496 |
||
497 |
"Created: / 11-04-2012 / 12:27:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
498 |
! |
|
499 |
||
2707 | 500 |
checkMethods |
2853 | 501 |
|
502 |
methods notEmptyOrNil ifTrue:[ |
|
503 |
self checkMethods: methods. |
|
504 |
^self. |
|
505 |
]. |
|
506 |
||
507 |
self checkMethods: |
|
508 |
(Iterator on:[:whatToDo| |
|
509 |
(classes notNil ifTrue:[classes] ifFalse:[Smalltalk allClasses]) do:[:cls| |
|
510 |
cls theNonMetaclass withAllPrivateClassesDo:[:each | |
|
511 |
each instAndClassSelectorsAndMethodsDo:[:s :m | m package = package ifTrue:[whatToDo value:m]] |
|
512 |
]. |
|
513 |
] |
|
514 |
]) |
|
2707 | 515 |
|
516 |
"Created: / 11-01-2012 / 16:55:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
517 |
! |
|
518 |
||
2853 | 519 |
checkMethods: methodsToCheck |
520 |
||
521 |
methodsToCheck do:[:m|self checkMethod: m]. |
|
522 |
||
523 |
"Created: / 11-04-2012 / 12:16:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
524 |
! |
|
525 |
||
2707 | 526 |
checkPackage |
527 |
||
2716
9a74597bcd4b
Do not use annotations as stc crashes when compiling them
vrany
parents:
2707
diff
changeset
|
528 |
self checkClassListConsistency. |
2718 | 529 |
self checkExtensionsListConsistency. |
530 |
self checkExtensionsPrerequisites. |
|
531 |
||
2716
9a74597bcd4b
Do not use annotations as stc crashes when compiling them
vrany
parents:
2707
diff
changeset
|
532 |
"add more here..." |
2707 | 533 |
|
534 |
"Created: / 11-01-2012 / 16:55:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
535 |
! ! |
|
536 |
||
2910 | 537 |
!ProjectChecker methodsFor:'initialization'! |
538 |
||
539 |
initialize |
|
540 |
"Invoked when a new instance is created." |
|
541 |
||
542 |
"/ please change as required (and remove this comment) |
|
543 |
"/ package := nil. |
|
544 |
"/ packageDef := nil. |
|
545 |
"/ classes := nil. |
|
546 |
"/ methods := nil. |
|
547 |
problems := List new. |
|
548 |
"/ phase := nil. |
|
549 |
||
550 |
"/ super initialize. -- commented since inherited method does nothing |
|
551 |
||
552 |
"Modified: / 13-09-2012 / 17:24:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
553 |
! ! |
|
554 |
||
2707 | 555 |
!ProjectChecker methodsFor:'reporting'! |
556 |
||
2797 | 557 |
addProblem: aProjectProblem |
558 |
aProjectProblem package: self package. |
|
2707 | 559 |
problems isNil ifTrue:[problems := OrderedCollection new]. |
2797 | 560 |
problems add: aProjectProblem |
2707 | 561 |
|
2797 | 562 |
"Created: / 23-02-2012 / 13:10:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2718 | 563 |
! ! |
564 |
||
2707 | 565 |
!ProjectChecker class methodsFor:'documentation'! |
566 |
||
567 |
version |
|
2966
bf5ea36104cd
Fix in #checkClassListConsistency - care about classes with nil superclass (Autoload/Object)
vrany
parents:
2965
diff
changeset
|
568 |
^ '$Header: /cvs/stx/stx/libbasic3/ProjectChecker.st,v 1.10 2012-10-31 17:31:02 vrany Exp $' |
2707 | 569 |
! |
570 |
||
2797 | 571 |
version_SVN |
2966
bf5ea36104cd
Fix in #checkClassListConsistency - care about classes with nil superclass (Autoload/Object)
vrany
parents:
2965
diff
changeset
|
572 |
^ '§Id: ProjectChecker.st 1971 2012-09-27 19:37:25Z vranyj1 §' |
2707 | 573 |
! ! |