Skip to content

Commit 4ddd170

Browse files
authored
Merge pull request #329 from bencoman/custom-QA-rule
custom-QA-rule
2 parents 6d18367 + 4c16e20 commit 4ddd170

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Class {
2+
#name : #ExercismHintRule,
3+
#superclass : #ReAbstractRule,
4+
#category : #ExercismTools
5+
}
6+
7+
{ #category : #accessing }
8+
ExercismHintRule >> group [
9+
^'Exercism Hint'
10+
]
11+
12+
{ #category : #accessing }
13+
ExercismHintRule >> severity [
14+
^ #warning
15+
16+
]
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
"
2+
The TwoFer exercise introduces you to calling between methods.
3+
For practice, your '#who' method should reuse your '#who:' method.
4+
"
5+
Class {
6+
#name : #ExercismHintTwoFerReuseRule,
7+
#superclass : #ExercismHintRule,
8+
#category : #ExercismTools
9+
}
10+
11+
{ #category : #'testing-interest' }
12+
ExercismHintTwoFerReuseRule class >> checksMethod [
13+
^true
14+
]
15+
16+
{ #category : #accessing }
17+
ExercismHintTwoFerReuseRule >> basicCheck: compiledMethod [
18+
compiledMethod methodClass name = #TwoFer ifTrue: [
19+
|literals|
20+
literals := compiledMethod sourceCode parseLiterals.
21+
literals first = #who ifTrue: [ ^ (literals includes: #who:) not ].
22+
].
23+
^false
24+
25+
]
26+
27+
{ #category : #accessing }
28+
ExercismHintTwoFerReuseRule >> name [
29+
^ 'Exercism: Method #who should reuse method #who: '
30+
]

0 commit comments

Comments
 (0)