diff --git a/PharoWithStyle-Tests/ReUnnecessaryLastPeriodRuleTest.class.st b/PharoWithStyle-Tests/ReUnnecessaryLastPeriodRuleTest.class.st deleted file mode 100644 index e6215b2..0000000 --- a/PharoWithStyle-Tests/ReUnnecessaryLastPeriodRuleTest.class.st +++ /dev/null @@ -1,44 +0,0 @@ -Class { - #name : #ReUnnecessaryLastPeriodRuleTest, - #superclass : #ReAbstractRuleTestCase, - #category : #'PharoWithStyle-Tests' -} - -{ #category : #examples } -ReUnnecessaryLastPeriodRuleTest >> lastPeriods [ - - | collection | - collection := OrderedCollection new. - collection do: [ :e | 1. 2 ]. - 1. 2 -] - -{ #category : #helpers } -ReUnnecessaryLastPeriodRuleTest >> myCritiquesOnNodesInMethod: aMethod [ - - | critiques | - critiques := OrderedCollection new. - aMethod ast nodesDo: [ :node | - self subjectUnderTest new - check: node forCritiquesDo:[ :critique | critiques add: critique ] ]. - ^ critiques -] - -{ #category : #tests } -ReUnnecessaryLastPeriodRuleTest >> testRule [ - - | critiques | - critiques := self myCritiquesOnNodesInMethod: self class >> #unnecessaryLastPeriod. - self assert: critiques size equals: 2. - critiques := self myCritiquesOnNodesInMethod: self class >> #lastPeriods. - self assert: critiques size equals: 0 -] - -{ #category : #violations } -ReUnnecessaryLastPeriodRuleTest >> unnecessaryLastPeriod [ - - | collection | - collection := OrderedCollection new. - collection do: [ :e | 1. 2. ]. - 1. 2. -] diff --git a/PharoWithStyle/ReUnnecessaryLastPeriodRule.class.st b/PharoWithStyle/ReUnnecessaryLastPeriodRule.class.st deleted file mode 100644 index 881a187..0000000 --- a/PharoWithStyle/ReUnnecessaryLastPeriodRule.class.st +++ /dev/null @@ -1,40 +0,0 @@ -Class { - #name : #ReUnnecessaryLastPeriodRule, - #superclass : #ReNodeBasedRule, - #category : #PharoWithStyle -} - -{ #category : #helpers } -ReUnnecessaryLastPeriodRule >> anchorFor: aNode [ - - ^ ReIntervalSourceAnchor - entity: aNode statements last - interval: (Interval from: aNode periods last to: aNode periods last + 1) -] - -{ #category : #running } -ReUnnecessaryLastPeriodRule >> basicCheck: node [ - - ^ node isSequence and: [ - node statements notEmpty and: [ - node periods notEmpty and: [ - node periods last > node statements last stop ] ] ] -] - -{ #category : #accessing } -ReUnnecessaryLastPeriodRule >> group [ - - ^ 'Formatting' -] - -{ #category : #accessing } -ReUnnecessaryLastPeriodRule >> name [ - - ^ 'Unnecessary Last Period' -] - -{ #category : #accessing } -ReUnnecessaryLastPeriodRule >> rationale [ - - ^ 'Periods are not needed after the last statement.' -]