diff --git a/src/BaselineOfBloc/BaselineOfBloc.class.st b/src/BaselineOfBloc/BaselineOfBloc.class.st index 91fdaf0d1..fed3d6411 100644 --- a/src/BaselineOfBloc/BaselineOfBloc.class.st +++ b/src/BaselineOfBloc/BaselineOfBloc.class.st @@ -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') ]. diff --git a/src/Bloc-Rules/ReBlocDoNotSendForceLayoutRule.class.st b/src/Bloc-Rules/ReBlocDoNotSendForceLayoutRule.class.st new file mode 100644 index 000000000..c9e20c3fd --- /dev/null +++ b/src/Bloc-Rules/ReBlocDoNotSendForceLayoutRule.class.st @@ -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' +] diff --git a/src/Bloc-Rules/ReBlocWidthShouldNotBeOverriddenRule.class.st b/src/Bloc-Rules/ReBlocWidthShouldNotBeOverriddenRule.class.st new file mode 100644 index 000000000..cdfa16db1 --- /dev/null +++ b/src/Bloc-Rules/ReBlocWidthShouldNotBeOverriddenRule.class.st @@ -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' +] diff --git a/src/Bloc-Rules/package.st b/src/Bloc-Rules/package.st new file mode 100644 index 000000000..4800a230a --- /dev/null +++ b/src/Bloc-Rules/package.st @@ -0,0 +1 @@ +Package { #name : #'Bloc-Rules' }