Skip to content

Commit

Permalink
added tradition breaker, marking for long runtime tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Barkowsky committed Jul 21, 2014
1 parent 3250203 commit ad27958
Show file tree
Hide file tree
Showing 180 changed files with 573 additions and 58 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
testClassSuperclass

^ self testSystem classForTestClass: self testObject superclass
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"superVariables:" : "MB 6/17/2014 12:22",
"testClass" : "MB 6/17/2014 12:22",
"testClass:" : "MB 6/17/2014 12:22",
"testClassSuperclass" : "MB 7/15/2014 12:04",
"testObject" : "AT 5/7/2008 21:31",
"testObject:" : "AT 1/29/2008 07:19",
"variableForSelector:" : "MB 6/17/2014 12:54",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ defaultTestCategories

tests := (SLMultipleSelectionModel
withModel: self withMessage: #selectableTests
withAsStringSelector: #name)
withAsStringSelector: #format)
menuGetter: #testsMenuFor:in:.

testCategories addDependent: tests.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"classes" : "AT 5/8/2008 09:32",
"classes:" : "NR 1/26/2008 16:08",
"defaultClassCategories" : "NR 1/8/2008 14:49",
"defaultTestCategories" : "NR 1/16/2008 10:21",
"defaultTestCategories" : "MB 7/17/2014 11:49",
"packageForCategory:" : "AT 5/8/2008 09:32",
"packageForClassNamed:" : "AT 5/8/2008 09:32",
"reload" : "NR 1/31/2008 20:45",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
results
methodListResult: aMethodCollection

^((self collectionResult: aMethodCollection)
showRule: [:items | items size > 0]) formatAsMethodList
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"initialize" : "HD 7/9/2014 19:38",
"integerResult:" : "AT 5/8/2008 10:01",
"integerResult:withThresholdFor:" : "AT 5/8/2008 10:01",
"methodListResult:" : "MB 7/17/2014 12:00",
"noResult" : "AT 5/8/2008 10:02",
"noResult:" : "AT 5/26/2008 20:16",
"noResultFrom:" : "AT 2/8/2008 08:40",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
accessing
classForTestClass: aClass

^ allClasses
detect: [ :any | any testObject = aClass]
ifNone: [nil]
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"categories" : "AT 5/8/2008 12:22",
"categories:" : "AT 5/23/2008 19:33",
"children" : "AT 5/8/2008 12:22",
"classForTestClass:" : "MB 7/15/2014 12:04",
"fetchAllMethods" : "AT 5/28/2008 13:27",
"findCategory:" : "AT 5/8/2008 12:23",
"findClass:" : "AT 5/8/2008 12:23",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ newFromArray: anArray plugin: aSLPlugInClass
description: (anArray at: 3 ifAbsent: [nil])
inCategory: (anArray at: 4 ifAbsent: [nil])
selector: (anArray at: 5 ifAbsent: [nil])
longRuntime: (anArray at: 6 ifAbsent: [false])
plugIn: aSLPlugInClass
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ newNamed: aSymbol
shortDescription: nil
description: nil
inCategory: nil
selector: nil
selector: nil
longRuntime: false
plugIn: nil
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ newNamed: aSymbol
shortDescription: aShortDescription
description: aDescription
inCategory: nil
selector: nil
selector: nil
longRuntime: false
plugIn: nil
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ newNamed: aSymbol
shortDescription: aShortDescription
description: aDescription
inCategory: aCategorySymbol
selector: nil
selector: nil
longRuntime: false
plugIn: nil
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ newNamed: aSymbol
shortDescription: aShortDescription
description: aDescription
inCategory: aCategorySymbol
selector: aMethodSelector
selector: aMethodSelector
longRuntime: aBoolean
plugIn: aSLPlugInClass

^ self new
Expand All @@ -12,4 +13,5 @@ newNamed: aSymbol
name: (aShortDescription ifNil: [aSymbol asString]);
description: (aDescription ifNil: ['no description']);
category: (aCategorySymbol ifNil: [self defaultCategoryOf: aSLPlugInClass]);
method: (aMethodSelector ifNil: [(aSymbol, ':') asSymbol])
method: (aMethodSelector ifNil: [(aSymbol, ':') asSymbol]);
longRuntime: aBoolean.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
displaying
format

| display |

display := self name.
self longRuntime ifTrue: [display := '*', display].
^ display
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
longRuntime: anObject

longRuntime := anObject
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
longRuntime

^ longRuntime
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,24 @@
"isTestDataObject:" : "AT 5/8/2008 16:17",
"newFrom:" : "AT 5/8/2008 16:17",
"newFromArray:" : "AT 5/8/2008 16:16",
"newFromArray:plugin:" : "AT 5/8/2008 16:16",
"newFromArray:plugin:" : "MB 7/17/2014 11:36",
"newFromData:plugIn:" : "AT 5/8/2008 16:16",
"newNamed:" : "AT 5/8/2008 16:16",
"newNamed:shortDescription:description:" : "AT 5/23/2008 21:14",
"newNamed:shortDescription:description:inCategory:" : "AT 5/23/2008 21:14",
"newNamed:shortDescription:description:inCategory:selector:plugIn:" : "AT 5/8/2008 16:16" },
"newNamed:" : "MB 7/17/2014 11:36",
"newNamed:shortDescription:description:" : "MB 7/17/2014 11:36",
"newNamed:shortDescription:description:inCategory:" : "MB 7/17/2014 11:37",
"newNamed:shortDescription:description:inCategory:selector:longRuntime:plugIn:" : "MB 7/17/2014 11:35" },
"instance" : {
"category" : "AT 5/8/2008 12:25",
"category:" : "NR 1/10/2008 11:58",
"description" : "AT 5/8/2008 12:25",
"description:" : "NR 1/10/2008 11:58",
"format" : "MB 7/17/2014 16:25",
"hide" : "AT 5/27/2008 19:13",
"infoText" : "AT 5/8/2008 10:30",
"isHidden" : "AT 5/27/2008 19:13",
"isUserSelected" : "AT 5/8/2008 12:25",
"longRuntime" : "MB 7/17/2014 11:32",
"longRuntime:" : "MB 7/17/2014 11:32",
"markUserSelected" : "NR 1/29/2008 13:45",
"method" : "AT 5/8/2008 12:25",
"method:" : "NR 1/10/2008 12:01",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"method",
"testRunner",
"userSelected",
"hidden" ],
"hidden",
"longRuntime" ],
"name" : "SLTestData",
"pools" : [
],
Expand Down
2 changes: 1 addition & 1 deletion packages/SwaLint-Core.package/monticello.meta/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
31368e27-ea6f-c44d-a5b4-c107b9b04d08
9ad5dde2-ce6f-7c46-96d8-ea35c6508457
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(name 'SwaLint-Core-MB.36'message 'added superclass lookup'id 'c5da1959-dcee-5f45-8309-a17989920b79'date '17 July 2014'time '11:12:55.171 am'author 'MB'ancestors ((id '8ce4eba9-5551-0944-8b43-cab41086e16d'))stepChildren ())
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(name 'SwaLint-Core-MB.37'message 'added marking for tests with long runtime'id 'aaf46474-80fd-574d-ab4b-e0a57d82dd7f'date '17 July 2014'time '5:04:49.726 pm'author 'MB'ancestors ((id 'c5da1959-dcee-5f45-8309-a17989920b79'))stepChildren ())
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(name 'SwaLint-Core-MB.38'message 'added marking for long runtime tests'id '9ad5dde2-ce6f-7c46-96d8-ea35c6508457'date '21 July 2014'time '3:35:13.904 pm'author 'MB'ancestors ((id 'aaf46474-80fd-574d-ab4b-e0a57d82dd7f') (id '31368e27-ea6f-c44d-a5b4-c107b9b04d08'))stepChildren ())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ classAMW: aSLClassTestObject
amw := (methodNumber = 0) ifTrue: [0]
ifFalse: [totalWeight / methodNumber].

^ self numericResult: amw withThresholdFor: #ClassAMW
^ self numericResult: amw withThresholdFor: #MethodCYCLO
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ tests
numberOfMethods: aSLClassTestObject

^ self integerResult:
aSLClassTestObject methods size
aSLClassTestObject methods size
withThresholdFor: #NumberOfMethods
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
"allMethodsUsedIn:" : "AT 5/7/2008 21:33",
"avgLOCperMethod:" : "AT 5/17/2008 11:36",
"baseClassOverridingRatio:" : "AT 5/7/2008 21:33",
"classAMW:" : "MB 7/10/2014 10:14",
"classAMW:" : "MB 7/15/2014 12:39",
"classLOC:" : "AT 5/7/2008 21:33",
"classNAS:" : "MB 7/10/2014 10:15",
"classNAS:" : "MB 7/15/2014 10:53",
"classPNAS:" : "MB 7/10/2014 10:15",
"cohesion:" : "AT 5/7/2008 21:33",
"computeHITRecursively:" : "AT 5/7/2008 21:33",
Expand All @@ -54,7 +54,7 @@
"numberOfClassMethods:" : "AT 5/7/2008 21:32",
"numberOfForgeinAccessorsIn:calledBy:" : "AT 5/7/2008 21:32",
"numberOfInstanceMethods:" : "AT 5/7/2008 21:32",
"numberOfMethods:" : "AT 5/7/2008 21:32",
"numberOfMethods:" : "MB 7/15/2014 13:00",
"overridingMethodsOf:" : "AT 5/7/2008 21:32",
"ownMethodSelectorsOf:" : "AT 5/7/2008 21:31",
"similarInstVarsAreUsedBy:and:" : "AT 5/14/2008 22:42",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
test-data
basicClasses
"Classes that should not cause Tradition Breaker"

^ {
Object. ProtoObject. Class. Behavior.
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ offeredTestsData
{#dataClass. 'Data Class'. 'A Data Class is a dumb dataholder. Functionality is probably implemented in other classes which breaks with design principles like encapsulation and data hiding.'}.
{#godClass. 'God Class'. 'A God Class is a class that centralizes intelligence. Detected classes heavily access data of simpler classes, are large, complex and have a lot of non-communicative behaviour.'}.
{#brainMethod. 'Brain Method'. 'Brain Methods centralize the functionality of a class. They are overlong methods, which are harder to understand and debug, and practically impossible to reuse.'}.
{#brainClass. 'Brain Class'. 'Evaluates wether the Class is a Brain Class.'}.
{#shotgunSurgery. 'Shotgun Surgery'. 'Evaluates wether there are Shotgun Surgeries'}.
{#significantDuplication. 'Significant Duplication'. 'Evaluates wether there are Significant Duplications'}.
{#featureEnvy. 'Feature Envy'. 'Evaluates wether there is Feature Envy'}.
{#intensiveCoupling. 'Intensive Coupling'. 'Evaluates wether there is Intensive Coupling'}.
{#dispersedCoupling. 'Dispersed Coupling'. 'Evaluates wether there is Dispersed Coupling'}.
{#brainClass. 'Brain Class'. 'A Brain Class is a complex class that tends to accumulate an excessive amount of intelligence, usually in the form of several methods affected by Brain Method.'}.
{#shotgunSurgery. 'Shotgun Surgery'. 'The detection of a Shotgun Surgery means that a change in the detected method implies many changes to a lot of different operations and classes.'}.
{#significantDuplication. 'Significant Duplication'. 'A Significant Duplication is either a large standalone clone or a chain of exact clones considered to be one exact clone.'. nil. nil. true}.
{#featureEnvy. 'Feature Envy'. 'The detection of Feature Envy means that the detected method accesses a lot of data of other classes. This might be a sign that the method was misplaced and that it should be moved to another class.'}.
{#intensiveCoupling. 'Intensive Coupling'. 'The detection of Intensive Coupling means that the detected method is tied to many other operations, whereby these provider operations are dispersed only into one or a few classes.'}.
{#dispersedCoupling. 'Dispersed Coupling'. 'The detection of Dispersed Coupling means that the detected method is tied to many other operations, whereby these provider operations are dispersed among many classes.'}.
{#traditionBreaker. 'Tradition Breaker'. 'A Tradition Breaker is a Class that breaks the inherited "tradition". It provides a large set of services which are unrelated to those provided by its base class.'}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
private
excessiveInterfaceIncrease: aSLClassTestObject

^ ((aSLClassTestObject resultOf: #classNAS) >= #average) and:
[(aSLClassTestObject resultOf: #classPNAS) >= (2/3)]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
private
hasRelevantSuperclass: aSLClassTestObject

^ ((self class basicClasses) includes: aSLClassTestObject testObject superclass) not
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
private
parentNeitherSmallNorDumb: aSLClassTestObject
"returns false if parent is not selected or is included in basicClasses (see class side)"

| parent |

(self hasRelevantSuperclass: aSLClassTestObject)
ifTrue: [parent := aSLClassTestObject testClassSuperclass]
ifFalse: [^ false].
parent ifNil: [^ false]
ifNotNil: [^
(((parent resultOf: #classAMW) > #average) or:
[(parent resultOf: #weightedMethodCount) >= #veryHigh]) and:
[(parent resultOf: #numberOfMethods) >= #high]]
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ significantDuplication: aSLMethodTestObject
allMethods := aSLMethodTestObject testSystem allMethods copy.
allMethods remove: aSLMethodTestObject.
significantDuplications := allMethods select:
[:each | ((self significantDuplicationChain: aSLMethodTestObject with: each) or:
[self significantStandaloneExactClone: aSLMethodTestObject with: each])].
^ (self collectionResult: significantDuplications) showRule: [:items | items size > 0].
[:each | ((self significantDuplicationChain: aSLMethodTestObject with: each) or:
[self significantStandaloneExactClone: aSLMethodTestObject with: each])].
^ self methodListResult: significantDuplications
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
private
substantialSizeAndComplexity: aSLClassTestObject

^ (((aSLClassTestObject resultOf: #classAMW) > #average) or:
[(aSLClassTestObject resultOf: #weightedMethodCount) >= #veryHigh]) and:
[(aSLClassTestObject resultOf: #numberOfMethods) >= #high]
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
tests
traditionBreaker: aSLClassTestObject

aSLClassTestObject shouldBeClass.

^ self successResult:
((self excessiveInterfaceIncrease: aSLClassTestObject) and:
[self substantialSizeAndComplexity: aSLClassTestObject] and:
[self parentNeitherSmallNorDumb: aSLClassTestObject])
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,18 @@
"SignificantStandaloneExactCloneSize:" : "SO 7/9/2014 17:57",
"SmallLineBias" : "SO 7/9/2014 17:57",
"SmallLineBias:" : "SO 7/9/2014 17:58",
"basicClasses" : "MB 7/17/2014 11:38",
"defaultCategory" : "AT 5/8/2008 09:28",
"offeredTestsData" : "MB 7/10/2014 10:16" },
"offeredTestsData" : "MB 7/17/2014 16:55" },
"instance" : {
"brainClass:" : "MB 6/17/2014 12:59",
"brainMethod:" : "AT 5/27/2008 00:48",
"dataClass:" : "AT 5/27/2008 19:19",
"dispersedCoupling:" : "MB 7/10/2014 13:28",
"dispersedCoupling:" : "MB 7/11/2014 11:40",
"excessiveInterfaceIncrease:" : "MB 7/15/2014 10:50",
"featureEnvy:" : "MB 6/19/2014 08:20",
"godClass:" : "topa 12/7/2012 14:18",
"hasRelevantSuperclass:" : "MB 7/15/2014 13:01",
"intensiveCoupling:" : "MB 7/10/2014 10:17",
"isExcessivelyLarge:" : "SO 7/9/2014 19:06",
"lineIn:at:equals:at:" : "MB 6/17/2014 13:02",
Expand All @@ -34,8 +37,11 @@
"looksLikeDataClass:" : "AT 5/8/2008 09:28",
"looksLikeDispersedCoupling:" : "MB 7/10/2014 12:53",
"looksLikeIntensiveCoupling:" : "MB 7/10/2014 12:55",
"parentNeitherSmallNorDumb:" : "MB 7/15/2014 13:17",
"searchCloneIn:from:comparedWith:from:range:" : "SO 7/9/2014 19:01",
"shotgunSurgery:" : "SO 7/9/2014 19:02",
"significantDuplication:" : "MB 6/17/2014 13:00",
"significantDuplication:" : "MB 7/17/2014 12:00",
"significantDuplicationChain:with:" : "SO 7/9/2014 19:09",
"significantStandaloneExactClone:with:" : "SO 7/9/2014 19:10" } }
"significantStandaloneExactClone:with:" : "SO 7/9/2014 19:10",
"substantialSizeAndComplexity:" : "MB 7/15/2014 10:57",
"traditionBreaker:" : "MB 7/15/2014 13:15" } }
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
tests
methodCDISP: aSLMethodTestObject
"Number of classes := number of variables * 0.9"

^ self percentageResult:
(((aSLMethodTestObject resultOf: #methodCINT) <= 0)
ifTrue: [1]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"maxNesting:" : "AT 5/27/2008 00:42",
"methodATFD:" : "MB 6/19/2014 10:00",
"methodCC:" : "MB 6/19/2014 10:01",
"methodCDISP:" : "AT 5/27/2008 14:54",
"methodCDISP:" : "MB 7/11/2014 11:49",
"methodCINT:" : "MB 7/10/2014 10:21",
"methodCM:" : "MB 6/19/2014 10:01",
"methodCYCLO:" : "AT 5/28/2008 12:24",
Expand Down
2 changes: 1 addition & 1 deletion packages/SwaLint-PlugIns.package/monticello.meta/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1d27705d-84fb-4b42-b27b-87426b46bd90
6635c57c-c80d-cd46-8f29-20d418031551
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(name 'SwaLint-PlugIns-MB.38'message 'added tradition breaker'id '4b99c0e5-8d8f-9b49-93b9-afc2fa1437ed'date '17 July 2014'time '11:12:31.226 am'author 'MB'ancestors ((id '1d27705d-84fb-4b42-b27b-87426b46bd90'))stepChildren ())
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(name 'SwaLint-PlugIns-MB.39'message 'improved description of disharmonies'id '9efb0982-312f-3446-b8df-d48d97ed3eee'date '17 July 2014'time '5:05:32.737 pm'author 'MB'ancestors ((id '4b99c0e5-8d8f-9b49-93b9-afc2fa1437ed'))stepChildren ())
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(name 'SwaLint-PlugIns-MB.40'message 'added tradition breaker'id '6635c57c-c80d-cd46-8f29-20d418031551'date '21 July 2014'time '3:36:44.412 pm'author 'MB'ancestors ((id '9efb0982-312f-3446-b8df-d48d97ed3eee'))stepChildren ())
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit ad27958

Please sign in to comment.