author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Wed, 19 Jul 2017 09:42:32 +0200 | |
branch | jv |
changeset 17619 | edb119820fcb |
parent 12431 | 9f0c59c742d5 |
child 18532 | cccb41254edf |
permissions | -rw-r--r-- |
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 |
12123
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10033
diff
changeset
|
105 |
^ '§Header: /cvs/stx/stx/libtool/Tools__CodeCritics.st,v 1.3 2011/07/03 13:31:36 cg Exp §' |
10033 | 106 |
! |
107 |
||
12431
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
108 |
version_HG |
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
109 |
|
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
110 |
^ '$Changeset: <not expanded> $' |
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
111 |
! |
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
112 |
|
10033 | 113 |
version_SVN |
12128
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12123
diff
changeset
|
114 |
^ '$Id: Tools__CodeCritics.st 7854 2012-01-30 17:49:41Z vranyj1 $' |
12431
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
115 |
! ! |
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
116 |