-
-
Notifications
You must be signed in to change notification settings - Fork 353
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a rule to discourage the usage of World/ActiveWorld
- Loading branch information
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
" | ||
The direct use of the global variables World and ActiveWorld is incorrect. | ||
Use ""self currentWorld"" instead. | ||
" | ||
Class { | ||
#name : #RBUsesWorldGlobalRule, | ||
#superclass : #ReNodeBasedRule, | ||
#category : #'GeneralRules-Migrated' | ||
} | ||
|
||
{ #category : #accessing } | ||
RBUsesWorldGlobalRule class >> uniqueIdentifierName [ | ||
"This number should be unique and should change only when the rule completely change semantics" | ||
|
||
^'UsesWorldGlobalRule' | ||
] | ||
|
||
{ #category : #running } | ||
RBUsesWorldGlobalRule >> check: aNode forCritiquesDo: aCriticBlock [ | ||
|
||
(aNode isVariable | ||
and: [ aNode isGlobal | ||
and: [ #(#World #ActiveWorld) includes: aNode name ] ]) | ||
ifFalse: [ ^ self ]. | ||
|
||
aCriticBlock cull: (self critiqueFor: aNode) | ||
] | ||
|
||
{ #category : #accessing } | ||
RBUsesWorldGlobalRule >> group [ | ||
^ 'Bugs' | ||
] | ||
|
||
{ #category : #accessing } | ||
RBUsesWorldGlobalRule >> name [ | ||
^ 'Uses World/ActiveWorld directly' | ||
] | ||
|
||
{ #category : #accessing } | ||
RBUsesWorldGlobalRule >> severity [ | ||
|
||
^ #warning | ||
] |