Skip to content

Commit

Permalink
Merge pull request #329 from bencoman/custom-QA-rule
Browse files Browse the repository at this point in the history
custom-QA-rule
  • Loading branch information
macta authored May 16, 2019
2 parents 6d18367 + 4c16e20 commit 4ddd170
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
16 changes: 16 additions & 0 deletions dev/src/ExercismTools/ExercismHintRule.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Class {
#name : #ExercismHintRule,
#superclass : #ReAbstractRule,
#category : #ExercismTools
}

{ #category : #accessing }
ExercismHintRule >> group [
^'Exercism Hint'
]

{ #category : #accessing }
ExercismHintRule >> severity [
^ #warning

]
30 changes: 30 additions & 0 deletions dev/src/ExercismTools/ExercismHintTwoFerReuseRule.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"
The TwoFer exercise introduces you to calling between methods.
For practice, your '#who' method should reuse your '#who:' method.
"
Class {
#name : #ExercismHintTwoFerReuseRule,
#superclass : #ExercismHintRule,
#category : #ExercismTools
}

{ #category : #'testing-interest' }
ExercismHintTwoFerReuseRule class >> checksMethod [
^true
]

{ #category : #accessing }
ExercismHintTwoFerReuseRule >> basicCheck: compiledMethod [
compiledMethod methodClass name = #TwoFer ifTrue: [
|literals|
literals := compiledMethod sourceCode parseLiterals.
literals first = #who ifTrue: [ ^ (literals includes: #who:) not ].
].
^false

]

{ #category : #accessing }
ExercismHintTwoFerReuseRule >> name [
^ 'Exercism: Method #who should reuse method #who: '
]

0 comments on commit 4ddd170

Please sign in to comment.