-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
333965b
commit d8316bb
Showing
24 changed files
with
191 additions
and
3 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
packages/SwaLint-PlugIns.package/SLOtherPlugIn.class/README.md
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,3 @@ | ||
A disharmony is a design problem in a software, as for instance a class that holds much data but no logic (considered as a data class). | ||
|
||
I offer some disharmony detecting tests. |
7 changes: 7 additions & 0 deletions
7
packages/SwaLint-PlugIns.package/SLOtherPlugIn.class/class/basicClasses.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,7 @@ | ||
test-data | ||
basicClasses | ||
"Classes that should not cause Tradition Breaker" | ||
|
||
^ { | ||
Object. ProtoObject. Class. Behavior. Model. Morph | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/SwaLint-PlugIns.package/SLOtherPlugIn.class/class/classNamesNotUnderTest.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,3 @@ | ||
test-data | ||
classNamesNotUnderTest | ||
^ {self name asString} |
4 changes: 4 additions & 0 deletions
4
packages/SwaLint-PlugIns.package/SLOtherPlugIn.class/class/defaultCategory.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 @@ | ||
defaults | ||
defaultCategory | ||
|
||
^ 'Disharmonies II' |
7 changes: 7 additions & 0 deletions
7
packages/SwaLint-PlugIns.package/SLOtherPlugIn.class/class/offeredTestsData.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,7 @@ | ||
tests | ||
offeredTestsData | ||
|
||
^ { | ||
{#myPrecedence. 'Precedence Test'. 'A+B*C should maybe be A+(B*C).'}. | ||
{ #myTest . nil .nil . SwaLint hiddenCategory} | ||
} |
9 changes: 9 additions & 0 deletions
9
packages/SwaLint-PlugIns.package/SLOtherPlugIn.class/instance/brainClass..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,9 @@ | ||
tests | ||
brainClass: aSLClassTestObject | ||
|
||
aSLClassTestObject shouldBeClass. | ||
|
||
^ self successResult: | ||
(((aSLClassTestObject resultOf: #weightedMethodCount) >= #veryHigh) and: | ||
[(aSLClassTestObject resultOf: #tightClassCohesion) < 0.5] and: | ||
[self looksLikeBrainClass: aSLClassTestObject]) |
8 changes: 8 additions & 0 deletions
8
packages/SwaLint-PlugIns.package/SLOtherPlugIn.class/instance/brainMethod..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,8 @@ | ||
tests | ||
brainMethod: aSLMethodTestObject | ||
|
||
aSLMethodTestObject ifClassTestChildrenWith: #brainMethod. | ||
aSLMethodTestObject shouldBeMethod. | ||
^ self successResult: | ||
((self isExcessivelyLarge: aSLMethodTestObject) and: | ||
[self looksLikeBrainMethod: aSLMethodTestObject]) |
8 changes: 8 additions & 0 deletions
8
packages/SwaLint-PlugIns.package/SLOtherPlugIn.class/instance/dataClass..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,8 @@ | ||
tests | ||
dataClass: aSLClassTestObject | ||
|
||
aSLClassTestObject shouldBeClass. | ||
|
||
^ self successResult: | ||
(((aSLClassTestObject resultOf: #weightOfClass) < (1/3)) and: | ||
[self looksLikeDataClass: aSLClassTestObject]) |
8 changes: 8 additions & 0 deletions
8
packages/SwaLint-PlugIns.package/SLOtherPlugIn.class/instance/dispersedCoupling..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,8 @@ | ||
tests | ||
dispersedCoupling: aSLMethodTestObject | ||
|
||
aSLMethodTestObject ifClassTestChildrenWith: #dispersedCoupling. | ||
aSLMethodTestObject shouldBeMethod. | ||
^ self successResult: | ||
((self looksLikeDispersedCoupling: aSLMethodTestObject) and: | ||
[ (aSLMethodTestObject resultOf: #maxNesting) > #one ]) |
10 changes: 10 additions & 0 deletions
10
packages/SwaLint-PlugIns.package/SLOtherPlugIn.class/instance/featureEnvy..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 @@ | ||
tests | ||
featureEnvy: aSLMethodTestObject | ||
|
||
aSLMethodTestObject ifClassTestChildrenWith: #featureEnvy. | ||
aSLMethodTestObject shouldBeMethod. | ||
|
||
^ self successResult: | ||
(((aSLMethodTestObject resultOf: #methodATFD) > #few) and: | ||
[ (aSLMethodTestObject resultOf: #methodLAA) < (1/3) ] and: | ||
[ (aSLMethodTestObject resultOf: #methodFDP) <= #few ]) |
8 changes: 8 additions & 0 deletions
8
packages/SwaLint-PlugIns.package/SLOtherPlugIn.class/instance/godClass..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,8 @@ | ||
tests | ||
godClass: aSLClassTestObject | ||
|
||
aSLClassTestObject shouldBeClass. | ||
^ self successResult: | ||
(((aSLClassTestObject resultOf: #accessToForeignData) > #few) and: | ||
[((aSLClassTestObject resultOf: #weightedMethodCount) >= #veryHigh) and: | ||
[(aSLClassTestObject resultOf: #tightClassCohesion) <= (1/3)]]) |
8 changes: 8 additions & 0 deletions
8
packages/SwaLint-PlugIns.package/SLOtherPlugIn.class/instance/intensiveCoupling..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,8 @@ | ||
tests | ||
intensiveCoupling: aSLMethodTestObject | ||
|
||
aSLMethodTestObject ifClassTestChildrenWith: #intensiveCoupling. | ||
aSLMethodTestObject shouldBeMethod. | ||
^ self successResult: | ||
((self looksLikeIntensiveCoupling: aSLMethodTestObject) and: | ||
[ (aSLMethodTestObject resultOf: #maxNesting) > #one ]) |
6 changes: 6 additions & 0 deletions
6
packages/SwaLint-PlugIns.package/SLOtherPlugIn.class/instance/loadPreferences.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,6 @@ | ||
initialize-release | ||
loadPreferences | ||
|
||
" self loadPreferences: #(AverageLOCperMethodAVRG | ||
ClassLOCAVRG ClassLOCSTDEV WMCAVRG WMCSTDEV). | ||
self loadPreferenceCategory: #Disharmony." |
7 changes: 7 additions & 0 deletions
7
packages/SwaLint-PlugIns.package/SLOtherPlugIn.class/instance/myPrecedence..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,7 @@ | ||
tests | ||
myPrecedence: aSLClassTestObject | ||
aSLClassTestObject shouldBeClass. | ||
^ self | ||
summarizeNumberOf: aSLClassTestObject methods | ||
withResultOf: #myTest | ||
satisfying: [:result | result isPositive] |
15 changes: 15 additions & 0 deletions
15
packages/SwaLint-PlugIns.package/SLOtherPlugIn.class/instance/myTest..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,15 @@ | ||
tests | ||
myTest: aMethodTestObject | ||
|methodNode b| | ||
aMethodTestObject shouldBeMethod. | ||
|
||
methodNode := RBParser parseMethod: (aMethodTestObject sourceCode)." ('method0 | ||
1+2. | ||
^12')." | ||
b := false. | ||
methodNode body statements do: [:statement| | ||
Transcript show: statement selector. | ||
Transcript show: ((#(#select:) includes: (statement selector))). | ||
b := b or: ((#(#select:) includes: (statement selector))).]. | ||
^self booleanResult: b | ||
|
9 changes: 9 additions & 0 deletions
9
packages/SwaLint-PlugIns.package/SLOtherPlugIn.class/instance/shotgunSurgery..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,9 @@ | ||
tests | ||
shotgunSurgery: aSLMethodTestObject | ||
|
||
aSLMethodTestObject ifClassTestChildrenWith: #shotgunSurgery. | ||
aSLMethodTestObject shouldBeMethod. | ||
|
||
^ self successResult: | ||
((aSLMethodTestObject resultOf: #methodCM) > self class ShortMemoryCap and: | ||
[(aSLMethodTestObject resultOf: #methodCC) > #many]) |
14 changes: 14 additions & 0 deletions
14
packages/SwaLint-PlugIns.package/SLOtherPlugIn.class/instance/significantDuplication..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,14 @@ | ||
tests | ||
significantDuplication: aSLMethodTestObject | ||
|
||
| significantDuplications | | ||
|
||
aSLMethodTestObject ifClassTestChildrenWith: #significantDuplication. | ||
aSLMethodTestObject shouldBeMethod. | ||
|
||
significantDuplications := aSLMethodTestObject testSystem significantDuplicationUnseenMethods select: [ :each | | ||
((self significantDuplicationChain: aSLMethodTestObject with: each) or: | ||
[ self significantStandaloneExactClone: aSLMethodTestObject with: each ])]. | ||
aSLMethodTestObject testSystem significantDuplicationUnseenMethods | ||
remove: aSLMethodTestObject. | ||
^ self methodListResult: significantDuplications |
9 changes: 9 additions & 0 deletions
9
packages/SwaLint-PlugIns.package/SLOtherPlugIn.class/instance/traditionBreaker..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,9 @@ | ||
tests | ||
traditionBreaker: aSLClassTestObject | ||
|
||
aSLClassTestObject shouldBeClass. | ||
|
||
^ self successResult: | ||
((self excessiveInterfaceIncrease: aSLClassTestObject) and: | ||
[ self substantialSizeAndComplexity: aSLClassTestObject ] and: | ||
[ self parentNeitherSmallNorDumb: aSLClassTestObject ]) |
20 changes: 20 additions & 0 deletions
20
packages/SwaLint-PlugIns.package/SLOtherPlugIn.class/methodProperties.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,20 @@ | ||
{ | ||
"class" : { | ||
"basicClasses" : "topa 1/9/2015 16:17", | ||
"classNamesNotUnderTest" : "BD 5/25/2018 12:35", | ||
"defaultCategory" : "Lars Seifert 6/1/2018 15:38", | ||
"offeredTestsData" : "Lars Seifert 6/1/2018 16:44" }, | ||
"instance" : { | ||
"brainClass:" : "MB 6/17/2014 12:59", | ||
"brainMethod:" : "AT 5/27/2008 00:48", | ||
"dataClass:" : "AT 5/27/2008 19:19", | ||
"dispersedCoupling:" : "MT 7/23/2014 22:59", | ||
"featureEnvy:" : "MT 7/23/2014 23:00", | ||
"godClass:" : "topa 12/7/2012 14:18", | ||
"intensiveCoupling:" : "MT 7/23/2014 23:02", | ||
"loadPreferences" : "HD 7/9/2014 19:36", | ||
"myPrecedence:" : "Lars Seifert 6/1/2018 16:43", | ||
"myTest:" : "Lars Seifert 6/1/2018 17:34", | ||
"shotgunSurgery:" : "topa 1/9/2015 19:59", | ||
"significantDuplication:" : "topa 1/18/2015 22:06", | ||
"traditionBreaker:" : "MT 7/23/2014 23:13" } } |
21 changes: 21 additions & 0 deletions
21
packages/SwaLint-PlugIns.package/SLOtherPlugIn.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,21 @@ | ||
{ | ||
"category" : "SwaLint-PlugIns", | ||
"classinstvars" : [ | ||
], | ||
"classvars" : [ | ||
"LargeClassLOC", | ||
"LargeMethodLOC", | ||
"LargeWeightedMethodCount", | ||
"MinimumDuplicationChainLength", | ||
"MinimumExactCloneSize", | ||
"ShortMemoryCap", | ||
"SignificantStandaloneExactCloneSize", | ||
"SmallLineBias" ], | ||
"commentStamp" : "<historical>", | ||
"instvars" : [ | ||
], | ||
"name" : "SLOtherPlugIn", | ||
"pools" : [ | ||
], | ||
"super" : "SLPlugIn", | ||
"type" : "normal" } |
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
3 changes: 3 additions & 0 deletions
3
packages/SwaLint-Tests.package/SLCollectSelectNotUsed.class/instance/method1..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,3 @@ | ||
as yet unclassified | ||
method1: a | ||
^a+5 |
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