diff --git a/repository/Grease-Pharo110-Slime.package/GRInvalidObjectInitializationRule.class/README.md b/repository/Grease-Pharo110-Slime.package/GRInvalidObjectInitializationRule.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/Grease-Pharo110-Slime.package/GRInvalidObjectInitializationRule.class/class/checksMethod.st b/repository/Grease-Pharo110-Slime.package/GRInvalidObjectInitializationRule.class/class/checksMethod.st new file mode 100644 index 00000000..c0b5961f --- /dev/null +++ b/repository/Grease-Pharo110-Slime.package/GRInvalidObjectInitializationRule.class/class/checksMethod.st @@ -0,0 +1,4 @@ +testing - interest +checksMethod + + ^ true \ No newline at end of file diff --git a/repository/Grease-Pharo110-Slime.package/GRInvalidObjectInitializationRule.class/instance/basicCheck..st b/repository/Grease-Pharo110-Slime.package/GRInvalidObjectInitializationRule.class/instance/basicCheck..st new file mode 100644 index 00000000..1b7b4c47 --- /dev/null +++ b/repository/Grease-Pharo110-Slime.package/GRInvalidObjectInitializationRule.class/instance/basicCheck..st @@ -0,0 +1,10 @@ +running +basicCheck: aMethod + + ^ (aMethod methodClass isMeta not + and: [ (aMethod selector beginsWithSubCollection: #initialize) + and: [ aMethod selector numArgs > 0 + and: [ aMethod methodClass ~= GRObject + and: [ (aMethod methodClass includesBehavior: GRObject) + and: [ (aMethod superMessages includes: aMethod selector) not + and: [ aMethod selfMessages noneSatisfy: [ :each | each beginsWithSubCollection: #initialize ] ] ] ] ] ] ]) \ No newline at end of file diff --git a/repository/Grease-Pharo110-Slime.package/GRInvalidObjectInitializationRule.class/instance/group.st b/repository/Grease-Pharo110-Slime.package/GRInvalidObjectInitializationRule.class/instance/group.st new file mode 100644 index 00000000..b4981dc4 --- /dev/null +++ b/repository/Grease-Pharo110-Slime.package/GRInvalidObjectInitializationRule.class/instance/group.st @@ -0,0 +1,4 @@ +accessing +group + + ^ 'Grease Portability' \ No newline at end of file diff --git a/repository/Grease-Pharo110-Slime.package/GRInvalidObjectInitializationRule.class/instance/name.st b/repository/Grease-Pharo110-Slime.package/GRInvalidObjectInitializationRule.class/instance/name.st new file mode 100644 index 00000000..6386a8fd --- /dev/null +++ b/repository/Grease-Pharo110-Slime.package/GRInvalidObjectInitializationRule.class/instance/name.st @@ -0,0 +1,4 @@ +accessing +name + + ^ 'Invalid object initialization' \ No newline at end of file diff --git a/repository/Grease-Pharo110-Slime.package/GRInvalidObjectInitializationRule.class/instance/rationale.st b/repository/Grease-Pharo110-Slime.package/GRInvalidObjectInitializationRule.class/instance/rationale.st new file mode 100644 index 00000000..9ce37a52 --- /dev/null +++ b/repository/Grease-Pharo110-Slime.package/GRInvalidObjectInitializationRule.class/instance/rationale.st @@ -0,0 +1,4 @@ +accessing +rationale + + ^ 'Initialize methods are required to call the designated initializer or its super implementation.' \ No newline at end of file diff --git a/repository/Grease-Pharo110-Slime.package/GRInvalidObjectInitializationRule.class/properties.json b/repository/Grease-Pharo110-Slime.package/GRInvalidObjectInitializationRule.class/properties.json new file mode 100644 index 00000000..4cbd7077 --- /dev/null +++ b/repository/Grease-Pharo110-Slime.package/GRInvalidObjectInitializationRule.class/properties.json @@ -0,0 +1,11 @@ +{ + "commentStamp" : "", + "super" : "GRReSlimeBlockLintRule", + "category" : "Grease-Pharo110-Slime", + "classinstvars" : [ ], + "pools" : [ ], + "classvars" : [ ], + "instvars" : [ ], + "name" : "GRInvalidObjectInitializationRule", + "type" : "normal" +} \ No newline at end of file diff --git a/repository/Grease-Pharo110-Slime.package/GRNonPortableMessageRule.class/README.md b/repository/Grease-Pharo110-Slime.package/GRNonPortableMessageRule.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/Grease-Pharo110-Slime.package/GRNonPortableMessageRule.class/class/checksNode.st b/repository/Grease-Pharo110-Slime.package/GRNonPortableMessageRule.class/class/checksNode.st new file mode 100644 index 00000000..5e68f2ca --- /dev/null +++ b/repository/Grease-Pharo110-Slime.package/GRNonPortableMessageRule.class/class/checksNode.st @@ -0,0 +1,4 @@ +testing - interest +checksNode + + ^ true \ No newline at end of file diff --git a/repository/Grease-Pharo110-Slime.package/GRNonPortableMessageRule.class/instance/basicCheck..st b/repository/Grease-Pharo110-Slime.package/GRNonPortableMessageRule.class/instance/basicCheck..st new file mode 100644 index 00000000..428bcd1c --- /dev/null +++ b/repository/Grease-Pharo110-Slime.package/GRNonPortableMessageRule.class/instance/basicCheck..st @@ -0,0 +1,4 @@ +running +basicCheck: anEntity + + ^ anEntity isMessage and:[ self methodNames includes: anEntity selector ] diff --git a/repository/Grease-Pharo110-Slime.package/GRNonPortableMessageRule.class/instance/group.st b/repository/Grease-Pharo110-Slime.package/GRNonPortableMessageRule.class/instance/group.st new file mode 100644 index 00000000..b4981dc4 --- /dev/null +++ b/repository/Grease-Pharo110-Slime.package/GRNonPortableMessageRule.class/instance/group.st @@ -0,0 +1,4 @@ +accessing +group + + ^ 'Grease Portability' \ No newline at end of file diff --git a/repository/Grease-Pharo110-Slime.package/GRNonPortableMessageRule.class/instance/methodNames.st b/repository/Grease-Pharo110-Slime.package/GRNonPortableMessageRule.class/instance/methodNames.st new file mode 100644 index 00000000..25a16ed6 --- /dev/null +++ b/repository/Grease-Pharo110-Slime.package/GRNonPortableMessageRule.class/instance/methodNames.st @@ -0,0 +1,4 @@ +private +methodNames + + ^ #( anyOne withIndexCollect: ) \ No newline at end of file diff --git a/repository/Grease-Pharo110-Slime.package/GRNonPortableMessageRule.class/instance/name.st b/repository/Grease-Pharo110-Slime.package/GRNonPortableMessageRule.class/instance/name.st new file mode 100644 index 00000000..cc5e5c47 --- /dev/null +++ b/repository/Grease-Pharo110-Slime.package/GRNonPortableMessageRule.class/instance/name.st @@ -0,0 +1,4 @@ +accessing +name + + ^ 'Uses non portable message' \ No newline at end of file diff --git a/repository/Grease-Pharo110-Slime.package/GRNonPortableMessageRule.class/instance/rationale.st b/repository/Grease-Pharo110-Slime.package/GRNonPortableMessageRule.class/instance/rationale.st new file mode 100644 index 00000000..bc7272e4 --- /dev/null +++ b/repository/Grease-Pharo110-Slime.package/GRNonPortableMessageRule.class/instance/rationale.st @@ -0,0 +1,4 @@ +accessing +rationale + + ^ 'Some methods are not portable accross different Smalltalk dialects.' \ No newline at end of file diff --git a/repository/Grease-Pharo110-Slime.package/GRNonPortableMessageRule.class/properties.json b/repository/Grease-Pharo110-Slime.package/GRNonPortableMessageRule.class/properties.json new file mode 100644 index 00000000..95a60d91 --- /dev/null +++ b/repository/Grease-Pharo110-Slime.package/GRNonPortableMessageRule.class/properties.json @@ -0,0 +1,11 @@ +{ + "commentStamp" : "", + "super" : "GRReSlimeBlockLintRule", + "category" : "Grease-Pharo110-Slime", + "classinstvars" : [ ], + "pools" : [ ], + "classvars" : [ ], + "instvars" : [ ], + "name" : "GRNonPortableMessageRule", + "type" : "normal" +} \ No newline at end of file diff --git a/repository/Grease-Tests-Pharo-Slime.package/GRReSlimeTest.class/instance/assertRule.expectedMatches..st b/repository/Grease-Tests-Pharo-Slime.package/GRReSlimeTest.class/instance/assertRule.expectedMatches..st deleted file mode 100644 index 3a9f4525..00000000 --- a/repository/Grease-Tests-Pharo-Slime.package/GRReSlimeTest.class/instance/assertRule.expectedMatches..st +++ /dev/null @@ -1,4 +0,0 @@ -running-checks -assertRule: aRuleClass expectedMatches: aCollection - - self assertRule: aRuleClass expectedMatches: aCollection ignoring: Array new \ No newline at end of file diff --git a/repository/Grease-Tests-Pharo-Slime.package/GRReSlimeTest.class/instance/assertRule.expectedMatches.ignoring..st b/repository/Grease-Tests-Pharo-Slime.package/GRReSlimeTest.class/instance/assertRule.expectedMatches.ignoring..st deleted file mode 100644 index ccee1f72..00000000 --- a/repository/Grease-Tests-Pharo-Slime.package/GRReSlimeTest.class/instance/assertRule.expectedMatches.ignoring..st +++ /dev/null @@ -1,13 +0,0 @@ -running-checks -assertRule: aRuleClass expectedMatches: aCollectionOfExpectedEntities ignoring: aCollectionOfIgnoredEntities - - self run: aRuleClass ignoring: aCollectionOfIgnoredEntities do: [ :critiques | | critiquedEntities | - critiquedEntities := critiques collect:[ :critique | critique sourceAnchor entity ]. - critiquedEntities do:[ :critiquedEntity | - self - assert: (aCollectionOfExpectedEntities includes: critiquedEntity) - description: critiquedEntity printString , ' should not be reported' ]. - aCollectionOfExpectedEntities do: [ :expectedEntity | - self - assert: (critiquedEntities includes: expectedEntity) - description: expectedEntity printString , ' should be reported' ] ] \ No newline at end of file diff --git a/repository/Grease-Tests-Pharo-Slime.package/GRReSlimeTest.class/instance/assertRule.matches..st b/repository/Grease-Tests-Pharo-Slime.package/GRReSlimeTest.class/instance/assertRule.matches..st new file mode 100644 index 00000000..65b1cddd --- /dev/null +++ b/repository/Grease-Tests-Pharo-Slime.package/GRReSlimeTest.class/instance/assertRule.matches..st @@ -0,0 +1,4 @@ +running-checks +assertRule: aRuleClass matches: expectedMatches + + self assertRule: aRuleClass matches: expectedMatches ignoring: Array new \ No newline at end of file diff --git a/repository/Grease-Tests-Pharo-Slime.package/GRReSlimeTest.class/instance/assertRule.matches.ignoring..st b/repository/Grease-Tests-Pharo-Slime.package/GRReSlimeTest.class/instance/assertRule.matches.ignoring..st new file mode 100644 index 00000000..d2c4aa91 --- /dev/null +++ b/repository/Grease-Tests-Pharo-Slime.package/GRReSlimeTest.class/instance/assertRule.matches.ignoring..st @@ -0,0 +1,13 @@ +running-checks +assertRule: aRuleClass matches: expectedMatches ignoring: ignoredRuleClasses + + self run: aRuleClass ignoring: ignoredRuleClasses do: [ :critiques | | critiquedEntities | + critiquedEntities := critiques collect:[ :critique | critique sourceAnchor entity ]. + critiquedEntities do:[ :critiquedEntity | + self + assert: (expectedMatches includes: critiquedEntity) + description: ('{1} should not be reported' format: { critiquedEntity printString }) ]. + expectedMatches do: [ :expectedEntity | + self + assert: (critiquedEntities includes: expectedEntity) + description: ('{1} should be reported' format: { expectedEntity printString }) ] ] \ No newline at end of file diff --git a/repository/Grease-Tests-Pharo-Slime.package/GRReSlimeTest.class/instance/rules.st b/repository/Grease-Tests-Pharo-Slime.package/GRReSlimeTest.class/instance/rules.st index 70092732..2a84e4b7 100644 --- a/repository/Grease-Tests-Pharo-Slime.package/GRReSlimeTest.class/instance/rules.st +++ b/repository/Grease-Tests-Pharo-Slime.package/GRReSlimeTest.class/instance/rules.st @@ -4,4 +4,5 @@ rules addAll: GRReSlimeBlockLintRule allSubclasses; addAll: GRReSlimeParseTreeLintRule allSubclasses; " addAll: GRSlimeTransformationRule allSubclasses;" + add: ReMultiplePeriodsTerminatingStatementRule; yourself \ No newline at end of file diff --git a/repository/Grease-Tests-Pharo-Slime.package/GRReSlimeTest.class/instance/run.ignoring.do..st b/repository/Grease-Tests-Pharo-Slime.package/GRReSlimeTest.class/instance/run.ignoring.do..st index 09d5db28..b6ec29e2 100644 --- a/repository/Grease-Tests-Pharo-Slime.package/GRReSlimeTest.class/instance/run.ignoring.do..st +++ b/repository/Grease-Tests-Pharo-Slime.package/GRReSlimeTest.class/instance/run.ignoring.do..st @@ -1,5 +1,5 @@ running-checks -run: aRuleClass ignoring: aCollectionOfEntities do: aBlock +run: aRuleClass ignoring: ignoredRuleClasses do: aBlock | rules rule runner | rules := self rules @@ -22,7 +22,7 @@ run: aRuleClass ignoring: aCollectionOfEntities do: aBlock rules do: [ :each | | result | result := runner criticsOf: each. self - assert: (rule = each or: [ result isEmpty "and: [ each changes isEmpty ]) or: [ aCollectionOfEntities includes: each class ]" ]) - description: each name , ' should not report errors' ]. + assert: (rule = each or: [ result isEmpty or: [ ignoredRuleClasses includes: each class ] ]) + description: ('{1} should not report errors' format: { each name }) ]. aBlock value: (runner criticsOf: rule). ^ rule \ No newline at end of file diff --git a/repository/Grease-Tests-Pharo-Slime.package/GRReSlimeTest.class/instance/testBasicNewInitializeMissing.st b/repository/Grease-Tests-Pharo-Slime.package/GRReSlimeTest.class/instance/testBasicNewInitializeMissing.st index 10d39dc6..679e1393 100644 --- a/repository/Grease-Tests-Pharo-Slime.package/GRReSlimeTest.class/instance/testBasicNewInitializeMissing.st +++ b/repository/Grease-Tests-Pharo-Slime.package/GRReSlimeTest.class/instance/testBasicNewInitializeMissing.st @@ -6,4 +6,4 @@ testBasicNewInitializeMissing self compile: 'initialize' in: class. self assertRule: GRBasicNewInitializeMissingRule - expectedMatches: { class } \ No newline at end of file + matches: { class } \ No newline at end of file diff --git a/repository/Grease-Tests-Pharo-Slime.package/GRReSlimeTest.class/instance/testDeprecatedApiProtocol.st b/repository/Grease-Tests-Pharo-Slime.package/GRReSlimeTest.class/instance/testDeprecatedApiProtocol.st index 24c4cb57..bc229c20 100644 --- a/repository/Grease-Tests-Pharo-Slime.package/GRReSlimeTest.class/instance/testDeprecatedApiProtocol.st +++ b/repository/Grease-Tests-Pharo-Slime.package/GRReSlimeTest.class/instance/testDeprecatedApiProtocol.st @@ -8,4 +8,4 @@ testDeprecatedApiProtocol self compile: 'deprecated3 self greaseDeprecatedApi: ''GRSlimeMock>>#deprecated3'' details: ''Something.''' in: class. self assertRule: GRDeprecatedApiProtocolRule - expectedMatches: { class>>#deprecated2 . class>>#deprecated3 } \ No newline at end of file + matches: { class>>#deprecated2 . class>>#deprecated3 } \ No newline at end of file diff --git a/repository/Grease-Tests-Pharo-Slime.package/GRReSlimeTest.class/instance/testEmptyStatements.st b/repository/Grease-Tests-Pharo-Slime.package/GRReSlimeTest.class/instance/testEmptyStatements.st index 834e9f96..d65a638c 100644 --- a/repository/Grease-Tests-Pharo-Slime.package/GRReSlimeTest.class/instance/testEmptyStatements.st +++ b/repository/Grease-Tests-Pharo-Slime.package/GRReSlimeTest.class/instance/testEmptyStatements.st @@ -1,6 +1,8 @@ tests-block testEmptyStatements + "We added this test to make sure that this Pharo-supplied rule works because we previously had this one in Grease and it is important." + | class | class := self defineSubClassOf: #GRObject. self compile: 'emptyStatement1. self and' in: class. @@ -8,6 +10,6 @@ testEmptyStatements self compile: 'emptyStatement3 self and."foo".' in: class. self compile: 'emptyStatement4 self and."foo".self and' in: class. self - runRule: GREmptyStatementsRule - selectors: #(emptyStatement1 emptyStatement2 emptyStatement3 emptyStatement4) + assertRule: ReMultiplePeriodsTerminatingStatementRule + matches: { class>>#emptyStatement1 . class>>#emptyStatement2 . class>>#emptyStatement3 . class>>#emptyStatement4 } ignoring: (Array with: GRUnnecessaryLastPeriodRule) \ No newline at end of file diff --git a/repository/Grease-Tests-Pharo-Slime.package/GRReSlimeTest.class/instance/testInvalidObjectInitialization.st b/repository/Grease-Tests-Pharo-Slime.package/GRReSlimeTest.class/instance/testInvalidObjectInitialization.st index 9db27eb0..c7bddcd6 100644 --- a/repository/Grease-Tests-Pharo-Slime.package/GRReSlimeTest.class/instance/testInvalidObjectInitialization.st +++ b/repository/Grease-Tests-Pharo-Slime.package/GRReSlimeTest.class/instance/testInvalidObjectInitialization.st @@ -1,9 +1,9 @@ tests-block testInvalidObjectInitialization - + | class | class := self defineSubClassOf: #GRObject. self compile: 'initializeFoo: aNumber' in: class. self - runRule: GRInvalidObjectInitializationRule - selectors: #(initializeFoo:) \ No newline at end of file + assertRule: GRInvalidObjectInitializationRule + matches: { class>>#initializeFoo: } \ No newline at end of file diff --git a/repository/Grease-Tests-Pharo-Slime.package/GRReSlimeTest.class/instance/testNonPortableMessageRule.st b/repository/Grease-Tests-Pharo-Slime.package/GRReSlimeTest.class/instance/testNonPortableMessageRule.st index e21849d4..d5b8d927 100644 --- a/repository/Grease-Tests-Pharo-Slime.package/GRReSlimeTest.class/instance/testNonPortableMessageRule.st +++ b/repository/Grease-Tests-Pharo-Slime.package/GRReSlimeTest.class/instance/testNonPortableMessageRule.st @@ -1,6 +1,6 @@ tests-block testNonPortableMessageRule - + | class | class := self defineSubClassOf: #GRObject. @@ -11,5 +11,5 @@ testNonPortableMessageRule self compile: 'valid2 ^ Array new do: [ :each | each hash ]' in: class. self - runRule: GRNonPortableMessageRule - selectors: #(invalid1 invalid2) \ No newline at end of file + assertRule: GRNonPortableMessageRule + matches: { class>>#invalid1 . class>>#invalid2 } \ No newline at end of file