author | Merge Script |
Fri, 04 Sep 2015 06:42:32 +0200 | |
branch | jv |
changeset 3895 | 7236976df613 |
parent 3838 | 474d8ec95b33 |
parent 3894 | 5ace68ac540e |
child 3936 | 669dd820f259 |
permissions | -rw-r--r-- |
3894 | 1 |
"{ Encoding: utf8 }" |
2 |
||
2798 | 3 |
" |
4 |
COPYRIGHT (c) 2006 by eXept Software AG |
|
3779 | 5 |
All Rights Reserved |
2798 | 6 |
|
7 |
This software is furnished under a license and may be used |
|
8 |
only in accordance with the terms of that license and with the |
|
9 |
inclusion of the above copyright notice. This software may not |
|
10 |
be provided or otherwise made available to, or used by, any |
|
11 |
other person. No title to or ownership of the software is |
|
12 |
hereby transferred. |
|
13 |
" |
|
14 |
"{ Package: 'stx:libbasic3' }" |
|
15 |
||
3775 | 16 |
"{ NameSpace: Smalltalk }" |
17 |
||
2798 | 18 |
Object subclass:#ProjectProblem |
3790 | 19 |
instanceVariableNames:'package fixes allProblems' |
20 |
classVariableNames:'' |
|
21 |
poolDictionaries:'' |
|
22 |
category:'System-Support-Projects' |
|
2798 | 23 |
! |
24 |
||
25 |
ProjectProblem subclass:#ClassProblem |
|
3790 | 26 |
instanceVariableNames:'className' |
27 |
classVariableNames:'' |
|
28 |
poolDictionaries:'' |
|
29 |
privateIn:ProjectProblem |
|
2798 | 30 |
! |
31 |
||
3160 | 32 |
ProjectProblem::ClassProblem subclass:#InconsistentProjectDefinition |
3790 | 33 |
instanceVariableNames:'' |
34 |
classVariableNames:'' |
|
35 |
poolDictionaries:'' |
|
36 |
privateIn:ProjectProblem |
|
2798 | 37 |
! |
38 |
||
3449 | 39 |
ProjectProblem::InconsistentProjectDefinition subclass:#ClassListedBeforeItsPool |
3790 | 40 |
instanceVariableNames:'poolName' |
41 |
classVariableNames:'' |
|
42 |
poolDictionaries:'' |
|
43 |
privateIn:ProjectProblem |
|
3449 | 44 |
! |
45 |
||
46 |
ProjectProblem::InconsistentProjectDefinition subclass:#ClassListedBeforeItsSuperclass |
|
3790 | 47 |
instanceVariableNames:'superClassName' |
48 |
classVariableNames:'' |
|
49 |
poolDictionaries:'' |
|
50 |
privateIn:ProjectProblem |
|
3449 | 51 |
! |
52 |
||
3160 | 53 |
ProjectProblem::InconsistentProjectDefinition subclass:#ClassListedButDoesNotExist |
3790 | 54 |
instanceVariableNames:'' |
55 |
classVariableNames:'' |
|
56 |
poolDictionaries:'' |
|
57 |
privateIn:ProjectProblem |
|
2798 | 58 |
! |
59 |
||
3806 | 60 |
ProjectProblem::InconsistentProjectDefinition subclass:#ClassListedButInOtherPackage |
61 |
instanceVariableNames:'' |
|
62 |
classVariableNames:'' |
|
63 |
poolDictionaries:'' |
|
64 |
privateIn:ProjectProblem |
|
65 |
! |
|
66 |
||
3160 | 67 |
ProjectProblem::InconsistentProjectDefinition subclass:#ClassListedMultipleTimes |
3790 | 68 |
instanceVariableNames:'' |
69 |
classVariableNames:'' |
|
70 |
poolDictionaries:'' |
|
71 |
privateIn:ProjectProblem |
|
2911 | 72 |
! |
73 |
||
3160 | 74 |
ProjectProblem::InconsistentProjectDefinition subclass:#ClassNotListed |
3790 | 75 |
instanceVariableNames:'' |
76 |
classVariableNames:'' |
|
77 |
poolDictionaries:'' |
|
78 |
privateIn:ProjectProblem |
|
2911 | 79 |
! |
80 |
||
3449 | 81 |
ProjectProblem::InconsistentProjectDefinition subclass:#ClassIsCompiledButSuperclassIsAutoloaded |
3790 | 82 |
instanceVariableNames:'' |
83 |
classVariableNames:'' |
|
84 |
poolDictionaries:'' |
|
85 |
privateIn:ProjectProblem |
|
2798 | 86 |
! |
87 |
||
3588 | 88 |
ProjectProblem::InconsistentProjectDefinition subclass:#ClassShouldNotBeInPackage |
3790 | 89 |
instanceVariableNames:'' |
90 |
classVariableNames:'' |
|
91 |
poolDictionaries:'' |
|
92 |
privateIn:ProjectProblem |
|
3588 | 93 |
! |
94 |
||
2911 | 95 |
ProjectProblem::ClassProblem subclass:#ClassUsesPoolProblem |
3790 | 96 |
instanceVariableNames:'poolName' |
97 |
classVariableNames:'' |
|
98 |
poolDictionaries:'' |
|
99 |
privateIn:ProjectProblem |
|
2798 | 100 |
! |
101 |
||
2911 | 102 |
ProjectProblem::ClassUsesPoolProblem subclass:#ClassUsesPoolButItIsNotASharedPool |
3790 | 103 |
instanceVariableNames:'' |
104 |
classVariableNames:'' |
|
105 |
poolDictionaries:'' |
|
106 |
privateIn:ProjectProblem |
|
2911 | 107 |
! |
108 |
||
109 |
ProjectProblem::ClassUsesPoolProblem subclass:#ClassUsesPoolInNamespaceButNamespaceIsNotDefined |
|
3790 | 110 |
instanceVariableNames:'' |
111 |
classVariableNames:'' |
|
112 |
poolDictionaries:'' |
|
113 |
privateIn:ProjectProblem |
|
2911 | 114 |
! |
115 |
||
116 |
ProjectProblem::ClassUsesPoolProblem subclass:#ClassUsesPoolButItDoesNotExist |
|
3790 | 117 |
instanceVariableNames:'' |
118 |
classVariableNames:'' |
|
119 |
poolDictionaries:'' |
|
120 |
privateIn:ProjectProblem |
|
2911 | 121 |
! |
122 |
||
2854 | 123 |
ProjectProblem::ClassProblem subclass:#MethodProblem |
3790 | 124 |
instanceVariableNames:'selector' |
125 |
classVariableNames:'' |
|
126 |
poolDictionaries:'' |
|
127 |
privateIn:ProjectProblem |
|
2798 | 128 |
! |
129 |
||
3166 | 130 |
ProjectProblem::MethodProblem subclass:#ExtensionMethodListedButInDifferentPackage |
3790 | 131 |
instanceVariableNames:'' |
132 |
classVariableNames:'' |
|
133 |
poolDictionaries:'' |
|
134 |
privateIn:ProjectProblem |
|
3166 | 135 |
! |
136 |
||
2798 | 137 |
ProjectProblem::MethodProblem subclass:#ExtensionMethodNotListed |
3790 | 138 |
instanceVariableNames:'' |
139 |
classVariableNames:'' |
|
140 |
poolDictionaries:'' |
|
141 |
privateIn:ProjectProblem |
|
2798 | 142 |
! |
143 |
||
3166 | 144 |
ProjectProblem::MethodProblem subclass:#ExtensionMethodsClassDoesNotExist |
3790 | 145 |
instanceVariableNames:'' |
146 |
classVariableNames:'' |
|
147 |
poolDictionaries:'' |
|
148 |
privateIn:ProjectProblem |
|
3166 | 149 |
! |
150 |
||
3449 | 151 |
ProjectProblem::InconsistentProjectDefinition subclass:#ClassIsCompiledButSuperclassProjectDefinitionIsMissing |
3790 | 152 |
instanceVariableNames:'' |
153 |
classVariableNames:'' |
|
154 |
poolDictionaries:'' |
|
155 |
privateIn:ProjectProblem |
|
3160 | 156 |
! |
157 |
||
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
158 |
ProjectProblem::MethodProblem subclass:#MethodCompilabilityIssue1 |
3790 | 159 |
instanceVariableNames:'errors warnings' |
160 |
classVariableNames:'' |
|
161 |
poolDictionaries:'' |
|
162 |
privateIn:ProjectProblem |
|
2854 | 163 |
! |
164 |
||
165 |
Object subclass:#Error |
|
3790 | 166 |
instanceVariableNames:'message startPosition endPosition' |
167 |
classVariableNames:'' |
|
168 |
poolDictionaries:'' |
|
169 |
privateIn:ProjectProblem::MethodCompilabilityIssue1 |
|
2854 | 170 |
! |
171 |
||
172 |
Object subclass:#Warning |
|
3790 | 173 |
instanceVariableNames:'message startPosition endPosition' |
174 |
classVariableNames:'' |
|
175 |
poolDictionaries:'' |
|
176 |
privateIn:ProjectProblem::MethodCompilabilityIssue1 |
|
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
177 |
! |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
178 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
179 |
ProjectProblem::MethodProblem subclass:#MethodCompilabilityIssue2 |
3790 | 180 |
instanceVariableNames:'rules errors warnings' |
181 |
classVariableNames:'' |
|
182 |
poolDictionaries:'' |
|
183 |
privateIn:ProjectProblem |
|
2854 | 184 |
! |
185 |
||
2798 | 186 |
ProjectProblem::MethodProblem subclass:#MethodInNoPackage |
3790 | 187 |
instanceVariableNames:'' |
188 |
classVariableNames:'' |
|
189 |
poolDictionaries:'' |
|
190 |
privateIn:ProjectProblem |
|
191 |
! |
|
192 |
||
193 |
ProjectProblem::MethodProblem subclass:#MethodListedInOtherPackage |
|
194 |
instanceVariableNames:'otherProjectDefinitionClasses' |
|
195 |
classVariableNames:'' |
|
196 |
poolDictionaries:'' |
|
197 |
privateIn:ProjectProblem |
|
2798 | 198 |
! |
199 |
||
200 |
ProjectProblem::MethodProblem subclass:#ExtensionMethodListedButDoesNotExist |
|
3790 | 201 |
instanceVariableNames:'' |
202 |
classVariableNames:'' |
|
203 |
poolDictionaries:'' |
|
204 |
privateIn:ProjectProblem |
|
2798 | 205 |
! |
206 |
||
2854 | 207 |
ProjectProblem::MethodProblem subclass:#MethodSourceCorrupted |
3790 | 208 |
instanceVariableNames:'' |
209 |
classVariableNames:'' |
|
210 |
poolDictionaries:'' |
|
211 |
privateIn:ProjectProblem |
|
2854 | 212 |
! |
213 |
||
214 |
ProjectProblem::MethodProblem subclass:#MethodSourceNotAvailable |
|
3790 | 215 |
instanceVariableNames:'' |
216 |
classVariableNames:'' |
|
217 |
poolDictionaries:'' |
|
218 |
privateIn:ProjectProblem |
|
2854 | 219 |
! |
220 |
||
2798 | 221 |
ProjectProblem subclass:#ProjectDefinitionDoesNotExist |
3790 | 222 |
instanceVariableNames:'' |
223 |
classVariableNames:'' |
|
224 |
poolDictionaries:'' |
|
225 |
privateIn:ProjectProblem |
|
2798 | 226 |
! |
227 |
||
228 |
!ProjectProblem class methodsFor:'documentation'! |
|
229 |
||
230 |
copyright |
|
231 |
" |
|
232 |
COPYRIGHT (c) 2006 by eXept Software AG |
|
3779 | 233 |
All Rights Reserved |
2798 | 234 |
|
235 |
This software is furnished under a license and may be used |
|
236 |
only in accordance with the terms of that license and with the |
|
237 |
inclusion of the above copyright notice. This software may not |
|
238 |
be provided or otherwise made available to, or used by, any |
|
239 |
other person. No title to or ownership of the software is |
|
240 |
hereby transferred. |
|
241 |
" |
|
3430 | 242 |
! |
243 |
||
244 |
documentation |
|
245 |
" |
|
246 |
I represent a problem as detect by the project consistency checker, |
|
247 |
which is optionally executed before committing a package to a repository. |
|
248 |
Typically, I find inconsistencies, uncompilable methods or missing prerequisites, |
|
249 |
which might lead to trouble when the package is later to be compiled to a dll via stc. |
|
3431 | 250 |
|
3547 | 251 |
[instance variables:] |
252 |
package - the package in question |
|
253 |
||
254 |
fixes - a collection of possible fixes |
|
255 |
(to be shown in the HTML view of the problem browser) |
|
256 |
||
257 |
allProblems - the collection of problems I am part of |
|
258 |
(only needed to be able to do the |
|
259 |
'fix other problems of this kind' operation, |
|
260 |
for example in the MethodOnNoPackage problem.) |
|
261 |
||
3431 | 262 |
[see also:] |
263 |
ProjectChecker ProjectDefinition |
|
3430 | 264 |
" |
2798 | 265 |
! ! |
266 |
||
267 |
!ProjectProblem class methodsFor:'instance creation'! |
|
268 |
||
3449 | 269 |
newClassIsCompiledButSuperclassIsAutoloaded |
270 |
||
271 |
^ClassIsCompiledButSuperclassIsAutoloaded new |
|
272 |
||
273 |
"Created: / 20-09-2013 / 11:18:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
274 |
! |
|
275 |
||
276 |
newClassIsCompiledButSuperclassProjectDefinitionIsMissing |
|
277 |
||
278 |
^ClassIsCompiledButSuperclassProjectDefinitionIsMissing new |
|
279 |
||
280 |
"Created: / 05-10-2013 / 12:43:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
281 |
! |
|
282 |
||
2911 | 283 |
newClassListedBeforeItsPool |
284 |
||
285 |
^ClassListedBeforeItsPool new |
|
286 |
||
287 |
"Created: / 13-09-2012 / 17:13:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
288 |
! |
|
289 |
||
290 |
newClassListedBeforeItsSuperclass |
|
291 |
||
292 |
^ClassListedBeforeItsSuperclass new |
|
293 |
||
294 |
"Created: / 13-09-2012 / 17:13:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
295 |
! |
|
296 |
||
2798 | 297 |
newClassListedButDoesNotExist |
298 |
||
299 |
^ClassListedButDoesNotExist new |
|
300 |
||
301 |
"Created: / 23-02-2012 / 13:18:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
302 |
! |
|
303 |
||
3806 | 304 |
newClassListedButInOtherPackage |
305 |
||
306 |
^ClassListedButInOtherPackage new |
|
307 |
! |
|
308 |
||
2911 | 309 |
newClassListedMultipleTimes |
310 |
||
311 |
^ClassListedMultipleTimes new |
|
312 |
||
313 |
"Created: / 13-09-2012 / 17:40:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
314 |
! |
|
315 |
||
2798 | 316 |
newClassNotListed |
317 |
||
318 |
^ClassNotListed new |
|
319 |
||
320 |
"Created: / 23-02-2012 / 13:59:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
321 |
! |
|
322 |
||
3588 | 323 |
newClassShouldNotBeInPackage |
324 |
||
325 |
^ClassShouldNotBeInPackage new |
|
326 |
! |
|
327 |
||
2798 | 328 |
newClassUsesPoolButItDoesNotExist |
329 |
||
330 |
^ClassUsesPoolButItDoesNotExist new |
|
331 |
||
332 |
"Created: / 23-02-2012 / 13:37:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
333 |
! |
|
334 |
||
335 |
newClassUsesPoolButItIsNotASharedPool |
|
336 |
||
337 |
^ClassUsesPoolButItIsNotASharedPool new |
|
338 |
||
339 |
"Created: / 23-02-2012 / 13:48:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
340 |
! |
|
341 |
||
2911 | 342 |
newClassUsesPoolInNamespaceButNamespaceIsNotDefined |
343 |
||
344 |
^ClassUsesPoolInNamespaceButNamespaceIsNotDefined new |
|
345 |
||
346 |
"Created: / 13-09-2012 / 16:40:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
347 |
! |
|
348 |
||
2798 | 349 |
newExtensionMethodListedButDoesNotExist |
350 |
||
351 |
^ExtensionMethodListedButDoesNotExist new |
|
352 |
||
353 |
"Created: / 23-02-2012 / 14:26:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
354 |
! |
|
355 |
||
3166 | 356 |
newExtensionMethodListedButInDifferentPackage |
357 |
||
358 |
^ExtensionMethodListedButInDifferentPackage new |
|
359 |
! |
|
360 |
||
2798 | 361 |
newExtensionMethodNotListed |
362 |
||
363 |
^ExtensionMethodNotListed new |
|
364 |
||
365 |
"Created: / 23-02-2012 / 14:27:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
366 |
! |
|
367 |
||
3166 | 368 |
newExtensionMethodsClassDoesNotExist |
369 |
||
370 |
^ExtensionMethodsClassDoesNotExist new |
|
371 |
! |
|
372 |
||
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
373 |
newMethodCompilabilityIssue1 |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
374 |
^ MethodCompilabilityIssue1 new |
2854 | 375 |
|
376 |
"Created: / 11-04-2012 / 15:34:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
377 |
"Modified: / 29-05-2014 / 15:35:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
378 |
! |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
379 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
380 |
newMethodCompilabilityIssue2 |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
381 |
^ MethodCompilabilityIssue2 new |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
382 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
383 |
"Created: / 29-05-2014 / 15:37:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2854 | 384 |
! |
385 |
||
2798 | 386 |
newMethodInNoPackage |
387 |
||
388 |
^MethodInNoPackage new |
|
389 |
||
390 |
"Created: / 23-02-2012 / 14:27:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
391 |
! |
|
392 |
||
3790 | 393 |
newMethodListedInOtherPackage |
394 |
||
395 |
^ MethodListedInOtherPackage new |
|
396 |
! |
|
397 |
||
2854 | 398 |
newMethodSourceCorrupted |
399 |
||
400 |
^MethodSourceCorrupted new |
|
401 |
||
402 |
"Created: / 11-04-2012 / 12:35:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
403 |
! |
|
404 |
||
405 |
newMethodSourceNotAvailable |
|
406 |
||
407 |
^MethodSourceNotAvailable new |
|
408 |
||
409 |
"Created: / 11-04-2012 / 12:31:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
410 |
! |
|
411 |
||
2798 | 412 |
newProjectDefinitionDoesNotExist |
413 |
||
414 |
^ProjectDefinitionDoesNotExist new |
|
415 |
||
416 |
"Created: / 23-02-2012 / 13:08:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
417 |
! ! |
|
418 |
||
419 |
!ProjectProblem methodsFor:'accessing'! |
|
420 |
||
3547 | 421 |
allProblems:something |
422 |
allProblems := something. |
|
423 |
! |
|
424 |
||
3549 | 425 |
countOtherProblemsOfThisKind |
426 |
^ allProblems |
|
427 |
count: |
|
428 |
[:problem | |
|
429 |
problem class == self class |
|
430 |
and:[ problem ~~ self |
|
431 |
and:[ problem alreadyFixed not]] |
|
432 |
]. |
|
433 |
! |
|
434 |
||
2798 | 435 |
description |
436 |
"Return a (HTML) describing the problem." |
|
437 |
||
438 |
^self subclassResponsibility |
|
439 |
||
440 |
"Created: / 23-02-2012 / 13:04:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
441 |
! |
|
442 |
||
2854 | 443 |
descriptionAndFixes |
444 |
"Return a (HTML) describing the problem plus possible fixes." |
|
445 |
||
3169 | 446 |
|descriptionText fixes| |
447 |
||
448 |
(self alreadyFixed) ifTrue:[^ 'Already fixed.']. |
|
449 |
||
450 |
descriptionText := self description. |
|
451 |
||
452 |
"/ don't use cached fixes (after a fix, the problem may return an empty fix list) |
|
453 |
fixes := self fixes. |
|
454 |
fixes isEmpty ifTrue:[ ^ descriptionText ]. |
|
2854 | 455 |
|
456 |
^String streamContents:[:html | |
|
3169 | 457 |
html nextPutAll: descriptionText. |
2798 | 458 |
|
3169 | 459 |
html nextPutAll: '<br><br>'. |
460 |
fixes size == 1 ifTrue:[ |
|
461 |
html nextPutLine: 'Possible fix:'. |
|
462 |
] ifFalse:[ |
|
463 |
html nextPutLine: 'Possible fixes:'. |
|
464 |
]. |
|
465 |
html nextPutLine:'<ul>'. |
|
466 |
fixes withIndexDo:[:fix :index| |
|
467 |
html |
|
3894 | 468 |
nextPutAll:'<li><a ACTION="doit: self application doFix: '; |
3169 | 469 |
nextPutAll: index printString; |
470 |
nextPutAll:'">'; |
|
471 |
nextPutAll: fix first; |
|
472 |
nextPutAll:'</a></li>'. |
|
473 |
]. |
|
474 |
html nextPutLine:'</ul>'. |
|
2854 | 475 |
]. |
2798 | 476 |
|
2854 | 477 |
"Created: / 26-07-2012 / 09:46:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
478 |
! |
|
479 |
||
2798 | 480 |
label |
481 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
482 |
||
483 |
^self subclassResponsibility |
|
484 |
||
485 |
"Created: / 23-02-2012 / 13:03:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
486 |
! |
|
487 |
||
488 |
package |
|
489 |
^ package |
|
490 |
! |
|
491 |
||
492 |
package:aSymbol |
|
2854 | 493 |
package := aSymbol asSymbol. |
494 |
||
495 |
"Modified: / 11-04-2012 / 16:00:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2798 | 496 |
! |
497 |
||
498 |
packageDefinitionClass |
|
499 |
^ProjectDefinition definitionClassForPackage: package |
|
500 |
||
501 |
"Created: / 23-02-2012 / 13:26:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
502 |
! |
|
503 |
||
504 |
severity |
|
505 |
"Return a severity - one of #error, #warning, #info" |
|
506 |
||
2911 | 507 |
^#warning "/by default |
2798 | 508 |
|
509 |
"Created: / 23-02-2012 / 13:09:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
510 |
! ! |
|
511 |
||
2854 | 512 |
!ProjectProblem methodsFor:'fixing'! |
513 |
||
3549 | 514 |
allUnfixedProblemsOfMyKindDo:aBlock |
515 |
allProblems do:[:p | |
|
516 |
(p class == self class and:[ p alreadyFixed not]) ifTrue:[ |
|
517 |
aBlock value:p |
|
518 |
] |
|
519 |
] |
|
520 |
! |
|
521 |
||
3169 | 522 |
alreadyFixed |
523 |
^ false |
|
524 |
! |
|
525 |
||
2854 | 526 |
doFix: index |
527 |
self initializeFixes. |
|
3169 | 528 |
^ (fixes at: index) second value |
2854 | 529 |
|
530 |
"Created: / 26-07-2012 / 10:07:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3549 | 531 |
! |
532 |
||
533 |
fixes |
|
3790 | 534 |
"Return (possibly empty) list of description-action pairs that |
3549 | 535 |
the user may take to fix/investigate the problem. |
536 |
Returned value should be list of pairs (label, action block). |
|
537 |
To be overriden in subclasses. |
|
538 |
||
539 |
The list should be an array of pairs ( fix label , fix block ). |
|
540 |
Fix block should return true, if the fix was successful, |
|
541 |
false otherwise" |
|
542 |
||
543 |
^#() |
|
544 |
||
545 |
"Created: / 26-07-2012 / 09:46:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2854 | 546 |
! ! |
547 |
||
548 |
!ProjectProblem methodsFor:'initialization'! |
|
549 |
||
550 |
initializeFixes |
|
551 |
||
552 |
fixes isNil ifTrue:[ |
|
3779 | 553 |
fixes := self fixes |
2854 | 554 |
]. |
555 |
||
556 |
"/ super initialize. -- commented since inherited method does nothing |
|
557 |
||
558 |
"Created: / 26-07-2012 / 09:54:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
559 |
! ! |
|
560 |
||
2798 | 561 |
!ProjectProblem methodsFor:'printing & storing'! |
562 |
||
3382
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
563 |
displayOn:aGCOrStream |
3169 | 564 |
|lbl| |
565 |
||
3382
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
566 |
"/ what a kludge - Dolphin and Squeak mean: printOn: a stream; |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
567 |
"/ ST/X (and some old ST80's) mean: draw-yourself on a GC. |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
568 |
(aGCOrStream isStream) ifFalse:[ |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
569 |
^ super displayOn:aGCOrStream |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
570 |
]. |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
571 |
|
3169 | 572 |
lbl := self label. |
3382
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
573 |
self alreadyFixed ifTrue:[ |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
574 |
aGCOrStream |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
575 |
nextPutAll:lbl string; |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
576 |
emphasis:#italic; |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
577 |
nextPutAll:' (already fixed)' |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
578 |
] ifFalse:[ |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
579 |
aGCOrStream nextPutAll:lbl. |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
580 |
]. |
2798 | 581 |
|
582 |
"Created: / 14-02-2012 / 17:02:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
583 |
! |
|
584 |
||
585 |
printOn:aStream |
|
586 |
"append a printed representation if the receiver to the argument, aStream" |
|
587 |
||
588 |
super printOn:aStream. |
|
589 |
aStream nextPut:$(. |
|
590 |
self severity printOn:aStream. |
|
591 |
aStream nextPut:$:; space. |
|
592 |
self label printOn:aStream. |
|
593 |
aStream nextPut:$). |
|
594 |
||
595 |
"Modified: / 23-02-2012 / 16:49:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
596 |
! ! |
|
597 |
||
598 |
!ProjectProblem methodsFor:'utilities-HTML'! |
|
599 |
||
600 |
linkToClass: classOrclassName |
|
2854 | 601 |
| className | |
2798 | 602 |
|
603 |
className := classOrclassName isBehavior |
|
3779 | 604 |
ifTrue: [classOrclassName storeString] |
605 |
ifFalse:[classOrclassName]. |
|
606 |
||
607 |
^'<A INFO="Click to browse class" |
|
3894 | 608 |
ACTION="doit: SystemBrowser default openInClass:%1"> |
3779 | 609 |
<CODE>%1</CODE></A>' |
610 |
bindWith: className |
|
2798 | 611 |
|
612 |
"Created: / 23-02-2012 / 13:44:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
613 |
! |
|
614 |
||
615 |
linkToClass: classOrclassName selector: selector |
|
2854 | 616 |
^self linkToClass: classOrclassName selector: selector omitClassName: false |
617 |
||
618 |
"Created: / 23-02-2012 / 13:45:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
619 |
! |
|
620 |
||
621 |
linkToClass: classOrclassName selector: selector omitClassName: omitClassName |
|
2798 | 622 |
|
623 |
| className | |
|
624 |
className := classOrclassName isBehavior |
|
3779 | 625 |
ifTrue: [classOrclassName name] |
626 |
ifFalse:[classOrclassName]. |
|
2854 | 627 |
^omitClassName ifTrue:[ |
3779 | 628 |
'<A INFO="Click to browse method" |
3894 | 629 |
ACTION="doit: SystemBrowser default openInClass:%1 selector: %2"> |
3779 | 630 |
<CODE>#%3</CODE></A>' |
631 |
bindWith: className |
|
632 |
with: selector storeString |
|
633 |
with: selector |
|
2854 | 634 |
] ifFalse:[ |
3779 | 635 |
'<A INFO="Click to browse method" |
3894 | 636 |
ACTION="doit: SystemBrowser default openInClass:%1 selector: %2"> |
3779 | 637 |
<CODE>%1>>%3</CODE></A>' |
638 |
bindWith: className |
|
639 |
with: selector storeString |
|
640 |
with: selector |
|
2854 | 641 |
] |
2798 | 642 |
|
2854 | 643 |
"Created: / 26-07-2012 / 10:26:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
3779 | 644 |
! |
645 |
||
646 |
linkToPackage: packageId |
|
647 |
||
648 |
^'<A INFO="Click to browse package" |
|
3894 | 649 |
ACTION="doit: SystemBrowser default openOnPackage:''%1''"> |
3779 | 650 |
<CODE>%1</CODE></A>' |
651 |
bindWith: packageId |
|
2798 | 652 |
! ! |
653 |
||
654 |
!ProjectProblem::ClassProblem methodsFor:'accessing'! |
|
655 |
||
656 |
className |
|
657 |
^ className |
|
658 |
! |
|
659 |
||
660 |
className:something |
|
661 |
className := something. |
|
2854 | 662 |
! |
663 |
||
664 |
klass |
|
665 |
"Return the class which is subject of the problem" |
|
2911 | 666 |
|
3143 | 667 |
"/ | class | |
668 |
"/ |
|
669 |
"/ (className endsWith: ' class') ifTrue:[ |
|
670 |
"/ class := Smalltalk at: (className copyTo: className size - 6) asSymbol. |
|
671 |
"/ class := class theMetaclass. |
|
672 |
"/ ] ifFalse:[ |
|
673 |
"/ class := Smalltalk at: className asSymbol |
|
674 |
"/ ]. |
|
675 |
"/ ^class |
|
2854 | 676 |
|
3143 | 677 |
"/ the above is exactly: |
3154 | 678 |
^ Smalltalk classNamed:className |
2854 | 679 |
|
680 |
"Created: / 26-07-2012 / 10:21:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2798 | 681 |
! ! |
682 |
||
3198 | 683 |
!ProjectProblem::ClassProblem methodsFor:'fixing'! |
684 |
||
685 |
doUpdateAllProjectDefinitions |
|
686 |
"full update the project definition class; |
|
687 |
will do a rescan to add all missing items" |
|
688 |
||
689 |
| def | |
|
690 |
||
691 |
def := self packageDefinitionClass. |
|
692 |
def isNil ifTrue:[ ^ false ]. |
|
693 |
||
694 |
def |
|
695 |
updateMethodsCodeUsingCompiler:Compiler |
|
696 |
ignoreOldDefinition:false. |
|
697 |
||
698 |
UserNotification notify: ('Project definitions updated. Do not forget to check in build support files!!'). |
|
699 |
^true |
|
700 |
! ! |
|
701 |
||
3549 | 702 |
!ProjectProblem::InconsistentProjectDefinition methodsFor:'fixing'! |
2911 | 703 |
|
3160 | 704 |
fixes |
3790 | 705 |
"return a list of description-actionBlock pairs for possible fixes" |
2911 | 706 |
|
3160 | 707 |
^Array |
3809 | 708 |
with: (Array |
3816 | 709 |
with: ('Full update of the package definition (rescan) of "%1"' bindWith:package) |
3809 | 710 |
with: [ self doUpdateAllProjectDefinitions ]) |
2911 | 711 |
! ! |
712 |
||
3449 | 713 |
!ProjectProblem::ClassListedBeforeItsPool methodsFor:'accessing'! |
714 |
||
715 |
poolName |
|
716 |
^ poolName |
|
717 |
! |
|
718 |
||
719 |
poolName:something |
|
720 |
poolName := something. |
|
721 |
! ! |
|
722 |
||
723 |
!ProjectProblem::ClassListedBeforeItsPool methodsFor:'accessing-description'! |
|
724 |
||
725 |
description |
|
726 |
"Return a (HTML) describing the problem." |
|
727 |
||
728 |
^ |
|
729 |
'Class %2 is listed in project definition (%1) before one of its pools (%3). |
|
730 |
<br>Such class will fail to compile (if the package is being stc-compiled) |
|
731 |
and load (if the package is being loaded from source). |
|
732 |
<br>Make sure class (%3) is listed before (%2). |
|
733 |
||
734 |
' |
|
735 |
bindWith: (self linkToClass: self packageDefinitionClass class selector: #classNamesAndAttributes omitClassName: true) |
|
736 |
with: (self linkToClass: className) |
|
737 |
with: (self linkToClass: poolName) |
|
738 |
||
739 |
"Modified: / 13-09-2012 / 18:29:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
740 |
! |
|
741 |
||
742 |
label |
|
743 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
744 |
||
745 |
^'Class %1 listed in project definition "%2" before one of its pools' bindWith: className allBold with:self packageDefinitionClass |
|
746 |
||
747 |
"Modified: / 13-09-2012 / 17:36:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
748 |
! ! |
|
749 |
||
750 |
!ProjectProblem::ClassListedBeforeItsSuperclass methodsFor:'accessing'! |
|
751 |
||
752 |
superClassName |
|
753 |
^ superClassName |
|
754 |
! |
|
755 |
||
756 |
superClassName:something |
|
757 |
superClassName := something. |
|
758 |
! ! |
|
759 |
||
760 |
!ProjectProblem::ClassListedBeforeItsSuperclass methodsFor:'accessing-description'! |
|
761 |
||
762 |
description |
|
763 |
"Return a (HTML) describing the problem." |
|
764 |
||
765 |
^ |
|
766 |
'Class %2 is listed in project definition (%1) before its superclass %3. |
|
767 |
<br>The package can be stc-compiled |
|
768 |
(because the generated makefile compiles in correct order) |
|
769 |
but the class may fail to load from source. |
|
770 |
<br>Make sure %3 is listed before %2. |
|
771 |
||
772 |
' |
|
773 |
bindWith: (self linkToClass: self packageDefinitionClass class selector: #classNamesAndAttributes omitClassName: true) |
|
774 |
with: (self linkToClass: className) |
|
775 |
with: (self linkToClass: superClassName) |
|
776 |
||
777 |
"Modified: / 13-09-2012 / 18:29:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
778 |
! |
|
779 |
||
780 |
label |
|
781 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
782 |
||
3691 | 783 |
^'Class %1 listed in project definition "%2" before its superclass %3' |
784 |
bindWith: className allBold |
|
785 |
with:self packageDefinitionClass |
|
786 |
with:superClassName |
|
3449 | 787 |
|
788 |
"Modified: / 13-09-2012 / 17:36:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
789 |
! ! |
|
790 |
||
2911 | 791 |
!ProjectProblem::ClassListedButDoesNotExist methodsFor:'accessing'! |
792 |
||
3160 | 793 |
severity |
794 |
"Return a severity - one of #error, #warning, #info" |
|
795 |
||
796 |
^#error |
|
797 |
||
798 |
"Created: / 11-04-2012 / 12:48:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
799 |
! ! |
|
800 |
||
801 |
!ProjectProblem::ClassListedButDoesNotExist methodsFor:'accessing-description'! |
|
802 |
||
2911 | 803 |
description |
804 |
"Return a (HTML) describing the problem." |
|
3550 | 805 |
|
806 |
|msg| |
|
2911 | 807 |
|
3550 | 808 |
self klass isNil ifTrue:[ |
809 |
msg := |
|
810 |
'Class "<code>%1</code>" is listed in the project definition but not present in the system. |
|
811 |
<br> |
|
2911 | 812 |
You should either create it or remove it from %2.' |
3550 | 813 |
] ifFalse:[ |
814 |
msg := |
|
815 |
'Class "<code>%1</code>" is listed in the project definition but is located in another package ("',self klass package,'") |
|
816 |
<br> |
|
817 |
You should either move the class to this package it or remove it from the list in %2.' |
|
818 |
]. |
|
819 |
^ msg |
|
820 |
bindWith: className |
|
821 |
with: (self linkToClass: self packageDefinitionClass class selector: #classNamesAndAttributes) |
|
2911 | 822 |
|
823 |
"Modified: / 28-02-2012 / 22:23:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
824 |
! |
|
825 |
||
826 |
label |
|
3160 | 827 |
^'Missing class: ', className allBold |
2911 | 828 |
|
829 |
"Modified: / 23-02-2012 / 13:20:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
830 |
! ! |
|
831 |
||
3550 | 832 |
!ProjectProblem::ClassListedButDoesNotExist methodsFor:'fixing'! |
833 |
||
834 |
alreadyFixed |
|
835 |
| cls def | |
|
836 |
||
837 |
def := self packageDefinitionClass. |
|
838 |
def isNil ifTrue:[ ^ false ]. "/ ouch - can this happen? |
|
839 |
||
840 |
(def compiled_classNames includes:className) ifFalse:[^ true]. |
|
841 |
||
842 |
cls := self klass. |
|
843 |
cls isNil ifTrue:[^ false]. |
|
844 |
||
845 |
^ cls package = self package |
|
846 |
! |
|
847 |
||
848 |
doMoveClassToPackage |
|
3806 | 849 |
| cls def | |
850 |
||
851 |
def := self packageDefinitionClass. |
|
852 |
def isNil ifTrue:[ ^ false ]. |
|
853 |
cls := self klass. |
|
854 |
cls isNil ifTrue:[ ^ false ]. |
|
855 |
cls package:def package. |
|
856 |
UserNotification notify: ('Do not forget to check in the class into the appropriate repository!!'). |
|
857 |
^true |
|
858 |
! |
|
859 |
||
860 |
doRemoveClassFromProjectDefinition |
|
861 |
| def cls | |
|
862 |
||
863 |
def := self packageDefinitionClass. |
|
864 |
def isNil ifTrue:[ ^ false ]. |
|
865 |
cls := self klass. |
|
866 |
cls isNil ifTrue:[ ^ false ]. |
|
867 |
def excludeClasses:{ cls } usingCompiler:nil. |
|
868 |
UserNotification notify: ('Class removed from project. Do not forget to check in build support files!!' bindWith: className). |
|
869 |
^true |
|
870 |
! |
|
871 |
||
872 |
fixes |
|
873 |
"return a list of description-actionBlock pairs for possible fixes" |
|
874 |
||
875 |
|allFixes| |
|
876 |
||
877 |
allFixes := OrderedCollection new. |
|
878 |
allFixes add:{ |
|
879 |
'Remove from project definition' . |
|
880 |
[ self doRemoveClassFromProjectDefinition ] |
|
881 |
}. |
|
882 |
self klass notNil ifTrue:[ |
|
883 |
allFixes add:{ |
|
884 |
'Move class to package' . |
|
885 |
[ self doMoveClassToPackage ] |
|
886 |
}. |
|
887 |
]. |
|
888 |
allFixes addAll:super fixes. |
|
889 |
^ allFixes |
|
890 |
! ! |
|
891 |
||
892 |
!ProjectProblem::ClassListedButInOtherPackage methodsFor:'accessing'! |
|
893 |
||
894 |
severity |
|
895 |
"Return a severity - one of #error, #warning, #info" |
|
896 |
||
897 |
^#error |
|
898 |
||
899 |
"Created: / 11-04-2012 / 12:48:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
900 |
! ! |
|
901 |
||
902 |
!ProjectProblem::ClassListedButInOtherPackage methodsFor:'accessing-description'! |
|
903 |
||
904 |
description |
|
905 |
"Return a (HTML) describing the problem." |
|
906 |
||
907 |
|msg| |
|
908 |
||
909 |
msg := |
|
910 |
'Class "<code>%1</code>" is listed in the project definition but is assigned to another package (%2). |
|
911 |
<br> |
|
912 |
You should either remove it from the classList %3 or completely assign it to %4.'. |
|
913 |
||
914 |
^ msg |
|
915 |
bindWith: className |
|
916 |
with:(self klass package) |
|
917 |
with: (self linkToClass: self packageDefinitionClass class selector: #classNamesAndAttributes omitClassName: true) |
|
918 |
with: package |
|
919 |
! |
|
920 |
||
921 |
label |
|
922 |
^'Class %1 is assigned to another package (%2)' |
|
923 |
bindWith:className allBold |
|
924 |
with: self klass package |
|
925 |
! ! |
|
926 |
||
927 |
!ProjectProblem::ClassListedButInOtherPackage methodsFor:'fixing'! |
|
928 |
||
929 |
alreadyFixed |
|
930 |
| cls def | |
|
931 |
||
932 |
def := self packageDefinitionClass. |
|
933 |
def isNil ifTrue:[ ^ false ]. "/ ouch - can this happen? |
|
934 |
||
935 |
(def allClassNames includes:className) ifFalse:[^ true]. |
|
3550 | 936 |
|
937 |
cls := self klass. |
|
3806 | 938 |
cls isNil ifTrue:[^ false]. |
939 |
||
940 |
^ cls package = package |
|
941 |
! |
|
942 |
||
943 |
doMoveClassToPackage |
|
944 |
| cls def | |
|
945 |
||
946 |
def := self packageDefinitionClass. |
|
947 |
def isNil ifTrue:[ ^ false ]. |
|
948 |
cls := self klass. |
|
3550 | 949 |
cls isNil ifTrue:[ ^ false ]. |
3806 | 950 |
cls package:def package. |
3550 | 951 |
UserNotification notify: ('Do not forget to check in the class into the appropriate repository!!'). |
952 |
^true |
|
953 |
! |
|
954 |
||
955 |
doRemoveClassFromProjectDefinition |
|
956 |
| def cls | |
|
957 |
||
958 |
def := self packageDefinitionClass. |
|
959 |
def isNil ifTrue:[ ^ false ]. |
|
960 |
cls := self klass. |
|
961 |
cls isNil ifTrue:[ ^ false ]. |
|
962 |
def excludeClasses:{ cls } usingCompiler:nil. |
|
963 |
UserNotification notify: ('Class removed from project. Do not forget to check in build support files!!' bindWith: className). |
|
964 |
^true |
|
965 |
! |
|
966 |
||
967 |
fixes |
|
3790 | 968 |
"return a list of description-actionBlock pairs for possible fixes" |
969 |
||
3550 | 970 |
|allFixes| |
971 |
||
972 |
allFixes := OrderedCollection new. |
|
973 |
allFixes add:{ |
|
974 |
'Remove from project definition' . |
|
975 |
[ self doRemoveClassFromProjectDefinition ] |
|
976 |
}. |
|
977 |
self klass notNil ifTrue:[ |
|
978 |
allFixes add:{ |
|
979 |
'Move class to package' . |
|
980 |
[ self doMoveClassToPackage ] |
|
981 |
}. |
|
982 |
]. |
|
983 |
allFixes addAll:super fixes. |
|
984 |
^ allFixes |
|
985 |
! ! |
|
986 |
||
3160 | 987 |
!ProjectProblem::ClassListedMultipleTimes methodsFor:'accessing-description'! |
2911 | 988 |
|
989 |
description |
|
990 |
"Return a (HTML) describing the problem." |
|
991 |
||
992 |
^ |
|
993 |
'A class %1 is listed more than once in %2. |
|
994 |
||
995 |
Such package will fail to compile, as linker will complain |
|
3147 | 996 |
about multiple definitions of the same symbols. Make sure each |
2911 | 997 |
class is listed only once. |
998 |
' |
|
999 |
bindWith: (self linkToClass: className) |
|
3645
175a54263457
Fixes description in ClassListedMultipleTimes problem.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3588
diff
changeset
|
1000 |
with: (self linkToClass: self packageDefinitionClass class selector: #classNamesAndAttributes) |
175a54263457
Fixes description in ClassListedMultipleTimes problem.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3588
diff
changeset
|
1001 |
|
175a54263457
Fixes description in ClassListedMultipleTimes problem.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3588
diff
changeset
|
1002 |
"Modified: / 26-11-2014 / 09:25:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2911 | 1003 |
! |
1004 |
||
1005 |
label |
|
1006 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1007 |
||
3160 | 1008 |
^'Class %1 listed multiple times in project definition "%2"' bindWith: className allBold with:self packageDefinitionClass |
2911 | 1009 |
|
1010 |
"Modified: / 23-02-2012 / 13:34:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1011 |
! ! |
|
1012 |
||
3160 | 1013 |
!ProjectProblem::ClassNotListed methodsFor:'accessing-description'! |
2798 | 1014 |
|
1015 |
description |
|
1016 |
"Return a (HTML) describing the problem." |
|
1017 |
||
1018 |
^ |
|
3147 | 1019 |
'Class %1 is not listed in project definition (%2). |
1020 |
<br>The class won''t be compiled and - if some other class dependents on it - the whole package will fail to compile |
|
2854 | 1021 |
at all.' |
1022 |
bindWith: (self linkToClass: className) |
|
1023 |
with: (self linkToClass: self packageDefinitionClass class selector: #classNamesAndAttributes omitClassName: true) |
|
1024 |
||
1025 |
"Modified: / 26-07-2012 / 10:27:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1026 |
! |
|
1027 |
||
3143 | 1028 |
label |
1029 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1030 |
||
3160 | 1031 |
^'Class %1 not listed in project definition "%2"' bindWith: className allBold with:self packageDefinitionClass |
3143 | 1032 |
|
1033 |
"Modified: / 23-02-2012 / 13:55:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1034 |
! ! |
|
1035 |
||
1036 |
!ProjectProblem::ClassNotListed methodsFor:'fixing'! |
|
1037 |
||
3549 | 1038 |
alreadyFixed |
1039 |
| cls def | |
|
1040 |
||
1041 |
def := self packageDefinitionClass. |
|
1042 |
def isNil ifTrue:[ ^ false ]. "/ ouch - can this happen? |
|
1043 |
||
1044 |
cls := self klass. |
|
1045 |
"/ One may "fix" the problem by actually removing the class. |
|
1046 |
"/ In this case, consider problem as "fixed". |
|
1047 |
cls isNil ifTrue:[^ true]. |
|
1048 |
||
1049 |
^ (def compiled_classNames includes:className) |
|
1050 |
! |
|
1051 |
||
1052 |
doIncludeAllClassesInProject |
|
1053 |
"Include all unlisted subject classes in project definition. |
|
1054 |
Return false if fix fails, true otherwise" |
|
1055 |
||
1056 |
|any| |
|
1057 |
||
1058 |
any := false. |
|
1059 |
self allUnfixedProblemsOfMyKindDo:[:p | |
|
1060 |
any := any | (p doIncludeInProjectAsAutoloaded:false) |
|
1061 |
]. |
|
1062 |
^ any |
|
1063 |
! |
|
1064 |
||
2854 | 1065 |
doIncludeInProject |
1066 |
"Include subject class in project definition. Return false if |
|
1067 |
fix fails, true otherwise" |
|
2798 | 1068 |
|
3160 | 1069 |
^ self doIncludeInProjectAsAutoloaded:false |
2854 | 1070 |
! |
2798 | 1071 |
|
2854 | 1072 |
doIncludeInProjectAsAutoloaded |
1073 |
"Include subject class in project definition. Return false if |
|
1074 |
fix fails, true otherwise" |
|
3160 | 1075 |
|
1076 |
^ self doIncludeInProjectAsAutoloaded:true |
|
1077 |
! |
|
1078 |
||
1079 |
doIncludeInProjectAsAutoloaded:asAutoloaded |
|
1080 |
"Include subject class in project definition. Return false if |
|
1081 |
fix fails, true otherwise" |
|
1082 |
||
2854 | 1083 |
| def cls | |
3160 | 1084 |
|
2854 | 1085 |
def := self packageDefinitionClass. |
1086 |
def isNil ifTrue:[ ^ false ]. |
|
1087 |
cls := self klass. |
|
1088 |
cls isNil ifTrue:[ ^ false ]. |
|
3160 | 1089 |
asAutoloaded ifTrue:[ |
1090 |
def makeClassesAutoloaded:(Array with: cls) usingCompiler: nil. |
|
1091 |
] ifFalse:[ |
|
1092 |
def includeClasses:(Array with: cls) usingCompiler: nil. |
|
1093 |
]. |
|
3144 | 1094 |
UserNotification notify: ('Class added. Do not forget to check in build support files!!' bindWith: className). |
2854 | 1095 |
^true |
1096 |
||
1097 |
"Created: / 26-07-2012 / 10:41:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1098 |
! |
|
1099 |
||
1100 |
fixes |
|
3790 | 1101 |
"return a list of description-actionBlock pairs for possible fixes" |
1102 |
||
3549 | 1103 |
|numOther fixes| |
2854 | 1104 |
|
3549 | 1105 |
numOther := self countOtherProblemsOfThisKind. |
1106 |
fixes := OrderedCollection new. |
|
1107 |
fixes add:{ 'Add class to project (as compiled)' . |
|
1108 |
[ self doIncludeInProject ] |
|
1109 |
}. |
|
1110 |
numOther > 0 ifTrue:[ |
|
1111 |
fixes add:{ 'Add all listed classes to project (as compiled)' . |
|
1112 |
[ self doIncludeAllClassesInProject ] |
|
1113 |
}. |
|
1114 |
]. |
|
1115 |
||
1116 |
fixes |
|
1117 |
add:{ 'Add class to project as autoloaded' . |
|
1118 |
[ self doIncludeInProjectAsAutoloaded ] |
|
1119 |
}; |
|
1120 |
add:{ 'Full update of the project definitions (rescan)' . |
|
1121 |
[ self doUpdateAllProjectDefinitions ] |
|
1122 |
}. |
|
1123 |
^ fixes |
|
2854 | 1124 |
|
1125 |
"Created: / 26-07-2012 / 10:41:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2798 | 1126 |
! ! |
1127 |
||
3449 | 1128 |
!ProjectProblem::ClassIsCompiledButSuperclassIsAutoloaded methodsFor:'accessing'! |
3160 | 1129 |
|
2798 | 1130 |
description |
1131 |
"Return a (HTML) describing the problem." |
|
1132 |
||
1133 |
^ |
|
3779 | 1134 |
'Class %1 is compiled (i.e., not autoloaded) but its superclass %2 is autoloaded. |
1135 |
<p> |
|
1136 |
Such class won''t compile with STC because of a missing superclass header file. |
|
3776 | 1137 |
To fix it, either make %1 autoloaded or make %2 compiled.' |
3449 | 1138 |
bindWith: (self linkToClass: className) |
1139 |
with: (self linkToClass: (Smalltalk at: className) superclass name) |
|
2798 | 1140 |
|
3449 | 1141 |
"Modified: / 20-09-2013 / 11:04:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2798 | 1142 |
! |
1143 |
||
1144 |
label |
|
1145 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1146 |
||
3449 | 1147 |
^ 'Class ', className , ' is compiled but its superclass is autoloaded' |
1148 |
||
1149 |
"Modified: / 20-09-2013 / 11:00:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1150 |
! ! |
|
1151 |
||
1152 |
!ProjectProblem::ClassIsCompiledButSuperclassIsAutoloaded methodsFor:'fixing'! |
|
1153 |
||
1154 |
doIncludeInProjectAsAutoloaded |
|
1155 |
"Include subject class in project definition. Return false if |
|
1156 |
fix fails, true otherwise" |
|
1157 |
||
1158 |
^ self doIncludeInProjectAsAutoloaded:true |
|
1159 |
! |
|
1160 |
||
1161 |
doIncludeInProjectAsAutoloaded:asAutoloaded |
|
1162 |
"Include subject class in project definition. Return false if |
|
1163 |
fix fails, true otherwise" |
|
1164 |
||
1165 |
| def cls | |
|
2911 | 1166 |
|
3449 | 1167 |
def := self packageDefinitionClass. |
1168 |
def isNil ifTrue:[ ^ false ]. |
|
1169 |
cls := self klass. |
|
1170 |
cls isNil ifTrue:[ ^ false ]. |
|
1171 |
asAutoloaded ifTrue:[ |
|
1172 |
def makeClassesAutoloaded:(Array with: cls) usingCompiler: nil. |
|
1173 |
] ifFalse:[ |
|
1174 |
def includeClasses:(Array with: cls) usingCompiler: nil. |
|
1175 |
]. |
|
1176 |
UserNotification notify: ('Class added. Do not forget to check in build support files!!' bindWith: className). |
|
1177 |
^true |
|
1178 |
||
1179 |
"Created: / 26-07-2012 / 10:41:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1180 |
! |
|
1181 |
||
3777 | 1182 |
doMakeSuperclassCompiled |
1183 |
"Include subject's super class in project definition as compiled class. |
|
1184 |
Return false if fix fails, true otherwise" |
|
1185 |
||
3779 | 1186 |
| def cls superclass superclassDef| |
3777 | 1187 |
|
1188 |
def := self packageDefinitionClass. |
|
1189 |
def isNil ifTrue:[ ^ false ]. |
|
1190 |
cls := self klass. |
|
1191 |
cls isNil ifTrue:[ ^ false ]. |
|
3779 | 1192 |
|
3777 | 1193 |
superclass := (Smalltalk at: className) superclass. |
3779 | 1194 |
superclassDef := superclass projectDefinitionClass. |
1195 |
superclassDef isNil ifTrue:[^ false]. |
|
1196 |
||
1197 |
superclassDef includeClasses:(Array with: superclass) usingCompiler: nil. |
|
3777 | 1198 |
|
1199 |
UserNotification notify: ('Superclass added/changed. Do not forget to check in build support files!!' bindWith: className). |
|
1200 |
^true |
|
1201 |
! |
|
1202 |
||
3449 | 1203 |
fixes |
3790 | 1204 |
"return a list of description-actionBlock pairs for possible fixes" |
1205 |
||
3779 | 1206 |
|fixes superClass superPackage| |
1207 |
||
1208 |
fixes := super fixes asNewOrderedCollection. |
|
1209 |
||
1210 |
superClass := (Smalltalk at: className) superclass. |
|
1211 |
superPackage := superClass package. |
|
1212 |
||
1213 |
superPackage = package ifTrue:[ |
|
1214 |
fixes add: |
|
1215 |
{ 'Make ',className,' autoloaded in project' . |
|
1216 |
[ self doIncludeInProjectAsAutoloaded ]}. |
|
1217 |
fixes add: |
|
1218 |
{ 'Make superclass ',(superClass name),' compiled' . |
|
3777 | 1219 |
[ self doMakeSuperclassCompiled ]} . |
3779 | 1220 |
] ifFalse:[ |
1221 |
fixes add: |
|
1222 |
{ 'Make ',className,' autoloaded in project "',package,'"' . |
|
1223 |
[ self doIncludeInProjectAsAutoloaded ]}. |
|
1224 |
||
1225 |
fixes add: |
|
1226 |
{ 'Make superclass ',(superClass name),' compiled in "',superPackage,'"'. |
|
1227 |
[ self doMakeSuperclassCompiled ]} . |
|
1228 |
]. |
|
3778 | 1229 |
^ fixes |
2911 | 1230 |
! ! |
1231 |
||
3588 | 1232 |
!ProjectProblem::ClassShouldNotBeInPackage methodsFor:'accessing-description'! |
1233 |
||
1234 |
description |
|
1235 |
"Return a (HTML) describing the problem." |
|
1236 |
||
1237 |
^ |
|
1238 |
'Class %1 should not be assigned to a Folder-only package (%2). |
|
1239 |
Folder-only packages are only meant for organization and to visit subprojects for compilation. |
|
1240 |
<br>The class won''t be compiled and - if some other class dependents on it - the whole package will fail to compile |
|
1241 |
at all.' |
|
1242 |
bindWith: (self linkToClass: className) |
|
1243 |
with: (self linkToClass: self packageDefinitionClass class selector: #classNamesAndAttributes omitClassName: true) |
|
1244 |
! |
|
1245 |
||
1246 |
label |
|
1247 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1248 |
||
1249 |
^'Class %1 not listed in project definition "%2"' bindWith: className allBold with:self packageDefinitionClass |
|
1250 |
||
1251 |
"Modified: / 23-02-2012 / 13:55:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1252 |
! ! |
|
1253 |
||
1254 |
!ProjectProblem::ClassShouldNotBeInPackage methodsFor:'fixing'! |
|
1255 |
||
1256 |
alreadyFixed |
|
1257 |
| cls def | |
|
1258 |
||
1259 |
def := self packageDefinitionClass. |
|
1260 |
def isNil ifTrue:[ ^ false ]. "/ ouch - can this happen? |
|
1261 |
||
1262 |
cls := self klass. |
|
1263 |
"/ One may "fix" the problem by actually removing the class. |
|
1264 |
"/ In this case, consider problem as "fixed". |
|
1265 |
cls isNil ifTrue:[^ true]. |
|
1266 |
||
1267 |
^ (def compiled_classNames includes:className) |
|
1268 |
! |
|
1269 |
||
1270 |
doIncludeAllClassesInProject |
|
1271 |
"Include all unlisted subject classes in project definition. |
|
1272 |
Return false if fix fails, true otherwise" |
|
1273 |
||
1274 |
|any| |
|
1275 |
||
1276 |
any := false. |
|
1277 |
self allUnfixedProblemsOfMyKindDo:[:p | |
|
1278 |
any := any | (p doIncludeInProjectAsAutoloaded:false) |
|
1279 |
]. |
|
1280 |
^ any |
|
1281 |
! |
|
1282 |
||
1283 |
doIncludeInProject |
|
1284 |
"Include subject class in project definition. Return false if |
|
1285 |
fix fails, true otherwise" |
|
1286 |
||
1287 |
^ self doIncludeInProjectAsAutoloaded:false |
|
1288 |
! |
|
1289 |
||
1290 |
doIncludeInProjectAsAutoloaded |
|
1291 |
"Include subject class in project definition. Return false if |
|
1292 |
fix fails, true otherwise" |
|
1293 |
||
1294 |
^ self doIncludeInProjectAsAutoloaded:true |
|
1295 |
! |
|
1296 |
||
1297 |
doIncludeInProjectAsAutoloaded:asAutoloaded |
|
1298 |
"Include subject class in project definition. Return false if |
|
1299 |
fix fails, true otherwise" |
|
1300 |
||
1301 |
| def cls | |
|
1302 |
||
1303 |
def := self packageDefinitionClass. |
|
1304 |
def isNil ifTrue:[ ^ false ]. |
|
1305 |
cls := self klass. |
|
1306 |
cls isNil ifTrue:[ ^ false ]. |
|
1307 |
asAutoloaded ifTrue:[ |
|
1308 |
def makeClassesAutoloaded:(Array with: cls) usingCompiler: nil. |
|
1309 |
] ifFalse:[ |
|
1310 |
def includeClasses:(Array with: cls) usingCompiler: nil. |
|
1311 |
]. |
|
1312 |
UserNotification notify: ('Class added. Do not forget to check in build support files!!' bindWith: className). |
|
1313 |
^true |
|
1314 |
||
1315 |
"Created: / 26-07-2012 / 10:41:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1316 |
! |
|
1317 |
||
1318 |
fixes |
|
3790 | 1319 |
"return a list of description-actionBlock pairs for possible fixes" |
1320 |
||
3588 | 1321 |
|numOther fixes| |
1322 |
||
1323 |
numOther := self countOtherProblemsOfThisKind. |
|
1324 |
fixes := OrderedCollection new. |
|
1325 |
fixes add:{ 'Add class to project (as compiled)' . |
|
1326 |
[ self doIncludeInProject ] |
|
1327 |
}. |
|
1328 |
numOther > 0 ifTrue:[ |
|
1329 |
fixes add:{ 'Add all listed classes to project (as compiled)' . |
|
1330 |
[ self doIncludeAllClassesInProject ] |
|
1331 |
}. |
|
1332 |
]. |
|
1333 |
||
1334 |
fixes |
|
1335 |
add:{ 'Add class to project as autoloaded' . |
|
1336 |
[ self doIncludeInProjectAsAutoloaded ] |
|
1337 |
}; |
|
1338 |
add:{ 'Full update of the project definitions (rescan)' . |
|
1339 |
[ self doUpdateAllProjectDefinitions ] |
|
1340 |
}. |
|
1341 |
^ fixes |
|
1342 |
||
1343 |
"Created: / 26-07-2012 / 10:41:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1344 |
! ! |
|
1345 |
||
2911 | 1346 |
!ProjectProblem::ClassUsesPoolProblem methodsFor:'accessing'! |
1347 |
||
2798 | 1348 |
poolName |
1349 |
^ poolName |
|
1350 |
! |
|
1351 |
||
1352 |
poolName:something |
|
1353 |
poolName := something. |
|
1354 |
! ! |
|
1355 |
||
3160 | 1356 |
!ProjectProblem::ClassUsesPoolButItIsNotASharedPool methodsFor:'accessing-description'! |
2798 | 1357 |
|
1358 |
description |
|
1359 |
"Return a (HTML) describing the problem." |
|
1360 |
||
1361 |
^ |
|
3147 | 1362 |
'A class %1 uses pool %2 but it does not exist. |
2798 | 1363 |
|
3154 | 1364 |
The pool should be removed from the class definition; |
3147 | 1365 |
otherwise the package won''t compile due to a missing class.' |
2911 | 1366 |
bindWith: (self linkToClass: className) |
3779 | 1367 |
with: (self linkToClass: poolName) |
2798 | 1368 |
|
1369 |
"Modified: / 23-02-2012 / 13:48:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1370 |
! |
|
1371 |
||
1372 |
label |
|
1373 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1374 |
||
3160 | 1375 |
^'Used pool %1 is not a SharedPool' bindWith: className allBold |
2798 | 1376 |
|
1377 |
"Modified: / 23-02-2012 / 13:40:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2911 | 1378 |
! ! |
1379 |
||
3160 | 1380 |
!ProjectProblem::ClassUsesPoolInNamespaceButNamespaceIsNotDefined methodsFor:'accessing-description'! |
2911 | 1381 |
|
1382 |
description |
|
1383 |
"Return a (HTML) describing the problem." |
|
1384 |
||
1385 |
^ |
|
3147 | 1386 |
'A class %1 uses pool %2 from same namespace as the class, |
1387 |
but the namespace is not explicitly named in the shared pools definition. |
|
2911 | 1388 |
|
1389 |
Due to a bug in stc, such code will fail to compile. A pool definition |
|
3147 | 1390 |
must contain a fully qualified class name including namespace.' |
2911 | 1391 |
bindWith: (self linkToClass: className) |
3779 | 1392 |
with: (self linkToClass: poolName) |
2911 | 1393 |
|
1394 |
"Modified: / 13-09-2012 / 16:32:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2798 | 1395 |
! |
1396 |
||
2911 | 1397 |
label |
1398 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1399 |
||
3160 | 1400 |
^ 'Missing namespace prefix in shared pools definition of %1' bindWith: className allBold |
2911 | 1401 |
|
1402 |
"Modified: / 13-09-2012 / 16:28:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1403 |
! ! |
|
1404 |
||
3160 | 1405 |
!ProjectProblem::ClassUsesPoolButItDoesNotExist methodsFor:'accessing-description'! |
2911 | 1406 |
|
1407 |
description |
|
1408 |
"Return a (HTML) describing the problem." |
|
1409 |
||
1410 |
^ |
|
3147 | 1411 |
'A class %1 uses pool %2 but it does not exist. |
2911 | 1412 |
|
3154 | 1413 |
The pool should be removed from the class definition; |
3147 | 1414 |
otherwise the package won''t compile due to a missing class.' |
2911 | 1415 |
bindWith: (self linkToClass: className) with: poolName |
1416 |
||
1417 |
"Modified: / 13-09-2012 / 16:24:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2798 | 1418 |
! |
1419 |
||
2911 | 1420 |
label |
1421 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1422 |
||
3160 | 1423 |
^'Missing pool: ' , className allBold |
2911 | 1424 |
|
1425 |
"Modified: / 23-02-2012 / 13:34:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2798 | 1426 |
! ! |
1427 |
||
1428 |
!ProjectProblem::MethodProblem methodsFor:'accessing'! |
|
1429 |
||
1430 |
className:something selector: sel |
|
1431 |
className := something. |
|
1432 |
selector := sel |
|
1433 |
||
1434 |
"Created: / 23-02-2012 / 14:17:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1435 |
! |
|
1436 |
||
2854 | 1437 |
method |
1438 |
| class | |
|
1439 |
||
1440 |
class := self klass. |
|
3166 | 1441 |
class isNil ifTrue:[ ^ nil ]. |
2854 | 1442 |
^class compiledMethodAt: selector |
1443 |
||
1444 |
"Created: / 26-07-2012 / 10:09:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1445 |
! |
|
1446 |
||
1447 |
method: method |
|
1448 |
||
1449 |
self className: method mclass name selector: method selector |
|
1450 |
||
1451 |
"Created: / 11-04-2012 / 12:32:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1452 |
! |
|
1453 |
||
2798 | 1454 |
selector |
1455 |
^ selector |
|
1456 |
! |
|
1457 |
||
1458 |
selector:something |
|
1459 |
selector := something. |
|
1460 |
! ! |
|
1461 |
||
3204 | 1462 |
!ProjectProblem::MethodProblem methodsFor:'fixes'! |
1463 |
||
1464 |
doRemoveMethodFromExtensionsList |
|
1465 |
"update the extension method info in the project definition. |
|
1466 |
Return false if fix fails, true otherwise" |
|
1467 |
||
1468 |
| def mthd | |
|
1469 |
||
1470 |
def := self packageDefinitionClass. |
|
1471 |
def isNil ifTrue:[ ^ false ]. |
|
1472 |
mthd := self method. |
|
1473 |
mthd isNil ifTrue:[ ^ false ]. |
|
1474 |
||
1475 |
def excludeMethods:(Array with:mthd) usingCompiler:nil. |
|
1476 |
UserNotification notify: ('ProjectDefinition updated. Do not forget to check it in!!'). |
|
1477 |
^true |
|
1478 |
! |
|
1479 |
||
1480 |
doRemoveNamedMethodFromExtensionsList |
|
1481 |
"update the extension method info in the project definition. |
|
1482 |
Return false if fix fails, true otherwise" |
|
1483 |
||
1484 |
| def | |
|
1485 |
||
1486 |
def := self packageDefinitionClass. |
|
1487 |
def isNil ifTrue:[ ^ false ]. |
|
1488 |
||
1489 |
def excludeMethodFor:selector inClassNamed:className usingCompiler:nil. |
|
1490 |
UserNotification notify: ('ProjectDefinition updated. Do not forget to check it in!!'). |
|
1491 |
^true |
|
1492 |
! ! |
|
1493 |
||
2798 | 1494 |
!ProjectProblem::MethodProblem methodsFor:'utilities-HTML'! |
1495 |
||
1496 |
linkToMethod |
|
1497 |
||
1498 |
^self linkToClass: className selector: selector |
|
1499 |
||
1500 |
"Created: / 23-02-2012 / 14:21:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1501 |
! ! |
|
1502 |
||
3166 | 1503 |
!ProjectProblem::ExtensionMethodListedButInDifferentPackage methodsFor:'accessing-description'! |
1504 |
||
1505 |
description |
|
1506 |
"Return a (HTML) describing the problem." |
|
1507 |
||
3168 | 1508 |
|mthd text| |
3166 | 1509 |
|
3168 | 1510 |
(mthd := self method) isNil ifTrue:[ ^ 'Method removed.' ]. |
3169 | 1511 |
|
3168 | 1512 |
mthd package = mthd mclass package ifTrue:[ |
1513 |
text := |
|
3650 | 1514 |
'Method %1 is listed as an extension in "%3", but is actually associated to its class''s package "%4" (ie. not as extension). |
1515 |
<P>Maybe the method used to be an extension but is now a proper part of the class. |
|
1516 |
If this is the case, you should remove the method name from the extensions list (%3). |
|
1517 |
<P>Otherwise, the method may have lost its package information due to a recompilation in |
|
1518 |
a tool which did not known about the original package association. |
|
1519 |
Then, you should reassociate the method to the extending package.' |
|
3168 | 1520 |
] ifFalse:[ |
1521 |
text := |
|
3650 | 1522 |
'Method %1 is listed as an extension in "%3" but is actually assicualted to a different package: "%4". |
1523 |
<P>The package will compile but may fail to (auto)load from sources. |
|
1524 |
<P>It is recommended to either remove the method name from the extensions list (%3) |
|
3166 | 1525 |
or move the method it to the correct package.' |
3168 | 1526 |
]. |
1527 |
^ text |
|
1528 |
bindWith: (self linkToClass: (Smalltalk classNamed: className) selector: selector) "className" |
|
1529 |
with: selector |
|
1530 |
with: (self linkToClass: self packageDefinitionClass class selector: #extensionMethodNames) |
|
1531 |
with: mthd package |
|
3166 | 1532 |
|
1533 |
"Modified: / 23-02-2012 / 15:18:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1534 |
! |
|
1535 |
||
1536 |
label |
|
1537 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1538 |
||
3168 | 1539 |
|mthd text| |
1540 |
||
1541 |
text := 'Extension method %1 >> %2 listed but in different package'. |
|
1542 |
||
1543 |
(mthd := self method) notNil ifTrue:[ |
|
1544 |
mthd package = mthd mclass package ifTrue:[ |
|
1545 |
text := 'Extension method %1 >> %2 listed but in classes package' |
|
1546 |
] |
|
1547 |
]. |
|
1548 |
^ text |
|
3166 | 1549 |
bindWith: className allBold |
1550 |
with: selector allBold |
|
1551 |
||
1552 |
"Modified: / 23-02-2012 / 14:22:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1553 |
! ! |
|
1554 |
||
1555 |
!ProjectProblem::ExtensionMethodListedButInDifferentPackage methodsFor:'fixes'! |
|
1556 |
||
3169 | 1557 |
alreadyFixed |
1558 |
|mthd| |
|
1559 |
||
1560 |
(self packageDefinitionClass extensionMethods includes:self method) ifFalse:[^ true]. |
|
1561 |
^ ((mthd := self method) notNil |
|
1562 |
and:[ mthd package = package ]) |
|
1563 |
! |
|
1564 |
||
3166 | 1565 |
doMoveMethodToProject |
1566 |
self method package:package |
|
3549 | 1567 |
! ! |
1568 |
||
1569 |
!ProjectProblem::ExtensionMethodListedButInDifferentPackage methodsFor:'fixing'! |
|
3166 | 1570 |
|
1571 |
fixes |
|
3790 | 1572 |
"return a list of description-actionBlock pairs for possible fixes" |
1573 |
||
3168 | 1574 |
|mthd| |
1575 |
||
1576 |
(mthd := self method) isNil ifTrue:[ ^ #() ]. |
|
3166 | 1577 |
|
3169 | 1578 |
"/ mthd package = mthd mclass package ifTrue:[ |
1579 |
"/ ^Array |
|
1580 |
"/ with: (Array with: 'Remove from the extensionMethodNames list' with: [ self doRemoveMethodFromExtensionsList ]) |
|
1581 |
"/ ]. |
|
1582 |
"/ |
|
3166 | 1583 |
^Array |
3169 | 1584 |
with: (Array with: 'Remove from the extensionMethodNames list' with: [ self doRemoveMethodFromExtensionsList ]) |
3809 | 1585 |
with: (Array with: ('Move method to package "%1"' bindWith:package) with: [ self doMoveMethodToProject ]) |
3166 | 1586 |
|
1587 |
"Created: / 26-07-2012 / 10:41:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1588 |
! ! |
|
1589 |
||
3160 | 1590 |
!ProjectProblem::ExtensionMethodNotListed methodsFor:'accessing-description'! |
2798 | 1591 |
|
1592 |
description |
|
1593 |
"Return a (HTML) describing the problem." |
|
1594 |
||
3154 | 1595 |
^'Method %1 is not listed in %2. |
3143 | 1596 |
<br>It should either be listed in the project definition, or moved to the owning classes package' |
2798 | 1597 |
bindWith: (self linkToMethod) |
3169 | 1598 |
with: (self linkToClass: self packageDefinitionClass class selector: #extensionMethodNames) |
2798 | 1599 |
|
1600 |
"Modified: / 23-02-2012 / 14:34:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1601 |
! |
|
1602 |
||
1603 |
label |
|
1604 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1605 |
||
3160 | 1606 |
^'Extension method %1 >> %2 not listed in project definition "%3"' bindWith: className allBold with: selector allBold with:self packageDefinitionClass |
2798 | 1607 |
|
1608 |
"Modified: / 23-02-2012 / 14:22:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1609 |
! ! |
|
1610 |
||
3143 | 1611 |
!ProjectProblem::ExtensionMethodNotListed methodsFor:'fixing'! |
1612 |
||
3169 | 1613 |
alreadyFixed |
1614 |
^ (self packageDefinitionClass extensionMethods includes:self method) |
|
1615 |
! |
|
1616 |
||
3143 | 1617 |
doMoveToClassesPackage |
3154 | 1618 |
"move the extension method to the owning classes package. |
3143 | 1619 |
Return false if fix fails, true otherwise" |
1620 |
||
1621 |
| cls mthd | |
|
1622 |
||
1623 |
cls := self klass. |
|
1624 |
cls isNil ifTrue:[ ^ false ]. |
|
1625 |
mthd := cls compiledMethodAt:selector. |
|
1626 |
mthd package:(cls package). |
|
3809 | 1627 |
|
3143 | 1628 |
UserNotification notify: ('Do not forget to check in the method''s package (or class) ("%1")!!' bindWith:cls package). |
1629 |
^true |
|
1630 |
! |
|
1631 |
||
1632 |
doUpdateExtensionMethodsInProject |
|
3154 | 1633 |
"update the extension method info in the project definition. |
3143 | 1634 |
Return false if fix fails, true otherwise" |
1635 |
||
3169 | 1636 |
| def mthd | |
3143 | 1637 |
|
1638 |
def := self packageDefinitionClass. |
|
1639 |
def isNil ifTrue:[ ^ false ]. |
|
3169 | 1640 |
mthd := self method. |
1641 |
mthd isNil ifTrue:[ ^ false ]. |
|
1642 |
||
1643 |
def includeMethods:(Array with:mthd) usingCompiler:nil. |
|
3143 | 1644 |
UserNotification notify: ('ProjectDefinition updated. Do not forget to check it in!!'). |
1645 |
^true |
|
1646 |
! |
|
1647 |
||
1648 |
fixes |
|
3790 | 1649 |
"return a list of description-actionBlock pairs for possible fixes" |
1650 |
||
3143 | 1651 |
^Array |
3809 | 1652 |
with: (Array |
1653 |
with: ('Add method to package ("%1")' bindWith:package) |
|
1654 |
with: [ self doUpdateExtensionMethodsInProject ] ) |
|
1655 |
with: (Array |
|
1656 |
with: ('Move method to classes package ("%1")' bindWith:self klass package) |
|
1657 |
with: [ self doMoveToClassesPackage ] ) |
|
1658 |
with: (Array |
|
1659 |
with: ('Full update of the package definition (rescan) of "%1"' bindWith:self klass package) |
|
1660 |
with: [ self doUpdateAllProjectDefinitions ] ) |
|
3143 | 1661 |
! ! |
1662 |
||
3166 | 1663 |
!ProjectProblem::ExtensionMethodsClassDoesNotExist methodsFor:'accessing-description'! |
1664 |
||
1665 |
description |
|
1666 |
"Return a (HTML) describing the problem." |
|
1667 |
||
1668 |
^'Method %1 >> %2 listed in %3 but class does not exist. |
|
1669 |
The package will compile but may fail to (auto)load from sources. |
|
1670 |
||
1671 |
It is recommended to remove the method from the list (%3).' |
|
1672 |
bindWith: className |
|
1673 |
with: selector |
|
1674 |
with: (self linkToClass: self packageDefinitionClass class selector: #extensionMethodNames) |
|
1675 |
! |
|
1676 |
||
1677 |
label |
|
1678 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1679 |
||
1680 |
^'Extension method %1 >> %2 listed but class not existing' |
|
1681 |
bindWith: className allBold |
|
1682 |
with: selector allBold |
|
1683 |
||
1684 |
"Modified: / 23-02-2012 / 14:22:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1685 |
! ! |
|
1686 |
||
3549 | 1687 |
!ProjectProblem::ExtensionMethodsClassDoesNotExist methodsFor:'fixing'! |
3204 | 1688 |
|
1689 |
fixes |
|
3790 | 1690 |
"return a list of description-actionBlock pairs for possible fixes" |
1691 |
||
3204 | 1692 |
^Array |
1693 |
with: (Array with: 'Remove from the extensionMethodNames list' with: [ self doRemoveNamedMethodFromExtensionsList ]) |
|
1694 |
||
1695 |
"Created: / 26-07-2012 / 10:41:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1696 |
! ! |
|
1697 |
||
3449 | 1698 |
!ProjectProblem::ClassIsCompiledButSuperclassProjectDefinitionIsMissing methodsFor:'accessing'! |
3160 | 1699 |
|
1700 |
description |
|
1701 |
"Return a (HTML) describing the problem." |
|
1702 |
||
1703 |
^ |
|
3779 | 1704 |
'Class %1 is compiled (i.e. not autoloaded) but its superclass''s project |
1705 |
definition class is missing. |
|
1706 |
<BR>(superclass %2 has no project definition for "%3"). |
|
1707 |
<P> |
|
1708 |
Such class won''t compile with STC because the superclass''s package |
|
1709 |
will likely be missing.' |
|
3449 | 1710 |
bindWith: (self linkToClass: className) |
1711 |
with: (self linkToClass: (Smalltalk at: className) superclass name) |
|
3779 | 1712 |
with: (self linkToPackage: (Smalltalk at: className) superclass package) |
3160 | 1713 |
|
3449 | 1714 |
"Modified: / 05-10-2013 / 12:43:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
3160 | 1715 |
! |
1716 |
||
3779 | 1717 |
fixes |
3790 | 1718 |
"return a list of description-actionBlock pairs for possible fixes" |
1719 |
||
3779 | 1720 |
|fixes superClass superPackage| |
1721 |
||
1722 |
fixes := super fixes asNewOrderedCollection. |
|
1723 |
||
1724 |
superClass := (Smalltalk at: className) superclass. |
|
1725 |
superPackage := superClass package. |
|
1726 |
||
1727 |
fixes add: |
|
1728 |
{ 'Create project definition class for project "',superPackage,'"' . |
|
3809 | 1729 |
[ self createPackageDefinitionForSuperclass ] |
1730 |
}. |
|
3779 | 1731 |
|
1732 |
^ fixes |
|
1733 |
! |
|
1734 |
||
3160 | 1735 |
label |
1736 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1737 |
||
3449 | 1738 |
^ 'Class ', className , ' is compiled but its superclass''s package definition is missing' |
3160 | 1739 |
|
3449 | 1740 |
"Modified: / 05-10-2013 / 12:41:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
3160 | 1741 |
! ! |
1742 |
||
3779 | 1743 |
!ProjectProblem::ClassIsCompiledButSuperclassProjectDefinitionIsMissing methodsFor:'fixing'! |
1744 |
||
1745 |
createPackageDefinitionForSuperclass |
|
1746 |
"crate super class's project definition. |
|
1747 |
Return false if fix fails, true otherwise" |
|
1748 |
||
1749 |
| superclass superclassDef| |
|
1750 |
||
1751 |
superclass := (Smalltalk at: className) superclass. |
|
1752 |
superclassDef := ProjectDefinition definitionClassForPackage:superclass package createIfAbsent:true. |
|
1753 |
superclassDef isNil ifTrue:[^ false]. |
|
1754 |
^true |
|
1755 |
! ! |
|
1756 |
||
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1757 |
!ProjectProblem::MethodCompilabilityIssue1 methodsFor:'accessing'! |
2854 | 1758 |
|
3160 | 1759 |
severity |
1760 |
^ errors notNil ifTrue:[#error] ifFalse:[#warning] |
|
1761 |
||
1762 |
"Modified: / 11-04-2012 / 15:40:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1763 |
! ! |
|
1764 |
||
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1765 |
!ProjectProblem::MethodCompilabilityIssue1 methodsFor:'accessing-description'! |
3160 | 1766 |
|
2854 | 1767 |
description |
1768 |
"Return a (HTML) describing the problem." |
|
1769 |
||
1770 |
| issuePrinter | |
|
1771 |
||
3488 | 1772 |
issuePrinter := |
1773 |
[:stream :issue| |
|
1774 |
stream nextPutAll:'<li>'. |
|
1775 |
issue descriptionOn: stream. |
|
1776 |
stream nextPutAll:'</li>'. |
|
1777 |
stream cr. |
|
1778 |
]. |
|
2854 | 1779 |
|
1780 |
^ String streamContents:[:s| |
|
3488 | 1781 |
s |
1782 |
nextPutAll: 'The following problems have been found in '; |
|
1783 |
nextPutAll: self linkToMethod; |
|
1784 |
nextPutAll: ':'; cr; |
|
1785 |
nextPutAll: '<ul>'. |
|
1786 |
errors ? #() do:[:issue|issuePrinter value: s value: issue]. |
|
1787 |
warnings ? #() do:[:issue|issuePrinter value: s value: issue]. |
|
1788 |
s |
|
1789 |
nextPutAll: '</ul>'. |
|
2854 | 1790 |
|
3488 | 1791 |
errors notNil ifTrue:[ |
1792 |
s nextPutAll: |
|
3147 | 1793 |
'STC won''t compile such code, therefore you must fix it before committing' |
3488 | 1794 |
]. |
2854 | 1795 |
] |
1796 |
||
1797 |
"Modified: / 11-04-2012 / 15:51:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1798 |
! |
|
1799 |
||
1800 |
label |
|
1801 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1802 |
||
3160 | 1803 |
^ (errors notNil |
1804 |
ifTrue:[ 'Uncompilable method %1 >> %2' ] |
|
1805 |
ifFalse:[ 'Warnings for method %1 >> %2' ]) bindWith: className allBold with: selector allBold |
|
1806 |
||
2854 | 1807 |
|
1808 |
"Modified: / 11-04-2012 / 16:04:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1809 |
! ! |
|
1810 |
||
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1811 |
!ProjectProblem::MethodCompilabilityIssue1 methodsFor:'error handling'! |
2854 | 1812 |
|
3162 | 1813 |
addError:aMessage from: position to: endPos |
1814 |
errors isNil ifTrue:[ errors := OrderedCollection new]. |
|
1815 |
errors add: (Error message: aMessage from: position to: endPos) |
|
1816 |
! |
|
1817 |
||
1818 |
addWarning:aMessage from: position to: endPos |
|
1819 |
warnings isNil ifTrue:[ warnings := OrderedCollection new]. |
|
1820 |
warnings add: (Warning message: aMessage from: position to: endPos) |
|
1821 |
! |
|
1822 |
||
2854 | 1823 |
correctableError:aMessage position:position to:endPos from:aCompiler |
1824 |
"error notification during fileIn. |
|
1825 |
This is sent by the compiler/evaluator if it detects errors." |
|
1826 |
||
1827 |
self error:aMessage position:position to:endPos from:aCompiler. |
|
1828 |
^ false. "/ no correction |
|
1829 |
||
1830 |
"Created: / 30-07-1999 / 18:11:15 / cg" |
|
1831 |
"Modified: / 02-11-2010 / 12:58:54 / cg" |
|
1832 |
! |
|
1833 |
||
1834 |
correctableSelectorWarning:aMessage position:position to:endPos from:aCompiler |
|
1835 |
"warning notification during fileIn. |
|
1836 |
This is sent by the compiler/evaluator if it detects errors." |
|
1837 |
||
1838 |
self warning:aMessage position:position to:endPos from:aCompiler. |
|
1839 |
^ false. "/ no correction |
|
1840 |
||
1841 |
"Modified: / 02-11-2010 / 12:59:04 / cg" |
|
1842 |
! |
|
1843 |
||
1844 |
correctableWarning:aMessage position:position to:endPos from:aCompiler |
|
1845 |
"error notification during fileIn. |
|
1846 |
This is sent by the compiler/evaluator if it detects errors." |
|
1847 |
||
1848 |
self warning:aMessage position:position to:endPos from:aCompiler. |
|
1849 |
^ false |
|
1850 |
||
1851 |
"Created: / 02-11-2010 / 13:29:40 / cg" |
|
1852 |
! |
|
1853 |
||
1854 |
error:aMessage position:position to:endPos from:aCompiler |
|
1855 |
"error notification during fileIn. |
|
1856 |
This is sent by the compiler/evaluator if it detects errors." |
|
1857 |
||
2911 | 1858 |
"Argh!!!!!!!! If its an ignorable error, why signal error!!!!!! Bad design, |
1859 |
even worse workaround. Sigh." |
|
3162 | 1860 |
(thisContext findNextContextWithSelector:#ignorableParseError: or:nil or:nil) notNil |
1861 |
"/ thisContext sender sender sender sender selector == #ignorableParseError: |
|
1862 |
ifTrue:[ ^ self ]. |
|
2911 | 1863 |
|
3162 | 1864 |
self addError:aMessage from: position to: endPos |
2854 | 1865 |
|
1866 |
"Created: / 30-07-1999 / 18:10:30 / cg" |
|
2911 | 1867 |
"Modified: / 10-09-2012 / 11:32:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2854 | 1868 |
! |
1869 |
||
1870 |
unusedVariableWarning:aMessage position:position to:endPos from:aCompiler |
|
1871 |
"warning notification during fileIn. |
|
1872 |
This is sent by the compiler/evaluator if it detects errors." |
|
1873 |
||
1874 |
^ self warning:aMessage position:position to:endPos from:aCompiler |
|
1875 |
! |
|
1876 |
||
1877 |
warning:aMessage position:position to:endPos from:aCompiler |
|
1878 |
"warning notification during fileIn - ignore it. |
|
1879 |
This is sent by the compiler/evaluator if it detects errors." |
|
1880 |
||
2911 | 1881 |
"/ No, do not show warnings now, too many false positives |
2854 | 1882 |
"/ warnings isNil ifTrue:[ warnings := OrderedCollection new]. |
1883 |
"/ warnings add: (Warning message: aMessage from: position to: endPos). |
|
1884 |
||
1885 |
"Created: / 30-07-1999 / 18:11:05 / cg" |
|
1886 |
"Modified (comment): / 12-04-2012 / 18:19:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1887 |
! ! |
|
1888 |
||
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1889 |
!ProjectProblem::MethodCompilabilityIssue1 methodsFor:'queries'! |
2854 | 1890 |
|
1891 |
hasIssue |
|
1892 |
^ (errors ? warnings) notNil |
|
1893 |
||
1894 |
"Created: / 11-04-2012 / 15:43:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1895 |
! ! |
|
1896 |
||
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1897 |
!ProjectProblem::MethodCompilabilityIssue1::Error class methodsFor:'instance creation'! |
2854 | 1898 |
|
1899 |
message: message from: startPosition to: endPosition |
|
1900 |
||
1901 |
^self new |
|
3779 | 1902 |
message: message; |
1903 |
startPosition: startPosition; |
|
1904 |
endPosition: endPosition; |
|
1905 |
yourself. |
|
2854 | 1906 |
|
1907 |
"Created: / 11-04-2012 / 15:38:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1908 |
! ! |
|
1909 |
||
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1910 |
!ProjectProblem::MethodCompilabilityIssue1::Error methodsFor:'accessing'! |
2854 | 1911 |
|
1912 |
endPosition |
|
1913 |
^ endPosition |
|
1914 |
! |
|
1915 |
||
1916 |
endPosition:something |
|
1917 |
endPosition := something. |
|
1918 |
! |
|
1919 |
||
1920 |
message |
|
1921 |
^ message |
|
1922 |
! |
|
1923 |
||
1924 |
message:something |
|
1925 |
message := something. |
|
1926 |
! |
|
1927 |
||
1928 |
startPosition |
|
1929 |
^ startPosition |
|
1930 |
! |
|
1931 |
||
1932 |
startPosition:something |
|
1933 |
startPosition := something. |
|
1934 |
! ! |
|
1935 |
||
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1936 |
!ProjectProblem::MethodCompilabilityIssue1::Error methodsFor:'accessing-description'! |
3160 | 1937 |
|
1938 |
descriptionOn: stream |
|
1939 |
||
1940 |
stream nextPutAll: message; space; nextPutAll:'(error)' |
|
1941 |
||
1942 |
"Created: / 11-04-2012 / 15:52:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1943 |
! ! |
|
1944 |
||
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1945 |
!ProjectProblem::MethodCompilabilityIssue1::Warning class methodsFor:'instance creation'! |
2854 | 1946 |
|
1947 |
message: message from: startPosition to: endPosition |
|
1948 |
||
1949 |
^self new |
|
3779 | 1950 |
message: message; |
1951 |
startPosition: startPosition; |
|
1952 |
endPosition: endPosition; |
|
1953 |
yourself. |
|
2854 | 1954 |
|
1955 |
"Created: / 11-04-2012 / 15:38:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1956 |
! ! |
|
1957 |
||
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1958 |
!ProjectProblem::MethodCompilabilityIssue1::Warning methodsFor:'accessing'! |
2854 | 1959 |
|
1960 |
endPosition |
|
1961 |
^ endPosition |
|
1962 |
! |
|
1963 |
||
1964 |
endPosition:something |
|
1965 |
endPosition := something. |
|
1966 |
! |
|
1967 |
||
1968 |
message |
|
1969 |
^ message |
|
1970 |
! |
|
1971 |
||
1972 |
message:something |
|
1973 |
message := something. |
|
1974 |
! |
|
1975 |
||
1976 |
startPosition |
|
1977 |
^ startPosition |
|
1978 |
! |
|
1979 |
||
1980 |
startPosition:something |
|
1981 |
startPosition := something. |
|
1982 |
! ! |
|
1983 |
||
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1984 |
!ProjectProblem::MethodCompilabilityIssue1::Warning methodsFor:'accessing-description'! |
2798 | 1985 |
|
3160 | 1986 |
descriptionOn: stream |
2798 | 1987 |
|
3160 | 1988 |
stream nextPutAll: message; space"/; nextPutAll:'(warning)' |
2798 | 1989 |
|
3160 | 1990 |
"Created: / 11-04-2012 / 15:52:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1991 |
! ! |
|
1992 |
||
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1993 |
!ProjectProblem::MethodCompilabilityIssue2 methodsFor:'accessing'! |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1994 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1995 |
severity |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1996 |
| severities | |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1997 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1998 |
severities := rules collect:[ :rule | rule severity ]. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1999 |
(severities includes: #error) ifTrue:[ ^ #error ]. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2000 |
^ #warning |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2001 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2002 |
"Modified: / 29-05-2014 / 15:41:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2003 |
! ! |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2004 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2005 |
!ProjectProblem::MethodCompilabilityIssue2 methodsFor:'accessing-description'! |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2006 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2007 |
description |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2008 |
"Return a (HTML) describing the problem." |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2009 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2010 |
| issuePrinter | |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2011 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2012 |
issuePrinter := |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2013 |
[:stream :rule| |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2014 |
stream nextPutAll:'<li>'. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2015 |
stream nextPutAll: rule name. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2016 |
stream nextPutAll: '<br></br>'. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2017 |
stream nextPutAll:'<p>'. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2018 |
stream nextPutAll: rule rationale. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2019 |
stream nextPutAll:'</p>'. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2020 |
stream nextPutAll:'</li>'. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2021 |
stream cr. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2022 |
]. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2023 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2024 |
^ String streamContents:[:s| |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2025 |
s |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2026 |
nextPutAll: 'The following problems have been found in '; |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2027 |
nextPutAll: self linkToMethod; |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2028 |
nextPutAll: ':'; cr; |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2029 |
nextPutAll: '<ul>'. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2030 |
rules ? #() do:[:rule|issuePrinter value: s value: rule]. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2031 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2032 |
s |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2033 |
nextPutAll: '</ul>'. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2034 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2035 |
errors notNil ifTrue:[ |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2036 |
s nextPutAll: |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2037 |
'STC won''t compile such code, therefore you must fix it before committing' |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2038 |
]. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2039 |
] |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2040 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2041 |
"Modified: / 29-05-2014 / 16:26:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2042 |
! |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2043 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2044 |
label |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2045 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2046 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2047 |
^ ((self severity == #error) |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2048 |
ifTrue:[ 'Uncompilable method %1 >> %2' ] |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2049 |
ifFalse:[ 'Warnings for method %1 >> %2' ]) bindWith: className allBold with: selector allBold |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2050 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2051 |
"Modified: / 29-05-2014 / 15:39:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2052 |
! ! |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2053 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2054 |
!ProjectProblem::MethodCompilabilityIssue2 methodsFor:'adding & removing'! |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2055 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2056 |
addViolation: anRBLintRule |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2057 |
rules isNil ifTrue:[ rules := OrderedCollection new ]. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2058 |
rules add: anRBLintRule |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2059 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2060 |
"Created: / 29-05-2014 / 15:42:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2061 |
! ! |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2062 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2063 |
!ProjectProblem::MethodCompilabilityIssue2 methodsFor:'queries'! |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2064 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2065 |
hasIssue |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2066 |
^ rules notEmptyOrNil |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2067 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2068 |
"Created: / 11-04-2012 / 15:43:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2069 |
"Modified: / 29-05-2014 / 15:41:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2070 |
! ! |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
2071 |
|
3160 | 2072 |
!ProjectProblem::MethodInNoPackage methodsFor:'accessing-description'! |
2073 |
||
3217 | 2074 |
alreadyFixed |
3449 | 2075 |
| m | |
2076 |
||
2077 |
"/ One may "fix" the problem by actually removing the method. |
|
3790 | 2078 |
"/ In this case, also consider problem as "fixed". |
3449 | 2079 |
m := self method. |
2080 |
^ m isNil or:[self method package ~= PackageId noProjectID] |
|
2081 |
||
2082 |
"Modified (format): / 19-12-2013 / 15:38:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3217 | 2083 |
! |
2084 |
||
3160 | 2085 |
description |
2086 |
"Return a (HTML) describing the problem." |
|
2087 |
||
2088 |
^ |
|
2089 |
'Method %1 does not belong to any package. Such methods |
|
2090 |
are not committed and will be lost when you restart/recompile. |
|
3342 | 2091 |
Especially, it will not be included when you generate a compiled class library. |
2092 |
However, it will be kept in the changes file, so it is not completely lost. |
|
2093 |
The method should be moved to some package, %2 maybe?' |
|
3160 | 2094 |
bindWith: (self linkToMethod) |
3342 | 2095 |
with: package |
3160 | 2096 |
|
2097 |
"Modified: / 23-02-2012 / 14:21:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2854 | 2098 |
! |
2099 |
||
2798 | 2100 |
label |
2101 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
2102 |
||
3160 | 2103 |
^'Unpackaged method %1 >> %2' bindWith: className allBold with: selector allBold |
2798 | 2104 |
|
2105 |
"Modified: / 23-02-2012 / 14:19:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2106 |
! ! |
|
2107 |
||
3549 | 2108 |
!ProjectProblem::MethodInNoPackage methodsFor:'fixing'! |
2109 |
||
2110 |
doMoveAllListedMethodsToPackage |
|
2111 |
"move all listed methods to the package. |
|
2112 |
Return false if fix fails, true otherwise" |
|
2113 |
||
2114 |
| m any | |
|
2115 |
||
2116 |
any := false. |
|
2117 |
self allUnfixedProblemsOfMyKindDo:[:p | |
|
2118 |
m := p method. |
|
2119 |
m notNil ifTrue:[ |
|
2120 |
m package: package. |
|
2121 |
any := true. |
|
2122 |
] |
|
2123 |
]. |
|
2124 |
^ any |
|
2125 |
! |
|
2126 |
||
2127 |
doMoveMethodToPackage |
|
2128 |
"move the method to the package. |
|
2129 |
Return false if fix fails, true otherwise" |
|
2130 |
||
2131 |
| m | |
|
2132 |
||
2133 |
m := self method. |
|
2134 |
m notNil ifTrue:[ |
|
2135 |
m package: package. |
|
2136 |
^ true |
|
2137 |
] ifFalse:[ |
|
2138 |
^ false |
|
2139 |
] |
|
2140 |
! |
|
2141 |
||
2142 |
fixes |
|
3790 | 2143 |
"return a list of description-actionBlock pairs for possible fixes" |
2144 |
||
3549 | 2145 |
|moveThisToPackage moveAllToTheirPackage| |
2146 |
||
2147 |
moveThisToPackage := |
|
3809 | 2148 |
{ |
2149 |
('Move method to package "%1"' bindWith:package) . |
|
3549 | 2150 |
[ self doMoveMethodToPackage ] |
2151 |
}. |
|
2152 |
||
2153 |
self countOtherProblemsOfThisKind > 0 ifTrue:[ |
|
2154 |
moveAllToTheirPackage := |
|
2155 |
{ |
|
3809 | 2156 |
('Move all listed unpackaged methods to package "%1"' bindWith:package) . |
3549 | 2157 |
[ self doMoveAllListedMethodsToPackage ] |
2158 |
}. |
|
2159 |
||
2160 |
^ { |
|
2161 |
moveThisToPackage . |
|
2162 |
moveAllToTheirPackage |
|
2163 |
} |
|
2164 |
]. |
|
2165 |
||
2166 |
^ { |
|
2167 |
moveThisToPackage |
|
2168 |
} |
|
2169 |
||
2170 |
"Created: / 26-07-2012 / 09:53:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2171 |
! ! |
|
2172 |
||
3790 | 2173 |
!ProjectProblem::MethodListedInOtherPackage methodsFor:'accessing'! |
2174 |
||
2175 |
otherProjectDefinitionClasses |
|
2176 |
^ otherProjectDefinitionClasses |
|
2177 |
! |
|
2178 |
||
2179 |
otherProjectDefinitionClasses:aCollectionOfClasses |
|
2180 |
otherProjectDefinitionClasses := aCollectionOfClasses. |
|
2181 |
! ! |
|
2182 |
||
2183 |
!ProjectProblem::MethodListedInOtherPackage methodsFor:'accessing-description'! |
|
2184 |
||
2185 |
alreadyFixed |
|
2186 |
| m | |
|
2187 |
||
2188 |
"/ One may "fix" the problem by actually removing the method. |
|
2189 |
"/ In this case, also consider problem as "fixed". |
|
2190 |
m := self method. |
|
2191 |
^ m isNil |
|
2192 |
or:[otherProjectDefinitionClasses isEmptyOrNil |
|
3809 | 2193 |
or:[(otherProjectDefinitionClasses contains:[:cls | cls extensionMethods includes:m]) not]] |
3790 | 2194 |
! |
2195 |
||
2196 |
description |
|
2197 |
"Return a (HTML) describing the problem." |
|
2198 |
||
2199 |
^ |
|
2200 |
'Method "%1" is also listed in "%2". |
|
2201 |
The method may only be present in exactly one package, "%3" perhaps?' |
|
2202 |
bindWith: (self linkToMethod) |
|
2203 |
with: (otherProjectDefinitionClasses size == 1 |
|
2204 |
ifTrue:[ self linkToPackage: (otherProjectDefinitionClasses first package) ] |
|
2205 |
ifFalse:[ '%1 other packages' bindWith:otherProjectDefinitionClasses size ]) |
|
2206 |
with: (self linkToPackage:package) |
|
2207 |
! |
|
2208 |
||
2209 |
label |
|
2210 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
2211 |
||
2212 |
^'Method %1 >> %2 also present in other pacakge(s)' bindWith: className allBold with: selector allBold |
|
2213 |
! ! |
|
2214 |
||
2215 |
!ProjectProblem::MethodListedInOtherPackage methodsFor:'fixing'! |
|
2216 |
||
2217 |
doRemoveMethodFromOtherPackages |
|
2218 |
"remove the method to the other package(s). |
|
2219 |
Return false if fix fails, true otherwise" |
|
2220 |
||
2221 |
| m | |
|
2222 |
||
2223 |
m := self method. |
|
2224 |
m isNil ifTrue:[^ false]. |
|
2225 |
||
2226 |
m package: package. |
|
2227 |
otherProjectDefinitionClasses do:[:each | |
|
2228 |
each excludeMethods:(Array with:m) usingCompiler:nil. |
|
2229 |
]. |
|
2230 |
UserNotification notify: ('Other ProjectDefinition updated. Do not forget to check that one in also!!'). |
|
2231 |
^ true. |
|
2232 |
! |
|
2233 |
||
2234 |
fixes |
|
2235 |
"return a list of description-actionBlock pairs for possible fixes" |
|
2236 |
||
2237 |
|removeThisFromOtherPackages| |
|
2238 |
||
2239 |
removeThisFromOtherPackages := |
|
2240 |
{ |
|
2241 |
('Remove method from other package(s)') . |
|
2242 |
[ self doRemoveMethodFromOtherPackages ] |
|
2243 |
}. |
|
2244 |
||
2245 |
^ { |
|
2246 |
removeThisFromOtherPackages |
|
2247 |
} |
|
2248 |
! ! |
|
2249 |
||
3160 | 2250 |
!ProjectProblem::ExtensionMethodListedButDoesNotExist methodsFor:'accessing-description'! |
2798 | 2251 |
|
2252 |
description |
|
2253 |
"Return a (HTML) describing the problem." |
|
2254 |
||
3166 | 2255 |
^'Method %1 listed in %3 but does not exist. |
2256 |
The package will compile but may fail to (auto)load from sources. |
|
2798 | 2257 |
|
3166 | 2258 |
It is recommended to remove the method from the list (%3).' |
2259 |
bindWith: (self linkToClass: (Smalltalk classNamed: className) selector: selector) "className" |
|
2260 |
with: selector |
|
2261 |
with: (self linkToClass: self packageDefinitionClass class selector: #extensionMethodNames) |
|
2798 | 2262 |
|
2263 |
"Modified: / 23-02-2012 / 15:18:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2264 |
! |
|
2265 |
||
2266 |
label |
|
2267 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
2268 |
||
3160 | 2269 |
^'Extension method %1 >> %2 listed but not existing' bindWith: className allBold with: selector allBold |
2798 | 2270 |
|
2271 |
"Modified: / 23-02-2012 / 14:22:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2272 |
! ! |
|
2273 |
||
3549 | 2274 |
!ProjectProblem::ExtensionMethodListedButDoesNotExist methodsFor:'fixing'! |
3204 | 2275 |
|
2276 |
fixes |
|
3790 | 2277 |
"return a list of description-actionBlock pairs for possible fixes" |
2278 |
||
2279 |
^ { |
|
2280 |
{ |
|
2281 |
'Remove from the extensionMethodNames list' . |
|
2282 |
[ self doRemoveNamedMethodFromExtensionsList ] |
|
2283 |
} |
|
2284 |
} |
|
3204 | 2285 |
|
2286 |
"Created: / 26-07-2012 / 10:41:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2287 |
! ! |
|
2288 |
||
2854 | 2289 |
!ProjectProblem::MethodSourceCorrupted methodsFor:'accessing'! |
2290 |
||
3160 | 2291 |
severity |
2292 |
"Return a severity - one of #error, #warning, #info" |
|
2293 |
||
2294 |
^#error |
|
2295 |
||
2296 |
"Created: / 11-04-2012 / 12:47:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2297 |
! ! |
|
2298 |
||
2299 |
!ProjectProblem::MethodSourceCorrupted methodsFor:'accessing-description'! |
|
2300 |
||
2854 | 2301 |
description |
2302 |
"Return a (HTML) describing the problem." |
|
2303 |
||
2304 |
^ |
|
2305 |
'Source code for %1 is <b>corrupted</b>. This is likely because |
|
2306 |
the binary class version does not match the source file. This may happen, |
|
3488 | 2307 |
for instance, if you compile a class library and then edit the ".st" file, |
2308 |
or you have checked out from the SCM into the file system over the existing source code, |
|
2309 |
from which the class was compiled. |
|
2310 |
<P>Be very careful with checkin or fileOut (do NOT save over any existing file), |
|
2311 |
and check the results for currupt source code, |
|
2312 |
<P>Sometimes, you can fix this by disabling the "Use Local Source" in the SCM manager''s settings |
|
2313 |
dialog. If that does not help, it is recommended to leave ST/X, restore the old source or compile a system |
|
2314 |
based on the current source, restart ST/X, reapply the changes via the Changebrowser and commit then.' |
|
2911 | 2315 |
bindWith: (self linkToMethod) |
3488 | 2316 |
with: package |
2854 | 2317 |
|
2318 |
"Modified: / 11-04-2012 / 12:47:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2319 |
! |
|
2320 |
||
2321 |
label |
|
2322 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
2323 |
||
3160 | 2324 |
^ 'Corrupted source code for %1 >> %2' bindWith: className allBold with: selector allBold |
2854 | 2325 |
|
2326 |
"Modified: / 11-04-2012 / 12:42:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3160 | 2327 |
! ! |
2328 |
||
2329 |
!ProjectProblem::MethodSourceNotAvailable methodsFor:'accessing'! |
|
2854 | 2330 |
|
2331 |
severity |
|
2332 |
"Return a severity - one of #error, #warning, #info" |
|
2333 |
||
2334 |
^#error |
|
2335 |
||
3160 | 2336 |
"Created: / 11-04-2012 / 12:47:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2854 | 2337 |
! ! |
2338 |
||
3160 | 2339 |
!ProjectProblem::MethodSourceNotAvailable methodsFor:'accessing-description'! |
2854 | 2340 |
|
2341 |
description |
|
2342 |
"Return a (HTML) describing the problem." |
|
2343 |
||
2344 |
^ |
|
3147 | 2345 |
'Source code for %1 is not available. Check your package path |
2854 | 2346 |
and/or source code management settings. |
2347 |
' |
|
2911 | 2348 |
bindWith: (self linkToMethod) |
3779 | 2349 |
with: package |
2854 | 2350 |
|
2351 |
"Modified: / 11-04-2012 / 12:44:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2352 |
! |
|
2353 |
||
2354 |
label |
|
2355 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
2356 |
||
3160 | 2357 |
^ 'Unavailable source code for %1 >> %2' bindWith: className allBold with: selector allBold |
2854 | 2358 |
|
2359 |
"Modified: / 11-04-2012 / 12:41:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3160 | 2360 |
! ! |
2361 |
||
2362 |
!ProjectProblem::ProjectDefinitionDoesNotExist methodsFor:'accessing'! |
|
2854 | 2363 |
|
2364 |
severity |
|
2365 |
"Return a severity - one of #error, #warning, #info" |
|
2366 |
||
2367 |
^#error |
|
2368 |
||
3160 | 2369 |
"Created: / 11-04-2012 / 12:48:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2854 | 2370 |
! ! |
2371 |
||
3160 | 2372 |
!ProjectProblem::ProjectDefinitionDoesNotExist methodsFor:'accessing-description'! |
2798 | 2373 |
|
2374 |
description |
|
2375 |
"Return a (HTML) describing the problem." |
|
2376 |
||
3152 | 2377 |
package = 'stx' ifTrue:[ |
3198 | 2378 |
^ |
3154 | 2379 |
'Move your code to another package. |
3198 | 2380 |
<br>The package name "stx" is reserveed for exept''s ST/X development.' |
3152 | 2381 |
]. |
2382 |
||
2798 | 2383 |
^ |
3152 | 2384 |
'A project definition class for package "%1" does not exist. |
2385 |
<br>Project definition classes keep the meta information of a package, |
|
2386 |
such as contents and build parameters. |
|
3198 | 2387 |
You <b>must</b> create it, otherwise package management won''t work, |
2388 |
and the package cannot be compiled to a binary dll.' |
|
3152 | 2389 |
bindWith: package |
2798 | 2390 |
|
2391 |
"Modified: / 23-02-2012 / 13:29:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2392 |
! |
|
2393 |
||
2394 |
label |
|
3152 | 2395 |
^'Project definition class for "%1" does not exist' bindWith: package |
2798 | 2396 |
|
2397 |
"Modified: / 23-02-2012 / 13:21:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2398 |
! ! |
|
2399 |
||
3152 | 2400 |
!ProjectProblem::ProjectDefinitionDoesNotExist methodsFor:'fixing'! |
2401 |
||
3225 | 2402 |
alreadyFixed |
2403 |
^ (ProjectDefinition definitionClassForPackage:package) notNil |
|
2404 |
! |
|
2405 |
||
3152 | 2406 |
doCreateAs:whatType |
3198 | 2407 |
|prjDef| |
2408 |
||
2409 |
prjDef := ProjectDefinition |
|
2410 |
definitionClassForPackage:package |
|
2411 |
projectType: whatType |
|
2412 |
createIfAbsent:true. |
|
2413 |
||
2414 |
prjDef |
|
2415 |
updateMethodsCodeUsingCompiler:Compiler |
|
2416 |
ignoreOldDefinition:true |
|
3152 | 2417 |
! |
2418 |
||
2419 |
doCreateAsGUIApplication |
|
2420 |
self doCreateAs:ProjectDefinition guiApplicationType |
|
2421 |
! |
|
2422 |
||
2423 |
doCreateAsLibrary |
|
2424 |
self doCreateAs:ProjectDefinition libraryType |
|
2425 |
! |
|
2426 |
||
2427 |
doCreateAsNonGUIApplication |
|
2428 |
self doCreateAs:ProjectDefinition nonGuiApplicationType |
|
2429 |
! |
|
2430 |
||
2431 |
fixes |
|
3790 | 2432 |
"return a list of description-actionBlock pairs for possible fixes" |
2433 |
||
3152 | 2434 |
package = 'stx' ifTrue:[ ^ #() ]. |
2435 |
||
3154 | 2436 |
^ Array |
3792 | 2437 |
with: (Array with: 'Create as Library' with: [ self doCreateAsLibrary ] ) |
2438 |
with: (Array with: 'Create as GUI Application' with: [ self doCreateAsGUIApplication ] ) |
|
2439 |
with: (Array with: 'Create as non-GUI Application' with: [ self doCreateAsNonGUIApplication ] ) |
|
3152 | 2440 |
! ! |
2441 |
||
2798 | 2442 |
!ProjectProblem class methodsFor:'documentation'! |
2443 |
||
2912 | 2444 |
version |
3894 | 2445 |
^ '$Header$' |
2912 | 2446 |
! |
2447 |
||
2448 |
version_CVS |
|
3894 | 2449 |
^ '$Header$' |
2912 | 2450 |
! |
2451 |
||
2854 | 2452 |
version_SVN |
3894 | 2453 |
^ '$Id$' |
2798 | 2454 |
! ! |
3160 | 2455 |