7770
|
1 |
"
|
|
2 |
COPYRIGHT (c) 2007 by eXept Software AG
|
|
3 |
All Rights Reserved
|
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
"{ Package: 'stx:libtool' }"
|
|
13 |
|
|
14 |
"{ NameSpace: Tools }"
|
|
15 |
|
|
16 |
Object subclass:#CodeCritics
|
|
17 |
instanceVariableNames:'code critics'
|
|
18 |
classVariableNames:''
|
|
19 |
poolDictionaries:''
|
|
20 |
category:'Interface-Browsers-New'
|
|
21 |
!
|
|
22 |
|
|
23 |
!CodeCritics class methodsFor:'documentation'!
|
|
24 |
|
|
25 |
copyright
|
|
26 |
"
|
|
27 |
COPYRIGHT (c) 2007 by eXept Software AG
|
|
28 |
All Rights Reserved
|
|
29 |
|
|
30 |
This software is furnished under a license and may be used
|
|
31 |
only in accordance with the terms of that license and with the
|
|
32 |
inclusion of the above copyright notice. This software may not
|
|
33 |
be provided or otherwise made available to, or used by, any
|
|
34 |
other person. No title to or ownership of the software is
|
|
35 |
hereby transferred.
|
|
36 |
"
|
|
37 |
!
|
|
38 |
|
|
39 |
documentation
|
|
40 |
"
|
|
41 |
extracted critics from the browser
|
|
42 |
For now, not much is found here - however, it will eventually grow and should collect
|
|
43 |
the critics in the parser as well.
|
|
44 |
|
|
45 |
[author:]
|
|
46 |
Claus Gittinger (cg@exept.de)
|
|
47 |
"
|
|
48 |
! !
|
|
49 |
|
|
50 |
!CodeCritics class methodsFor:'critics'!
|
|
51 |
|
|
52 |
checkCodeQuality:code
|
|
53 |
^ (self new code:code) checkCodeQuality
|
|
54 |
|
|
55 |
"Created: / 27-03-2007 / 21:41:50 / cg"
|
|
56 |
! !
|
|
57 |
|
|
58 |
!CodeCritics methodsFor:'accessing'!
|
|
59 |
|
|
60 |
code:something
|
|
61 |
code := something.
|
|
62 |
! !
|
|
63 |
|
|
64 |
!CodeCritics methodsFor:'critics'!
|
|
65 |
|
7780
|
66 |
checkBadIndentationOfReturns
|
|
67 |
"we want returns to be indented correctly"
|
7770
|
68 |
|
|
69 |
code asCollectionOfLines keysAndValuesDo:[:lineNr :eachLine |
|
|
70 |
|lineString column|
|
|
71 |
|
|
72 |
lineString := eachLine string.
|
|
73 |
(lineString withoutLeadingSeparators startsWith:'^') ifTrue:[
|
|
74 |
column := lineString indexOf:$^.
|
|
75 |
(column-1) \\ 4 ~~ 0 ifTrue:[
|
|
76 |
self addCritic:'bad indentation' line:lineNr.
|
|
77 |
].
|
|
78 |
]
|
|
79 |
].
|
|
80 |
|
|
81 |
"Created: / 27-03-2007 / 21:41:10 / cg"
|
|
82 |
!
|
|
83 |
|
|
84 |
checkCodeQuality
|
|
85 |
self checkBadIndentationOfReturns.
|
|
86 |
^ critics
|
|
87 |
|
|
88 |
"Created: / 27-03-2007 / 21:42:11 / cg"
|
|
89 |
! !
|
|
90 |
|
7780
|
91 |
!CodeCritics methodsFor:'helpers'!
|
|
92 |
|
|
93 |
addCritic:msg line:lineNr
|
|
94 |
critics isNil ifTrue:[
|
|
95 |
critics := OrderedCollection new.
|
|
96 |
].
|
|
97 |
critics add:(lineNr -> msg)
|
|
98 |
|
|
99 |
"Created: / 27-03-2007 / 21:47:09 / cg"
|
|
100 |
! !
|
|
101 |
|
7770
|
102 |
!CodeCritics class methodsFor:'documentation'!
|
|
103 |
|
10033
|
104 |
version_CVS
|
|
105 |
^ '$Header: /cvs/stx/stx/libtool/Tools__CodeCritics.st,v 1.3 2011-07-03 13:31:36 cg Exp $'
|
|
106 |
!
|
|
107 |
|
|
108 |
version_SVN
|
|
109 |
^ '§Id: Tools__CodeCritics.st 7487 2009-10-28 21:11:04Z vranyj1 §'
|
7770
|
110 |
! !
|