Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
myroslavarm committed Apr 24, 2020
1 parent fe2815c commit 0197c5a
Show file tree
Hide file tree
Showing 12 changed files with 52 additions and 52 deletions.
2 changes: 1 addition & 1 deletion src/ReleaseTests/ReleaseTest.class.st
Expand Up @@ -297,7 +297,7 @@ ReleaseTest >> testShouldWorldMorphBeAfterFontClassesInStartupList [

{ #category : #tests }
ReleaseTest >> testTestCasesEndsWithTestOrTestCase [
self assertValidLintRule: ReTestClassNameShouldEndWithTest new
self assertValidLintRule: ReTestClassNameShouldEndWithTestRule new

]

Expand Down
Expand Up @@ -6,14 +6,14 @@ Class {

{ #category : #tests }
ReTestClassNameShouldEndWithTestTest >> testBasicCheck [
self assert: (testClass critiques noneSatisfy: [ :critic | critic rule class = ReTestClassNameShouldEndWithTest ]).
self assert: (testClass critiques noneSatisfy: [ :critic | critic rule class = ReTestClassNameShouldEndWithTestRule ]).

testClass rename: 'TotoTestCase'.

self assert: (testClass critiques noneSatisfy: [ :critic | critic rule class = ReTestClassNameShouldEndWithTest ]).
self assert: (testClass critiques noneSatisfy: [ :critic | critic rule class = ReTestClassNameShouldEndWithTestRule ]).

"test class name not endind with 'Test'"
testClass rename: 'Toto'.

self assert: (testClass critiques anySatisfy: [ :critic | critic rule class = ReTestClassNameShouldEndWithTest ])
self assert: (testClass critiques anySatisfy: [ :critic | critic rule class = ReTestClassNameShouldEndWithTestRule ])
]
Expand Up @@ -9,11 +9,11 @@ ReTestClassNotInPackageWithTestEndingNameTest >> testBasicCheck [

"test in wrong package raises critic"
self
assert: (testClass critiques anySatisfy: [ :critic | critic rule class = ReTestClassNotInPackageWithTestEndingName ]).
assert: (testClass critiques anySatisfy: [ :critic | critic rule class = ReTestClassNotInPackageWithTestEndingNameRule ]).

"move to correct package"
validTestPackage importClass: testClass.

self
assert: (testClass critiques noneSatisfy: [ :critic | critic rule class = ReTestClassNotInPackageWithTestEndingName ])
assert: (testClass critiques noneSatisfy: [ :critic | critic rule class = ReTestClassNotInPackageWithTestEndingNameRule ])
]
Expand Up @@ -4,18 +4,18 @@ When setting up a glamorous presentation it is recommended to pass blocks (or li
This affects the performance of inspector.
"
Class {
#name : #ReInspectorPresentationsNonBlockSetup,
#name : #ReInspectorPresentationsNonBlockSetupRule,
#superclass : #ReAbstractRule,
#category : #'Renraku-Rules'
}

{ #category : #'testing-interest' }
ReInspectorPresentationsNonBlockSetup class >> checksMethod [
ReInspectorPresentationsNonBlockSetupRule class >> checksMethod [
^ true
]

{ #category : #running }
ReInspectorPresentationsNonBlockSetup >> check: aMethod forCritiquesDo: aCriticBlock [
ReInspectorPresentationsNonBlockSetupRule >> check: aMethod forCritiquesDo: aCriticBlock [

(aMethod hasPragmaNamed: #gtInspectorPresentationOrder:) ifFalse: [ ^ self ].

Expand All @@ -36,18 +36,18 @@ ReInspectorPresentationsNonBlockSetup >> check: aMethod forCritiquesDo: aCriticB
]

{ #category : #accessing }
ReInspectorPresentationsNonBlockSetup >> group [
ReInspectorPresentationsNonBlockSetupRule >> group [
^ 'Optimization'
]

{ #category : #accessing }
ReInspectorPresentationsNonBlockSetup >> name [
ReInspectorPresentationsNonBlockSetupRule >> name [

^ 'Use blocks in scripting instead of plain messages'
]

{ #category : #private }
ReInspectorPresentationsNonBlockSetup >> presentationScriptingMathods [
ReInspectorPresentationsNonBlockSetupRule >> presentationScriptingMathods [

^ #(when: title: display: icon: with: send: format: sorted: tags:)
]
Expand Up @@ -4,18 +4,18 @@ If you execute some code during the method execution it will slow down the insp
Try to put all the code in blocks in the setup messages, such as #title:, #display:, #when:. Buy doing this your code will be executed lazily when the presentation is selected.
"
Class {
#name : #ReInspectorPresentationsNonlazyCode,
#name : #ReInspectorPresentationsNonlazyCodeRule,
#superclass : #ReAbstractRule,
#category : #'Renraku-Rules'
}

{ #category : #'testing-interest' }
ReInspectorPresentationsNonlazyCode class >> checksMethod [
ReInspectorPresentationsNonlazyCodeRule class >> checksMethod [
^ true
]

{ #category : #running }
ReInspectorPresentationsNonlazyCode >> check: aMethod forCritiquesDo: aCriticBlock [
ReInspectorPresentationsNonlazyCodeRule >> check: aMethod forCritiquesDo: aCriticBlock [

(aMethod hasPragmaNamed: #gtInspectorPresentationOrder:) ifFalse: [ ^ self ].

Expand All @@ -35,18 +35,18 @@ ReInspectorPresentationsNonlazyCode >> check: aMethod forCritiquesDo: aCriticBlo
]

{ #category : #accessing }
ReInspectorPresentationsNonlazyCode >> group [
ReInspectorPresentationsNonlazyCodeRule >> group [
^ 'Optimization'
]

{ #category : #accessing }
ReInspectorPresentationsNonlazyCode >> name [
ReInspectorPresentationsNonlazyCodeRule >> name [

^ 'Code executed outside of the presentation setup'
]

{ #category : #private }
ReInspectorPresentationsNonlazyCode >> presentation: aPresentation isTheLeftmostRecepientIn: aStatement [
ReInspectorPresentationsNonlazyCodeRule >> presentation: aPresentation isTheLeftmostRecepientIn: aStatement [

^ (aStatement isMessage or:
[ aStatement isCascade ]) and: [
Expand Down
@@ -1,40 +1,40 @@
Class {
#name : #RePackageManifestShouldBePackagedInManifestTag,
#name : #RePackageManifestShouldBePackagedInManifestTagRule,
#superclass : #ReAbstractRule,
#category : #'Renraku-Rules'
}

{ #category : #'testing - interest' }
RePackageManifestShouldBePackagedInManifestTag class >> checksClass [
RePackageManifestShouldBePackagedInManifestTagRule class >> checksClass [

^ true
]

{ #category : #running }
RePackageManifestShouldBePackagedInManifestTag >> basicCheck: aClass [
RePackageManifestShouldBePackagedInManifestTagRule >> basicCheck: aClass [

^ (aClass inheritsFrom: PackageManifest) and: [
((aClass package classesForClassTag: 'Manifest') includes: aClass) not ]
]

{ #category : #accessing }
RePackageManifestShouldBePackagedInManifestTag >> group [
RePackageManifestShouldBePackagedInManifestTagRule >> group [

^ 'Coding Idiom Violation'
]

{ #category : #accessing }
RePackageManifestShouldBePackagedInManifestTag >> name [
RePackageManifestShouldBePackagedInManifestTagRule >> name [
^ 'A package manifest should be tagged using ''Manifest'' class tag'
]

{ #category : #accessing }
RePackageManifestShouldBePackagedInManifestTag >> rationale [
RePackageManifestShouldBePackagedInManifestTagRule >> rationale [
^ 'Check if the package manifest is tagged in class category ''Manifest'' to align with other packages and fulfil common expectations.'
]

{ #category : #accessing }
RePackageManifestShouldBePackagedInManifestTag >> severity [
RePackageManifestShouldBePackagedInManifestTagRule >> severity [

^ #warning
]
Expand Up @@ -2,13 +2,13 @@
Rule to favour 'converting' method protocol over similar ones (like 'conversion' or other)
"
Class {
#name : #ReProperMethodProtocolNameRuleForConverting,
#name : #ReProperMethodProtocolNameForConvertingRule,
#superclass : #ReProperMethodProtocolNameRule,
#category : #'Renraku-Rules'
}

{ #category : #idioms }
ReProperMethodProtocolNameRuleForConverting >> protocolIdiom [
ReProperMethodProtocolNameForConvertingRule >> protocolIdiom [

^self use: 'converting' insteadOf: #('conversion' 'conversions')
]
Expand Up @@ -2,13 +2,13 @@
Rule to favour 'instance creation' method protocol over similar ones (like 'instance-creation' or other)
"
Class {
#name : #ReProperMethodProtocolNameRuleForInstanceCreation,
#name : #ReProperMethodProtocolNameForInstanceCreationRule,
#superclass : #ReProperMethodProtocolNameRule,
#category : #'Renraku-Rules'
}

{ #category : #idioms }
ReProperMethodProtocolNameRuleForInstanceCreation >> protocolIdiom [
ReProperMethodProtocolNameForInstanceCreationRule >> protocolIdiom [

^self use: 'instance creation' insteadOf: #('instance-creation' 'instances-creation' 'instances creation')
]
Expand Up @@ -2,13 +2,13 @@
Rule to favour 'utilities' method protocol over similar ones (like 'utils' or other)
"
Class {
#name : #ReProperMethodProtocolNameRuleForUtilities,
#name : #ReProperMethodProtocolNameForUtilitiesRule,
#superclass : #ReProperMethodProtocolNameRule,
#category : #'Renraku-Rules'
}

{ #category : #idioms }
ReProperMethodProtocolNameRuleForUtilities >> protocolIdiom [
ReProperMethodProtocolNameForUtilitiesRule >> protocolIdiom [

^self use: 'utilities' insteadOf: #('utils' 'utility')
]
Expand Up @@ -2,40 +2,40 @@
Check if a subclass of TestCase ends with 'Test' or 'TestCase'.
"
Class {
#name : #ReTestClassNameShouldEndWithTest,
#name : #ReTestClassNameShouldEndWithTestRule,
#superclass : #ReAbstractRule,
#category : #'Renraku-Rules'
}

{ #category : #'testing-interest' }
ReTestClassNameShouldEndWithTest class >> checksClass [
ReTestClassNameShouldEndWithTestRule class >> checksClass [

^ true
]

{ #category : #running }
ReTestClassNameShouldEndWithTest >> basicCheck: aClass [
ReTestClassNameShouldEndWithTestRule >> basicCheck: aClass [
| suffixes |
suffixes := #('Test' 'TestCase').
^ (aClass inheritsFrom: TestCase) and: [ suffixes noneSatisfy: [ :suffix | aClass name asString endsWith: suffix ] ]
]

{ #category : #running }
ReTestClassNameShouldEndWithTest >> group [
ReTestClassNameShouldEndWithTestRule >> group [
^ 'Optimization'
]

{ #category : #accessing }
ReTestClassNameShouldEndWithTest >> name [
ReTestClassNameShouldEndWithTestRule >> name [
^ 'A Test class'' name should end with ''Test'' '
]

{ #category : #accessing }
ReTestClassNameShouldEndWithTest >> rationale [
ReTestClassNameShouldEndWithTestRule >> rationale [
^ 'A test class (subclass of TestCase) should have it''s name ending with ''Test'' or ''TestCase'''
]

{ #category : #running }
ReTestClassNameShouldEndWithTest >> severity [
ReTestClassNameShouldEndWithTestRule >> severity [
^ #warning
]
Expand Up @@ -2,39 +2,39 @@
A subclass of TestCase should be in package which name is ending with '-Tests'
"
Class {
#name : #ReTestClassNotInPackageWithTestEndingName,
#name : #ReTestClassNotInPackageWithTestEndingNameRule,
#superclass : #ReAbstractRule,
#category : #'Renraku-Rules'
}

{ #category : #'testing-interest' }
ReTestClassNotInPackageWithTestEndingName class >> checksClass [
ReTestClassNotInPackageWithTestEndingNameRule class >> checksClass [

^ true
]

{ #category : #running }
ReTestClassNotInPackageWithTestEndingName >> basicCheck: aClass [
ReTestClassNotInPackageWithTestEndingNameRule >> basicCheck: aClass [

^ (aClass inheritsFrom: TestCase) and: [(aClass package name asString endsWith: '-Tests') not].
]

{ #category : #running }
ReTestClassNotInPackageWithTestEndingName >> group [
ReTestClassNotInPackageWithTestEndingNameRule >> group [
^ 'Optimization'
]

{ #category : #accessing }
ReTestClassNotInPackageWithTestEndingName >> name [
ReTestClassNotInPackageWithTestEndingNameRule >> name [
^ 'Test class not in a package with name ending with ''-Tests'' '
]

{ #category : #accessing }
ReTestClassNotInPackageWithTestEndingName >> rationale [
ReTestClassNotInPackageWithTestEndingNameRule >> rationale [
^ 'A test class (subclass of TestCase) should be placed in a package with a ''-Tests'' suffix'
]

{ #category : #running }
ReTestClassNotInPackageWithTestEndingName >> severity [
ReTestClassNotInPackageWithTestEndingNameRule >> severity [
^ #warning
]
Expand Up @@ -2,23 +2,23 @@
Morph and Model subclasses methods should access GUI theme via 'self theme' and not 'Smalltalk ui theme'.
"
Class {
#name : #ReThemeAccess,
#name : #ReThemeAccessRule,
#superclass : #ReAbstractRule,
#category : #'Renraku-Rules'
}

{ #category : #'testing-interest' }
ReThemeAccess class >> checksMethod [
ReThemeAccessRule class >> checksMethod [
^ true
]

{ #category : #'class initialization' }
ReThemeAccess class >> initialize [
ReThemeAccessRule class >> initialize [
" ReRuleManager cleanUp "
]

{ #category : #running }
ReThemeAccess >> check: aMethod forCritiquesDo: aCriticBlock [
ReThemeAccessRule >> check: aMethod forCritiquesDo: aCriticBlock [
| problemThemes |
((aMethod methodClass inheritsFrom: Morph)
or: [aMethod methodClass inheritsFrom: Model]) ifFalse: [ ^ self ].
Expand All @@ -35,16 +35,16 @@ ReThemeAccess >> check: aMethod forCritiquesDo: aCriticBlock [
]

{ #category : #running }
ReThemeAccess >> group [
ReThemeAccessRule >> group [
^ 'API Hints'
]

{ #category : #running }
ReThemeAccess >> name [
ReThemeAccessRule >> name [
^ 'Access to UI theme.'
]

{ #category : #running }
ReThemeAccess >> severity [
ReThemeAccessRule >> severity [
^ #warning
]

0 comments on commit 0197c5a

Please sign in to comment.