-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ported rules: invalid object initialization and non-portable messages
- Loading branch information
Showing
26 changed files
with
105 additions
and
30 deletions.
There are no files selected for viewing
Empty file.
4 changes: 4 additions & 0 deletions
4
...ease-Pharo110-Slime.package/GRInvalidObjectInitializationRule.class/class/checksMethod.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
testing - interest | ||
checksMethod | ||
|
||
^ true |
10 changes: 10 additions & 0 deletions
10
...se-Pharo110-Slime.package/GRInvalidObjectInitializationRule.class/instance/basicCheck..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ] ] ] ] ] ] ]) |
4 changes: 4 additions & 0 deletions
4
...y/Grease-Pharo110-Slime.package/GRInvalidObjectInitializationRule.class/instance/group.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing | ||
group | ||
|
||
^ 'Grease Portability' |
4 changes: 4 additions & 0 deletions
4
...ry/Grease-Pharo110-Slime.package/GRInvalidObjectInitializationRule.class/instance/name.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing | ||
name | ||
|
||
^ 'Invalid object initialization' |
4 changes: 4 additions & 0 deletions
4
...ease-Pharo110-Slime.package/GRInvalidObjectInitializationRule.class/instance/rationale.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing | ||
rationale | ||
|
||
^ 'Initialize methods are required to call the designated initializer or its super implementation.' |
11 changes: 11 additions & 0 deletions
11
...ory/Grease-Pharo110-Slime.package/GRInvalidObjectInitializationRule.class/properties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"commentStamp" : "", | ||
"super" : "GRReSlimeBlockLintRule", | ||
"category" : "Grease-Pharo110-Slime", | ||
"classinstvars" : [ ], | ||
"pools" : [ ], | ||
"classvars" : [ ], | ||
"instvars" : [ ], | ||
"name" : "GRInvalidObjectInitializationRule", | ||
"type" : "normal" | ||
} |
Empty file.
4 changes: 4 additions & 0 deletions
4
repository/Grease-Pharo110-Slime.package/GRNonPortableMessageRule.class/class/checksNode.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
testing - interest | ||
checksNode | ||
|
||
^ true |
4 changes: 4 additions & 0 deletions
4
...tory/Grease-Pharo110-Slime.package/GRNonPortableMessageRule.class/instance/basicCheck..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
running | ||
basicCheck: anEntity | ||
|
||
^ anEntity isMessage and:[ self methodNames includes: anEntity selector ] |
4 changes: 4 additions & 0 deletions
4
repository/Grease-Pharo110-Slime.package/GRNonPortableMessageRule.class/instance/group.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing | ||
group | ||
|
||
^ 'Grease Portability' |
4 changes: 4 additions & 0 deletions
4
...tory/Grease-Pharo110-Slime.package/GRNonPortableMessageRule.class/instance/methodNames.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
private | ||
methodNames | ||
|
||
^ #( anyOne withIndexCollect: ) |
4 changes: 4 additions & 0 deletions
4
repository/Grease-Pharo110-Slime.package/GRNonPortableMessageRule.class/instance/name.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing | ||
name | ||
|
||
^ 'Uses non portable message' |
4 changes: 4 additions & 0 deletions
4
...sitory/Grease-Pharo110-Slime.package/GRNonPortableMessageRule.class/instance/rationale.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing | ||
rationale | ||
|
||
^ 'Some methods are not portable accross different Smalltalk dialects.' |
11 changes: 11 additions & 0 deletions
11
repository/Grease-Pharo110-Slime.package/GRNonPortableMessageRule.class/properties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"commentStamp" : "", | ||
"super" : "GRReSlimeBlockLintRule", | ||
"category" : "Grease-Pharo110-Slime", | ||
"classinstvars" : [ ], | ||
"pools" : [ ], | ||
"classvars" : [ ], | ||
"instvars" : [ ], | ||
"name" : "GRNonPortableMessageRule", | ||
"type" : "normal" | ||
} |
4 changes: 0 additions & 4 deletions
4
...ase-Tests-Pharo-Slime.package/GRReSlimeTest.class/instance/assertRule.expectedMatches..st
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
...-Pharo-Slime.package/GRReSlimeTest.class/instance/assertRule.expectedMatches.ignoring..st
This file was deleted.
Oops, something went wrong.
4 changes: 4 additions & 0 deletions
4
...tory/Grease-Tests-Pharo-Slime.package/GRReSlimeTest.class/instance/assertRule.matches..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
running-checks | ||
assertRule: aRuleClass matches: expectedMatches | ||
|
||
self assertRule: aRuleClass matches: expectedMatches ignoring: Array new |
13 changes: 13 additions & 0 deletions
13
...se-Tests-Pharo-Slime.package/GRReSlimeTest.class/instance/assertRule.matches.ignoring..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 }) ] ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletions
6
...tory/Grease-Tests-Pharo-Slime.package/GRReSlimeTest.class/instance/testEmptyStatements.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
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." | ||
<expectedFailure> | ||
|
||
| class | | ||
class := self defineSubClassOf: #GRObject. | ||
self compile: 'emptyStatement1. self and' in: class. | ||
self compile: 'emptyStatement2 self and..' in: class. | ||
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) |
6 changes: 3 additions & 3 deletions
6
...Tests-Pharo-Slime.package/GRReSlimeTest.class/instance/testInvalidObjectInitialization.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
tests-block | ||
testInvalidObjectInitialization | ||
<expectedFailure> | ||
|
||
| class | | ||
class := self defineSubClassOf: #GRObject. | ||
self compile: 'initializeFoo: aNumber' in: class. | ||
self | ||
runRule: GRInvalidObjectInitializationRule | ||
selectors: #(initializeFoo:) | ||
assertRule: GRInvalidObjectInitializationRule | ||
matches: { class>>#initializeFoo: } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters