Skip to content

Commit

Permalink
Merge pull request #1398 from SeasideSt/slime-renovation
Browse files Browse the repository at this point in the history
Slime renovation
  • Loading branch information
jbrichau authored Jan 27, 2024
2 parents cb9f147 + 8192f79 commit ffcd2b3
Show file tree
Hide file tree
Showing 148 changed files with 792 additions and 68 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
fail-fast: false
matrix:
smalltalk: [ Pharo64-11, Pharo64-10, Pharo64-9.0, Pharo64-8.0, Pharo64-7.0, GemStone64-3.7.0, GemStone64-3.6.5, GemStone64-3.5.7 ]
smalltalk: [ Pharo64-11, Pharo64-10, Pharo64-9.0, Pharo64-8.0, Pharo64-7.0, GemStone64-3.7.0, GemStone64-3.6.6, GemStone64-3.5.7 ]
experimental: [ false ]
include:
- smalltalk: Pharo64-12
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
baselines
baselinegettext: spec

spec
for: #(#'pharo8.x' #'pharo9.x' #'pharo10.x' #'pharo11.x' #'pharo12.x' #'gemstone')
do: [
Expand All @@ -24,13 +25,9 @@ baselinegettext: spec
package: 'Seaside-Pharo-Gettext-Core';
package: 'Seaside-Gettext-Core'
with: [ spec includes: 'Seaside-Pharo-Gettext-Core' ];
package: 'Seaside-Gettext-Slime'
with: [ spec requires: #('Seaside-Gettext-Core' 'Seaside-Pharo-Slime') ];
package: 'Seaside-Tests-Pharo-Gettext'
with: [ spec requires: 'Seaside-Pharo-Gettext-Core' ].
spec
group: 'Gettext-Slime'
with: #('Seaside-Gettext' 'Seaside-Gettext-Slime');
group: 'Tests' with: #('Seaside-Tests-Pharo-Gettext') ].
spec
for: #(#'gemstone')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
baselines
baselinepharo: spec

spec
for: #squeakCommon
do: [ spec
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
baselines
baselineslime: spec

spec
for: #squeakCommon
do: [ spec
for: #pharo
do: [
spec
project: 'Grease Slime' copyFrom: 'Grease' with: [ spec loads: #('Slime') ];
project: 'Grease Slime Tests' copyFrom: 'Grease' with: [ spec loads: #('Slime Tests') ] ].

spec
for: #squeak
do: [ spec
package: 'Seaside-Slime' with: [ spec requires: #('Grease Slime') ];
package: 'Seaside-Tests-Slime' with: [ spec requires: #('Seaside-Slime' 'Seaside-Tests-Component' 'Grease Slime Tests') ].
for: #(#'pharo8.x' #'pharo9.x')
do: [
spec
group: 'Development' with: #('Seaside-Slime');
group: 'Development Tests' with: #('Seaside-Tests-Slime') ].

spec
for: #pharo
do: [ spec
package: 'Seaside-Pharo-Slime' with: [ spec requires: #('Grease Slime') ];
package: 'Seaside-Tests-Slime' with: [ spec requires: #('Seaside-Pharo-Slime' 'Seaside-Tests-Component' 'Grease Slime Tests') ].
spec
group: 'Development' with: #('Seaside-Pharo-Slime');
group: 'Development Tests' with: #('Seaside-Tests-Slime') ].

spec
for: #(#'pharo10.x' #'pharo11.x' #'pharo12.x')
do: [
spec
package: 'Seaside-Pharo110-Slime' with: [ spec requires: #('Grease Slime') ];
package: 'Seaside-Tests-Slime' with: [ spec requires: #('Seaside-Pharo110-Slime' 'Seaside-Tests-Component' 'Grease Slime Tests') ].
spec
group: 'Development' with: #('Seaside-Pharo110-Slime');
group: 'Development Tests' with: #('Seaside-Tests-Slime') ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
tools
enableSeasideCodeCritiques
"This script enables/disables relevant code critiques for Seaside development"
<script>

| disabledRules |

disabledRules := {

}.

ReRuleManager visibleRuleClasses do: [ :ruleClass |
ruleClass enabled: (disabledRules includes: ruleClass) not ].

"Ensure some rules do not disappear from Pharo.."
self assert: ReMultiplePeriodsTerminatingStatementRule enabled
5 changes: 5 additions & 0 deletions repository/Seaside-Pharo110-Slime.package/.filetree
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"separateMethodMetaAndSource" : false,
"noMethodMetaData" : true,
"useCypressPropertiesFile" : true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*Seaside-Pharo110-Slime
isRenderingMethod

(self numArgs > 0 and: [ self selector beginsWith: #render ])
ifFalse: [ ^ false ].
^ self literals anySatisfy: [ :each | each isSymbol and: [ WASlime isBrushSelector: each ] ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name" : "CompiledMethod"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*Seaside-Pharo110-Slime
seasideSlime
^ self new
name: 'Seaside-Pharo110-Slime';
description: 'Code critis for Seaside. Detects common types of Seaside-specific bugs.';
addDependency: 'Grease-Pharo110-Slime';
url: #seasideUrl;
yourself
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name" : "GRPackage"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*Seaside-Pharo110-Slime
genericPatternForSelector: aSymbol

^ String streamContents: [ :stream |
aSymbol keywords keysAndValuesDo: [ :index :value |
stream space; nextPutAll: value.
aSymbol last = $:
ifTrue: [ stream space; nextPutAll: '`@object'; print: index ] ] ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name" : "GRSlimeParseTreeLintRule"
}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
testing - interest
checksMethod

^ true
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
running
basicCheck: aMethod

| current superSelectors |
aMethod methodClass isMeta
ifTrue: [ ^ false ].

superSelectors := Set new.
current := aMethod methodClass superclass.
[ current isNil ] whileFalse: [
classesAndSelectors
at: current name
ifPresent: [ :values | superSelectors addAll: values ].
current := current superclass ].

^ ((superSelectors includes: aMethod selector)
and: [ (aMethod superMessages includes: aMethod selector) not ])
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
group

^ 'Seaside'
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
initialization
initialize

super initialize.
classesAndSelectors := Dictionary new.
classesAndSelectors
at: #WAObject put: #( initialize postCopy );
at: #WAPainter put: #( updateRoot: updateUrl: );
at: #WAPresenter put: #( updateStates: initialRequest: );
at: #WABrush put: #( setParent:canvas: with: );
at: #WATagBrush put: #( before after openTag closeTag );
at: #WARequestFilter put: #( handleFiltered: updateStates: );
at: #WASession put: #( updateRoot: updateUrl: updateStates: )
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
name

^ 'Call super implementation'
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
rationale

^ 'Some template methods provided by the framework require to call super to work correctly.'
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"commentStamp" : "",
"super" : "GRSlimeBlockLintRule",
"category" : "Seaside-Pharo110-Slime",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [
"classesAndSelectors"
],
"name" : "WACallSuperImplementationRule",
"type" : "normal"
}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
hooks
afterCheck: aNode mappings: dict

aNode methodNode method isRenderingMethod ifFalse: [ ^ false ].
aNode isWrite ifFalse: [ ^ false ].
(WASlime isWithinCallback: aNode) ifTrue:[ ^ false ].

^ true
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
group

^ 'Seaside'
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
initialization
initialize

super initialize.
self matches: '`var'
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
name

^ 'Changes state while rendering'
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
rationale

^ 'Application state should not be changed in the rendering code, use a callback to define state.'
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"commentStamp" : "",
"super" : "GRSlimeParseTreeLintRule",
"category" : "Seaside-Pharo110-Slime",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [ ],
"name" : "WAChangesStateWhileRenderingRule",
"type" : "normal"
}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
group

^ 'Seaside 3.2'
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
initialization
initialize

super initialize.
self
replace: '``@a oldNetscapeString' with: '``@a rfc6265String';
replace: '``@a rfc2109String' with: '``@a rfc6265String';
replace: '``@a rfc2965String' with: '``@a rfc6265String'
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
name

^ '#oldNetscapeString, #rfc2109String and #rfc2965String have been replaced with #rfc6265String'
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
rationale

^ '#oldNetscapeString, #rfc2109String and #rfc2965String have been replaced by #rfc6265String.'
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"commentStamp" : "",
"super" : "GRSlimeTransformationRule",
"category" : "Seaside-Pharo110-Slime",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [ ],
"name" : "WACookieConversionRule",
"type" : "normal"
}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
group

^ 'Seaside'
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
initialization
initialize

super initialize.
self matchesAny:
#( '``html jQuery ajax callback: ``@block;script:``@block2'
'``html jQuery ajax script: ``@block;callback:``@block2'
'``html jQuery ajax callback: ``@block;callback:``@block2'
'``html jQuery ajax callback: ``@block;html:``@block2'
'``html jQuery ajax html: ``@block;callback:``@block2' )
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
name

^ 'Multiple primary Ajax callbacks'
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
rationale

^ 'Multiple primary callback blocks attached to a single ajax request override each other. You can only combine multiple secondary callbacks with a single primary callback.'
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"commentStamp" : "",
"super" : "GRSlimeParseTreeLintRule",
"category" : "Seaside-Pharo110-Slime",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [ ],
"name" : "WADoNotCombineMultiplePrimaryAjaxCallbacks",
"type" : "normal"
}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
hooks
afterCheck: aNode mappings: dict

aNode methodNode method isRenderingMethod ifFalse: [ ^ false ].
(WASlime isWithinCallback: aNode) ifTrue: [ ^ false ].
^ true
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
group

^ 'Seaside'
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
initialization
initialize

super initialize.
self matchesAny: (self selectors
collect: [ :each | 'self' , (self genericPatternForSelector: each) ])
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
name

^ 'Do not use while rendering'
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
rationale

^ 'Certain functionaly should not be used while rendering. For example: #call: and #answer: should only be used from within callback code.'
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
private
selectors

^ #( answer answer: call: show: show:onAnswer: show:onAnswer:delegation: lightbox: chooseFrom: chooseFrom:caption: confirm: inform: request: request:default: request:label: request:label:default: wait: addDecoration: addMessage: answer answer: authenticateWith:during: call: chooseFrom: chooseFrom:caption: chooseFrom:caption:onAnswer: chooseFrom:onAnswer: confirm: confirm:onAnswer: decorateWith:during: filterWith:during: home inform: inform:onAnswer: isolate: lightbox: removeDecoration: removeDelegation request: request:default: request:default:onAnswer: request:label: request:label:default: request:label:default:onAnswer: request:label:onAnswer: request:onAnswer: show: show:onAnswer: show:onAnswer:delegation: validateWith: wait: )
Loading

0 comments on commit ffcd2b3

Please sign in to comment.