New code critique rule: RBSmalltalkGlobalsRule

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

New code critique rule: RBSmalltalkGlobalsRule

Marcus Denker-4
Hi,

I added a new rule: RBSmalltalkGlobalsRule

The idea is that this catches all uses of “Smalltalk” where instead “Smalltalk globals” should be used.

It is not yet complete, but has for now:

                replace: 'Smalltalk allClasses'
                        with: 'Smalltalk globals allClasses';
                replace: 'Smalltalk allClassesDo: `@statements'
                        with: 'Smalltalk globals allClassesDo: `@statements';
                replace: 'Smalltalk allTraits'
                        with: 'Smalltalk globals allTraits';
                replace: 'Smalltalk includes:`@statements'
                        with: 'Smalltalk globals includes: `@statements';
                replace: 'Smalltalk flushClassNameCache'
                        with: 'Smalltalk globals flushClassNameCache';
                replace: 'Smalltalk includesKey: `@statements'
                        with: 'Smalltalk globals includesKey: `@statements’.



        Marcus
Reply | Threaded
Open this post in threaded view
|

Re: New code critique rule: RBSmalltalkGlobalsRule

Marcus Denker-4
another change I did is to RBNotEliminationRule a case for isEmpty:

replace: '``@object isEmpty not' with: '``@object isNotEmpty';


        Marcus

https://pharo.fogbugz.com/f/cases/16343/add-isEmpty-not-to-RBNotEliminationRule

> On 21 Aug 2015, at 15:13, Marcus Denker <[hidden email]> wrote:
>
> Hi,
>
> I added a new rule: RBSmalltalkGlobalsRule
>
> The idea is that this catches all uses of “Smalltalk” where instead “Smalltalk globals” should be used.
>
> It is not yet complete, but has for now:
>
> replace: 'Smalltalk allClasses'
> with: 'Smalltalk globals allClasses';
> replace: 'Smalltalk allClassesDo: `@statements'
> with: 'Smalltalk globals allClassesDo: `@statements';
> replace: 'Smalltalk allTraits'
> with: 'Smalltalk globals allTraits';
> replace: 'Smalltalk includes:`@statements'
> with: 'Smalltalk globals includes: `@statements';
> replace: 'Smalltalk flushClassNameCache'
> with: 'Smalltalk globals flushClassNameCache';
> replace: 'Smalltalk includesKey: `@statements'
> with: 'Smalltalk globals includesKey: `@statements’.
>
>
>
> Marcus