Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes: #474 add a package with some rules and update the baseline #481

Merged
merged 1 commit into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/BaselineOfBloc/BaselineOfBloc.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ BaselineOfBloc >> baseline: spec [
spec requires: #('Bloc-Scalable') ];
package: #'Bloc-FocusFinder-Examples' with: [
spec requires: #('Bloc-FocusFinder') ].


spec package: #'Bloc-Rules' with: [ spec requires: #(#Bloc) ].

spec package: #'Bloc-Demo' with: [
spec requires: #(#'Bloc-Layout' #'Bloc-Spec2' #'Bloc-Text-Elements') ].

Expand Down
47 changes: 47 additions & 0 deletions src/Bloc-Rules/ReBlocDoNotSendForceLayoutRule.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
"
`BlElement>>#forceLayout` shouild not be manually invoked as exaplained by the followoing comment:


**forceLayout**
""Do not use me, I am a private / debug utility method to force layout computation.
The main usage of this method is for testing purposes where we want to update layout
without the need to create a separate space and add an element to it in order to test bounds or position.
Note: because layout measurement may depend on other element it is mandatory to compute
layout going down from the top most parent, otherwise layout will not be valid""

"
Class {
#name : #ReBlocDoNotSendForceLayoutRule,
#superclass : #ReAbstractRule,
#category : #'Bloc-Rules'
}

{ #category : #testing }
ReBlocDoNotSendForceLayoutRule class >> checksMethod [

^ true
]

{ #category : #accessing }
ReBlocDoNotSendForceLayoutRule class >> uniqueIdentifierName [
"This number should be unique and should change only when the rule completely change semantics"

^ 'BlocDoNotSendForceLayout'
]

{ #category : #running }
ReBlocDoNotSendForceLayoutRule >> basicCheck: aMethod [

^ (aMethod sendsSelector: #forceLayout)
]

{ #category : #accessing }
ReBlocDoNotSendForceLayoutRule >> group [
^ 'Potential Bugs'
]

{ #category : #accessing }
ReBlocDoNotSendForceLayoutRule >> name [

^ 'Do not send forceLayout'
]
39 changes: 39 additions & 0 deletions src/Bloc-Rules/ReBlocWidthShouldNotBeOverriddenRule.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
"
In Bloc an element defines a width method. Redefining it can lead to difficult to spot bugs.
"
Class {
#name : #ReBlocWidthShouldNotBeOverriddenRule,
#superclass : #ReAbstractRule,
#category : #'Bloc-Rules'
}

{ #category : #testing }
ReBlocWidthShouldNotBeOverriddenRule class >> checksMethod [

^ true
]

{ #category : #accessing }
ReBlocWidthShouldNotBeOverriddenRule class >> uniqueIdentifierName [
"This number should be unique and should change only when the rule completely change semantics"

^ 'BlocWidth'
]

{ #category : #running }
ReBlocWidthShouldNotBeOverriddenRule >> basicCheck: aMethod [

^ (aMethod methodClass inheritsFrom: BlElement) and: [
aMethod methodClass includesSelector: #width ]
]

{ #category : #accessing }
ReBlocWidthShouldNotBeOverriddenRule >> group [
^ 'Potential Bugs'
]

{ #category : #accessing }
ReBlocWidthShouldNotBeOverriddenRule >> name [

^ 'Width should not be overridden'
]
1 change: 1 addition & 0 deletions src/Bloc-Rules/package.st
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Package { #name : #'Bloc-Rules' }