Skip to content

Commit

Permalink
Move name on class side too
Browse files Browse the repository at this point in the history
  • Loading branch information
jecisc committed May 28, 2024
1 parent 05bc658 commit ae1f38a
Show file tree
Hide file tree
Showing 163 changed files with 838 additions and 857 deletions.
11 changes: 5 additions & 6 deletions src/General-Rules/FloatReferencesRule.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,17 @@ FloatReferencesRule class >> group [
^ 'Bugs'
]

{ #category : 'accessing' }
FloatReferencesRule class >> ruleName [
^ 'Access to a system class'
]

{ #category : 'running' }
FloatReferencesRule >> basicCheck: node [
node isGlobalVariable ifFalse: [ ^ false ].
^(self systemClassNames includes: node name)
]

{ #category : 'accessing' }
FloatReferencesRule >> name [

^ 'Access to a system class'
]

{ #category : 'accessing' }
FloatReferencesRule >> rationale [

Expand Down
10 changes: 5 additions & 5 deletions src/General-Rules/OverridesDeprecatedMethodRule.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ OverridesDeprecatedMethodRule class >> group [
^ 'Potential Bugs'
]

{ #category : 'accessing' }
OverridesDeprecatedMethodRule class >> ruleName [
^ 'Overrides a deprecated method'
]

{ #category : 'accessing' }
OverridesDeprecatedMethodRule class >> uniqueIdentifierName [
"This number should be unique and should change only when the rule completely change semantics"
Expand All @@ -34,8 +39,3 @@ OverridesDeprecatedMethodRule >> basicCheck: aMethod [

^ aMethod overriddenMethods anySatisfy: #isDeprecated
]

{ #category : 'accessing' }
OverridesDeprecatedMethodRule >> name [
^ 'Overrides a deprecated method'
]
10 changes: 5 additions & 5 deletions src/General-Rules/ReAddRemoveDependentsRule.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ ReAddRemoveDependentsRule class >> group [
^ 'Potential Bugs'
]

{ #category : 'accessing' }
ReAddRemoveDependentsRule class >> ruleName [
^ 'Number of addDependent: messages > removeDependent:'
]

{ #category : 'accessing' }
ReAddRemoveDependentsRule class >> uniqueIdentifierName [
"This number should be unique and should change only when the rule completely change semantics"
Expand All @@ -39,8 +44,3 @@ ReAddRemoveDependentsRule >> basicCheck: aClass [
removeSends := removeSends + (messages count: [ :each | each selector == #removeDependent:])].
^ addSends > removeSends
]

{ #category : 'accessing' }
ReAddRemoveDependentsRule >> name [
^ 'Number of addDependent: messages > removeDependent:'
]
10 changes: 5 additions & 5 deletions src/General-Rules/ReAllAnyNoneSatisfyRule.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ ReAllAnyNoneSatisfyRule class >> group [
^ 'Coding Idiom Violation'
]

{ #category : 'accessing' }
ReAllAnyNoneSatisfyRule class >> ruleName [
^ 'Replace with #allSatisfy:, #anySatisfy: or #noneSatisfy:'
]

{ #category : 'accessing' }
ReAllAnyNoneSatisfyRule class >> uniqueIdentifierName [
"This number should be unique and should change only when the rule completely change semantics"
Expand Down Expand Up @@ -95,11 +100,6 @@ ReAllAnyNoneSatisfyRule >> initialize [
`@condition ]'
]

{ #category : 'accessing' }
ReAllAnyNoneSatisfyRule >> name [
^ 'Replace with #allSatisfy:, #anySatisfy: or #noneSatisfy:'
]

{ #category : 'accessing' }
ReAllAnyNoneSatisfyRule >> rationale [
^ 'Replace ad-hoc implementations (using explicit logic based on do:) of allSatisfy:, anySatisfy: and noneSatisfy: by the adequate calls to #allSatisfy:, #anySatisfy: or #noneSatisfy:. '
Expand Down
11 changes: 5 additions & 6 deletions src/General-Rules/ReAsClassRule.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ ReAsClassRule class >> group [
^ 'Design Flaws'
]

{ #category : 'accessing' }
ReAsClassRule class >> ruleName [
^ 'Do not use #asClass & similar'
]

{ #category : 'initialization' }
ReAsClassRule >> initialize [

Expand All @@ -29,12 +34,6 @@ ReAsClassRule >> initialize [
replace: '`@expr asClassIfPresent: `@block' with: 'self class environment at: `@expr ifPresent: `@block'
]

{ #category : 'accessing' }
ReAsClassRule >> name [

^ 'Do not use #asClass & similar'
]

{ #category : 'accessing' }
ReAsClassRule >> severity [

Expand Down
10 changes: 5 additions & 5 deletions src/General-Rules/ReAsOrderedCollectionNotNeededRule.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ ReAsOrderedCollectionNotNeededRule class >> group [
^ 'Optimization'
]

{ #category : 'accessing' }
ReAsOrderedCollectionNotNeededRule class >> ruleName [
^ '#asOrderedCollection/#asArray not needed'
]

{ #category : 'accessing' }
ReAsOrderedCollectionNotNeededRule class >> uniqueIdentifierName [
"This number should be unique and should change only when the rule completely change semantics"
Expand All @@ -33,8 +38,3 @@ ReAsOrderedCollectionNotNeededRule >> initialize [
baseString := '``@receiver ' , collectionMessage , ' ``@arg '.
self replace: baseString , conversionMessage with: baseString ] ]
]

{ #category : 'accessing' }
ReAsOrderedCollectionNotNeededRule >> name [
^ '#asOrderedCollection/#asArray not needed'
]
11 changes: 5 additions & 6 deletions src/General-Rules/ReAssertWithBooleanEqualtiyRule.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ ReAssertWithBooleanEqualtiyRule class >> group [
^ 'Optimization'
]

{ #category : 'accessing' }
ReAssertWithBooleanEqualtiyRule class >> ruleName [
^ 'use deny: instead of assert:equals:'
]

{ #category : 'initialization' }
ReAssertWithBooleanEqualtiyRule >> initialize [

Expand All @@ -37,9 +42,3 @@ ReAssertWithBooleanEqualtiyRule >> initialize [
replace: 'self deny: `@expr identicalTo: true'
with: 'self deny: `@expr'
]

{ #category : 'accessing' }
ReAssertWithBooleanEqualtiyRule >> name [

^ 'use deny: instead of assert:equals:'
]
10 changes: 5 additions & 5 deletions src/General-Rules/ReAssignmentInBlockRule.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ ReAssignmentInBlockRule class >> group [
^ 'Coding Idiom Violation'
]

{ #category : 'accessing' }
ReAssignmentInBlockRule class >> ruleName [
^ 'Unnecessary assignment or return in block'
]

{ #category : 'accessing' }
ReAssignmentInBlockRule class >> uniqueIdentifierName [
"This number should be unique and should change only when the rule completely change semantics"
Expand All @@ -32,8 +37,3 @@ ReAssignmentInBlockRule >> initialize [
'[| `@temps | `@.Statements. `var := `@object] ifCurtailed: `@block'
'[| `@temps | `@.Statements. ^`@object] ifCurtailed: `@block' )
]

{ #category : 'accessing' }
ReAssignmentInBlockRule >> name [
^ 'Unnecessary assignment or return in block'
]
10 changes: 5 additions & 5 deletions src/General-Rules/ReAssignmentInIfTrueRule.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ ReAssignmentInIfTrueRule class >> group [
^ 'Optimization'
]

{ #category : 'accessing' }
ReAssignmentInIfTrueRule class >> ruleName [
^ 'Move variable assignment outside of single statement ifTrue:ifFalse: blocks'
]

{ #category : 'accessing' }
ReAssignmentInIfTrueRule class >> uniqueIdentifierName [
"This number should be unique and should change only when the rule completely change semantics"
Expand All @@ -39,11 +44,6 @@ ReAssignmentInIfTrueRule >> initialize [
with: '`variable := ``@Boolean ifFalse: [``@true] ifTrue: [``@false]'
]

{ #category : 'accessing' }
ReAssignmentInIfTrueRule >> name [
^ 'Move variable assignment outside of single statement ifTrue:ifFalse: blocks'
]

{ #category : 'accessing' }
ReAssignmentInIfTrueRule >> rationale [
^ 'Moving assignments outside blocks leads to shorter and more efficient code.'
Expand Down
10 changes: 5 additions & 5 deletions src/General-Rules/ReAssignmentWithoutEffectRule.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ ReAssignmentWithoutEffectRule class >> group [
^ 'Optimization'
]

{ #category : 'accessing' }
ReAssignmentWithoutEffectRule class >> ruleName [
^ 'Assignment has no effect'
]

{ #category : 'accessing' }
ReAssignmentWithoutEffectRule class >> uniqueIdentifierName [
"This number should be unique and should change only when the rule completely change semantics"
Expand All @@ -27,11 +32,6 @@ ReAssignmentWithoutEffectRule >> initialize [
self replace: '`var := `var' with: ''
]

{ #category : 'accessing' }
ReAssignmentWithoutEffectRule >> name [
^ 'Assignment has no effect'
]

{ #category : 'accessing' }
ReAssignmentWithoutEffectRule >> severity [
^ #information
Expand Down
10 changes: 5 additions & 5 deletions src/General-Rules/ReAtIfAbsentRule.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ ReAtIfAbsentRule class >> group [
^ 'Coding Idiom Violation'
]

{ #category : 'accessing' }
ReAtIfAbsentRule class >> ruleName [
^ 'at:ifAbsent: -> at:ifAbsentPut:'
]

{ #category : 'accessing' }
ReAtIfAbsentRule class >> uniqueIdentifierName [
"This number should be unique and should change only when the rule completely change semantics"
Expand Down Expand Up @@ -47,8 +52,3 @@ ReAtIfAbsentRule >> initialize [
``@.Statements.
``@object]'
]

{ #category : 'accessing' }
ReAtIfAbsentRule >> name [
^ 'at:ifAbsent: -> at:ifAbsentPut:'
]
10 changes: 5 additions & 5 deletions src/General-Rules/ReBadMessageRule.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ ReBadMessageRule class >> group [
^ 'Coding Idiom Violation'
]

{ #category : 'accessing' }
ReBadMessageRule class >> ruleName [
^ 'Sends "questionable" message'
]

{ #category : 'accessing' }
ReBadMessageRule class >> uniqueIdentifierName [
"This number should be unique and should change only when the rule completely change semantics"
Expand All @@ -36,11 +41,6 @@ ReBadMessageRule >> basicCheck: aNode [
^ self badSelectors includes: aNode selector
]

{ #category : 'accessing' }
ReBadMessageRule >> name [
^ 'Sends "questionable" message'
]

{ #category : 'accessing' }
ReBadMessageRule >> rationale [
^ 'Check methods that send messages that perform low level things.'
Expand Down
10 changes: 5 additions & 5 deletions src/General-Rules/ReBaselineProperlyPackagedRule.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ ReBaselineProperlyPackagedRule class >> group [
^ 'Design Flaws'
]

{ #category : 'accessing' }
ReBaselineProperlyPackagedRule class >> ruleName [
^ 'Baseline class not properly packaged in a package with the same name'
]

{ #category : 'manifest' }
ReBaselineProperlyPackagedRule class >> uniqueIdentifierName [
"This number should be unique and should change only when the rule completely change semantics"
Expand All @@ -38,11 +43,6 @@ ReBaselineProperlyPackagedRule >> basicCheck: aClass [
and: [ aClass package name ~= aClass name ]
]

{ #category : 'accessing' }
ReBaselineProperlyPackagedRule >> name [
^ 'Baseline class not properly packaged in a package with the same name'
]

{ #category : 'accessing' }
ReBaselineProperlyPackagedRule >> severity [
^ #information
Expand Down
12 changes: 5 additions & 7 deletions src/General-Rules/ReBaselineWithProperSuperclassRule.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ ReBaselineWithProperSuperclassRule class >> group [
^ 'Design Flaws'
]

{ #category : 'accessing' }
ReBaselineWithProperSuperclassRule class >> ruleName [
^ 'Custom Baseline class should be a subclass of predefined class BaselineOf'
]

{ #category : 'manifest' }
ReBaselineWithProperSuperclassRule class >> uniqueIdentifierName [
"This number should be unique and should change only when the rule completely change semantics"
Expand All @@ -39,13 +44,6 @@ ReBaselineWithProperSuperclassRule >> basicCheck: aClass [

]

{ #category : 'accessing' }
ReBaselineWithProperSuperclassRule >> name [

^ 'Custom Baseline class should be a subclass of predefined class BaselineOf'

]

{ #category : 'accessing' }
ReBaselineWithProperSuperclassRule >> severity [

Expand Down
10 changes: 5 additions & 5 deletions src/General-Rules/ReBetweenAndRule.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ ReBetweenAndRule class >> group [
^ 'Coding Idiom Violation'
]

{ #category : 'accessing' }
ReBetweenAndRule class >> ruleName [
^ '"a >= b and: [a <= c]" -> "a between: b and: c"'
]

{ #category : 'accessing' }
ReBetweenAndRule class >> uniqueIdentifierName [
"This number should be unique and should change only when the rule completely change semantics"
Expand Down Expand Up @@ -42,8 +47,3 @@ ReBetweenAndRule >> initialize [
replace: '``@c >= ``@a and: [``@b <= ``@a]' with: '``@a between: ``@b and: ``@c';
replace: '``@c >= ``@a & (``@b <= ``@a)' with: '``@a between: ``@b and: ``@c'
]

{ #category : 'accessing' }
ReBetweenAndRule >> name [
^ '"a >= b and: [a <= c]" -> "a between: b and: c"'
]
10 changes: 5 additions & 5 deletions src/General-Rules/ReBooleanPrecedenceRule.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ ReBooleanPrecedenceRule class >> group [
^ 'Potential Bugs'
]

{ #category : 'accessing' }
ReBooleanPrecedenceRule class >> ruleName [
^ 'Uses A | B = C instead of A | (B = C)'
]

{ #category : 'accessing' }
ReBooleanPrecedenceRule class >> uniqueIdentifierName [
"This number should be unique and should change only when the rule completely change semantics"
Expand All @@ -35,11 +40,6 @@ ReBooleanPrecedenceRule >> initialize [
'`@object1 & `@object2 ~~ `@object3' )
]

{ #category : 'accessing' }
ReBooleanPrecedenceRule >> name [
^ 'Uses A | B = C instead of A | (B = C)'
]

{ #category : 'accessing' }
ReBooleanPrecedenceRule >> severity [
^ #error
Expand Down
10 changes: 5 additions & 5 deletions src/General-Rules/ReCascadedNextPutAllsRule.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ ReCascadedNextPutAllsRule class >> group [
^ 'Coding Idiom Violation'
]

{ #category : 'accessing' }
ReCascadedNextPutAllsRule class >> ruleName [
^ 'Use cascaded nextPutAll:''s instead of #, in #nextPutAll:'
]

{ #category : 'accessing' }
ReCascadedNextPutAllsRule class >> uniqueIdentifierName [
"This number should be unique and should change only when the rule completely change semantics"
Expand All @@ -38,11 +43,6 @@ ReCascadedNextPutAllsRule >> initialize [
replace: '``@rcvr show: ``@object1 , ``@object2' with: '``@rcvr show: ``@object1; show: ``@object2'
]

{ #category : 'accessing' }
ReCascadedNextPutAllsRule >> name [
^ 'Use cascaded nextPutAll:''s instead of #, in #nextPutAll:'
]

{ #category : 'accessing' }
ReCascadedNextPutAllsRule >> rationale [
^ 'Use cascaded nextPutAll:''s instead of #, in #nextPutAll:.'
Expand Down
Loading

0 comments on commit ae1f38a

Please sign in to comment.