SmallSense__SmalltalkChecker.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Mon, 02 Sep 2013 14:45:35 +0100
changeset 78 16cd76c8d70c
parent 67 020b7461b15e
child 174 3e08d765d86f
permissions -rw-r--r--
Fix in SmallSense::Recognizer: use customized SmalltalkParser to parse smalltalk code. SmalltalkParser can do some basic error-recovery and thus provides better tree for completion.

"{ Package: 'jv:smallsense' }"

"{ NameSpace: SmallSense }"

SmalllintChecker subclass:#SmalltalkChecker
	instanceVariableNames:''
	classVariableNames:'Errors'
	poolDictionaries:''
	category:'SmallSense-Smalltalk-Lint'
!

!SmalltalkChecker class methodsFor:'documentation'!

documentation
"
    SmallSenseChecker is customized SmalllintChecker used
    by SmallSense's checking services. Do not use it in your
    code, use SmalllintChecker instead.

    [author:]
        Jan Vrany <jan.vrany@fit.cvut.cz>

    [instance variables:]

    [class variables:]

    [see also:]
        SmalllintChecker
        SmallSenseService

"
! !

!SmalltalkChecker class methodsFor:'initialization'!

initialize
    "Invoked at system start or when the class is dynamically loaded."

    "/ please change as required (and remove this comment)

    Errors := Dictionary new.

    "Modified: / 06-09-2012 / 14:18:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!SmalltalkChecker class methodsFor:'accessing'!

forceDisabledRules
    "Return a list of rule class names that
     are never run by SmallSense's checker - they
     are either buggy (i.e.. not ready to be run
     incrementally) or it does not make sense to run them
     Add with care!!!!!!
    "

    ^ #(
        RBLawOfDemeterRule          "/ Too many false positives, hard to fix
        RBImplementedNotSentRule    "/ Uses Context>>#computeLiterals whichs toooo slow.
        RBSentNotImplementedRule    "/ Uses Context>>#computeLiterals whichs toooo slow.
        RBUndeclaredReferenceRule   "/
    )

    "Created: / 17-02-2012 / 13:10:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!SmalltalkChecker methodsFor:'private'!

checkClass: aClass 

    "Nothing to do, SmallSense checker checks only methods"
    context selectedClass: aClass.

    "Created: / 16-02-2012 / 16:12:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

checkMethodsForClass: aClass

    environment selectorsForClass: aClass do: [:sel|
        context selector: sel.
        context parseTree notNil ifTrue:[
            rule flattened do:[:each|
                [
                    each checkMethod: context.
                ] on: Error do:[:ex|
                    Service debugging ifTrue:[
                        Service debugging: false.
                        ex pass.
                    ] ifFalse:[
                        Errors at: each class ifAbsentPut:[ context method source ].
                    ]
                ]
            ].
        ].
    ]

    "Modified: / 24-08-2010 / 21:32:39 / Jan Vrany <enter your email here>"
    "Created: / 17-02-2012 / 00:50:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!SmalltalkChecker class methodsFor:'documentation'!

version_HG

    ^ '$Changeset: <not expanded> $'
!

version_SVN
    ^ '$Id: SmallSenseChecker.st 8046 2012-09-06 16:38:47Z vranyj1 $'
! !


SmalltalkChecker initialize!