Skip to content

Commit

Permalink
ReReferencesObsoleteClassRule, fix ReGlobalVariablesUsageRule as it w…
Browse files Browse the repository at this point in the history
…as wrongly detecting
  • Loading branch information
MarcusDenker committed Jul 17, 2020
1 parent de6c80c commit 4d6fda9
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/GeneralRules/ReGlobalVariablesUsageRule.class.st
Expand Up @@ -21,7 +21,8 @@ ReGlobalVariablesUsageRule >> check: aMethod forCritiquesDo: aCriticBlock [
node isVariable and: [
node variable isGlobalVariable and: [
(self isKnownGlobal: node name) not and: [
node variable isGlobalClassNameBinding not ] ] ] ]
node variable value isObsolete not and: [
node variable isGlobalClassNameBinding not ] ] ] ] ]
thenDo: [ :node |
aCriticBlock cull: (self
createTrivialCritiqueOn: aMethod
Expand Down
40 changes: 40 additions & 0 deletions src/GeneralRules/ReReferencesObsoleteClassRule.class.st
@@ -0,0 +1,40 @@
"
You are referencing a class that is obsolete, that is, it has been removed
"
Class {
#name : #ReReferencesObsoleteClassRule,
#superclass : #ReNodeBasedRule,
#category : #'GeneralRules-Migrated'
}

{ #category : #helpers }
ReReferencesObsoleteClassRule >> basicCheck: aNode [
^ aNode isVariable
and: [aNode isGlobal
"we can not use isGlobalClassNameBinding here"
and: [ aNode variable value isClassOrTrait
and: [ aNode variable value isObsolete ] ] ]
]

{ #category : #helpers }
ReReferencesObsoleteClassRule >> critiqueFor: aNode [
^ (super critiqueFor: aNode)
tinyHint: aNode name;
yourself
]

{ #category : #accessing }
ReReferencesObsoleteClassRule >> group [
^ 'Bugs'
]

{ #category : #accessing }
ReReferencesObsoleteClassRule >> name [
^ 'References an obsolete class'
]

{ #category : #accessing }
ReReferencesObsoleteClassRule >> severity [
^ #error
]

0 comments on commit 4d6fda9

Please sign in to comment.