Skip to content

Commit

Permalink
lint fixes (mostly isNil and magic numbers) (#138)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxplaga committed Jul 25, 2018
1 parent b229cec commit dd55b49
Show file tree
Hide file tree
Showing 35 changed files with 95 additions and 35 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
default properties
textDisabledAlpha
^ 0.6
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
drawing
calculateWidthByText

(self icon = nil and: self iconRight = nil)
(self icon isNil and: self iconRight isNil)
ifTrue: [^ self label width + (2 * self class defaultPadding)]
ifFalse: [
| width |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
accessing
textColorDisabled

^ (self class gray: self backgroundColor) alpha: 0.6
^ (self class gray: self backgroundColor) alpha: self class textDisabledAlpha
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@
"defaultTextColor" : "mats 5/21/2018 14:51",
"icon:" : "JW 6/19/2018 10:20",
"iconRight:" : "JW 6/19/2018 10:20",
"minWidth" : "JW 5/17/2018 13:01" },
"minWidth" : "JW 5/17/2018 13:01",
"textDisabledAlpha" : "Max 7/25/2018 11:31" },
"instance" : {
"addIcon:" : "CG 7/1/2018 11:10",
"addIconRight:" : "CG 7/1/2018 11:10",
"calculateTextColor" : "CG 7/1/2018 11:14",
"calculateWidth" : "JW 5/27/2018 11:47",
"calculateWidthByText" : "mats 6/21/2018 11:31",
"calculateWidthByText" : "Max 7/25/2018 10:59",
"checkToggled" : "mats 7/3/2018 13:09",
"decreaseSize" : "mats 5/22/2018 11:06",
"defaultHeight" : "mats 7/10/2018 12:45",
Expand Down Expand Up @@ -57,7 +58,7 @@
"text:" : "JW 6/8/2018 15:03",
"textColor" : "CG 7/1/2018 11:35",
"textColor:" : "JW 6/8/2018 15:24",
"textColorDisabled" : "JW 5/23/2018 16:26",
"textColorDisabled" : "Max 7/25/2018 11:31",
"textProperty:" : "CG 7/1/2018 11:36",
"toggleOff" : "JW 6/15/2018 12:39",
"toggleOn" : "mats 7/3/2018 13:09",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
default properties
backgroundDisabledAlpha
^ 0.14
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
properties
backgroundColorDisabled

^ (self class gray: self backgroundColor) alpha: 0.14
^ (self class gray: self backgroundColor) alpha: self class backgroundDisabledAlpha
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"class" : {
"backgroundDisabledAlpha" : "Max 7/25/2018 11:33",
"disabledOpacity" : "JW 5/23/2018 16:12",
"stateToOverlay" : "mats 5/26/2018 18:04",
"stateTransitionFrom:withAction:" : "mats 5/24/2018 09:44",
Expand All @@ -13,7 +14,7 @@
"arguments" : "CG 7/1/2018 11:08",
"arguments:" : "JW 6/20/2018 23:11",
"backgroundColor:" : "CG 6/30/2018 12:17",
"backgroundColorDisabled" : "JW 5/23/2018 16:19",
"backgroundColorDisabled" : "Max 7/25/2018 11:32",
"borderBottomLeftRadius:" : "mats 5/15/2018 16:16",
"borderBottomRightRadius:" : "mats 5/15/2018 16:16",
"borderRadius:" : "mats 5/15/2018 16:16",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
defaultBackgroundColor

^ '#e0e0e0'
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
defaultHeight

^ 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
defaultWidth

^ 100
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ initialize
super initialize.

self
height: 1;
width: 100;
backgroundColor: '#e0e0e0';
height: self class defaultHeight;
width: self class defaultWidth;
backgroundColor: self class defaultBackgroundColor;
changed
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
{
"class" : {
"defaultBackgroundColor" : "Max 7/25/2018 11:37",
"defaultHeight" : "Max 7/25/2018 11:39",
"defaultPadding" : "mats 6/1/2018 16:03",
"defaultWidth" : "Max 7/25/2018 11:38",
"newOn:" : "mats 5/30/2018 23:42" },
"instance" : {
"drawOn:" : "mats 6/1/2018 23:27",
"formCache" : "CG 7/1/2018 11:52",
"formCache:" : "CG 7/1/2018 11:52",
"initialize" : "mats 5/31/2018 09:38",
"initialize" : "Max 7/25/2018 11:40",
"padding" : "CG 7/1/2018 11:52",
"padding:" : "CG 7/1/2018 11:52",
"updateFormCache" : "CG 7/1/2018 11:52",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
as yet unclassified
defaultBackgroundColor
^ Color white
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
as yet unclassified
defaultHeight
^ 500
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
as yet unclassified
defaultWidth
^ 300
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ initialize
super initialize.
self
beSticky;
height: 500;
width: 300;
backgroundColor: Color white;
height: self class defaultHeight ;
width: self class defaultWidth;
backgroundColor: self class defaultBackgroundColor;
showDividers: true
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
"class" : {
"defaultBackgroundColor" : "Max 7/25/2018 11:43",
"defaultDividerPadding" : "mats 6/1/2018 23:29",
"defaultHeight" : "Max 7/25/2018 11:42",
"defaultListItemPadding" : "mats 6/1/2018 15:57",
"defaultWidth" : "Max 7/25/2018 11:42",
"listItemDenseHeight" : "Max 7/12/2018 11:45",
"listItemHeight" : "mats 7/10/2018 12:43",
"scrollDelta" : "mats 5/30/2018 14:13" },
Expand Down Expand Up @@ -44,7 +47,7 @@
"hasDenseLayout" : "mats 7/10/2018 12:49",
"hasFilter" : "CG 7/1/2018 12:08",
"ifInBounds:do:" : "mats 7/3/2018 15:30",
"initialize" : "mats 6/8/2018 15:04",
"initialize" : "Max 7/25/2018 11:43",
"lastKeystrokes" : "CG 7/1/2018 12:08",
"lastKeystrokes:" : "CG 7/1/2018 12:08",
"lastVisibleItem" : "mats 7/10/2018 12:51",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
accessing
anyMenuItemHasIcon

^ self items anySatisfy: [:each | each hasIcon].
^ self items anySatisfy: [:each | each hasIcon]
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
keystrokes
handlesEscStroke: anEvent

anEvent keyValue = 27 ifFalse: [^false].
anEvent keyValue = 27 ifFalse: [^false]. "27 is the keyValue of the Escape key"
self deactivate: anEvent.

^true
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"addLine" : "CG 7/1/2018 11:56",
"addMenuItem:" : "Max 6/4/2018 17:40",
"alignItemsWithoutIcons" : "LS 6/12/2018 16:56",
"anyMenuItemHasIcon" : "CG 7/1/2018 11:56",
"anyMenuItemHasIcon" : "Max 7/25/2018 10:05",
"bottomBorderInWorld:" : "LS 6/12/2018 21:45",
"deactivate:" : "CG 7/1/2018 11:56",
"delete" : "CG 7/1/2018 11:56",
Expand All @@ -32,7 +32,7 @@
"drawOn:" : "LS 6/12/2018 16:56",
"getXPosition:" : "CG 7/1/2018 11:58",
"getYPosition:" : "CG 7/1/2018 11:59",
"handlesEscStroke:" : "CG 7/1/2018 11:59",
"handlesEscStroke:" : "Max 7/25/2018 11:46",
"handlesKeyboard:" : "LS 6/5/2018 18:20",
"handlesMouseDown:" : "LS 6/7/2018 10:16",
"handlesMouseOver:" : "LS 6/6/2018 18:53",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
defaultBorderRadius

^ 5
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
defaultHeight

^ 20
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
defaultPosition

^ -10 @ 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
defaultWidth

^ 10
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
maxHeight

^ 10
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ initialize

self
visible: false;
width: 10;
height: 20;
width: self class defaultWidth;
height: self class defaultHeight ;
backgroundColor: self class defaultBackgroundColor;
borderRadius: 5;
position: -10 @ 0
borderRadius: self class defaultBorderRadius;
position: self class defaultPosition
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ updateHeight

percentage >= 1
ifTrue: [self visible: false]
ifFalse: [self height: (percentage * self scrollableWidget height max: 10)]]
ifFalse: [self height: (percentage * self scrollableWidget height max: self class maxHeight)]]
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
{
"class" : {
"defaultBackgroundColor" : "mats 6/7/2018 10:35",
"defaultBorderRadius" : "Max 7/25/2018 11:49",
"defaultHeight" : "Max 7/25/2018 11:48",
"defaultPosition" : "Max 7/25/2018 11:49",
"defaultWidth" : "Max 7/25/2018 11:48",
"durationToWaitUntilFadeOut" : "mats 6/7/2018 10:03",
"fadeOutDuration" : "mats 6/7/2018 09:31",
"maxHeight" : "Max 7/25/2018 11:51",
"newOn:" : "mats 6/5/2018 22:22" },
"instance" : {
"drawOn:" : "mats 6/7/2018 10:16",
"initialize" : "mats 6/10/2018 22:46",
"initialize" : "Max 7/25/2018 11:50",
"isFadeOutDurationDone" : "mats 6/8/2018 15:38",
"lastScrollTime" : "CG 7/1/2018 12:10",
"lastScrollTime:" : "CG 7/1/2018 12:10",
Expand All @@ -18,5 +23,5 @@
"step" : "mats 6/10/2018 22:45",
"update" : "mats 6/7/2018 10:29",
"updateAlpha:" : "mats 6/8/2018 15:38",
"updateHeight" : "mats 6/8/2018 13:41",
"updateHeight" : "Max 7/25/2018 11:51",
"updatePosition" : "mats 6/13/2018 10:48" } }
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
accessing
currentBorderColor: aValue

^ self setProperty: #currentBorderColor to: (self colorFrom: aValue).
^ self setProperty: #currentBorderColor to: (self colorFrom: aValue)
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"calculateTextPosition" : "JW 6/5/2018 11:34",
"contentHeight" : "JW 6/16/2018 12:16",
"currentBorderColor" : "CG 7/1/2018 12:11",
"currentBorderColor:" : "JW 6/5/2018 03:05",
"currentBorderColor:" : "Max 7/25/2018 10:04",
"currentBorderWidth" : "CG 7/1/2018 12:11",
"currentBorderWidth:" : "JW 6/5/2018 03:03",
"deactivate" : "CG 7/1/2018 12:11",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ testBorderRadiusWith: aMDWidget

testValues := #(10 20 30 0.5).

aMDWidget borderTopRightRadius: (testValues at: 1).
aMDWidget borderTopRightRadius: (testValues first).
aMDWidget borderTopLeftRadius: (testValues at: 2).
aMDWidget borderBottomRightRadius: (testValues at: 3).
aMDWidget borderBottomLeftRadius: (testValues at: 4).

self assert: aMDWidget borderTopRightRadius = (testValues at: 1).
self assert: aMDWidget borderTopRightRadius = (testValues first).
self assert: aMDWidget borderTopLeftRadius = (testValues at: 2).
self assert: aMDWidget borderBottomRightRadius = (testValues at: 3).
self assert: aMDWidget borderBottomLeftRadius = (testValues at: 4)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"testBackgroundColor" : "mats 6/13/2018 10:51",
"testBackgroundColorWith:" : "mats 6/13/2018 10:52",
"testBorderRadius" : "mats 6/13/2018 10:46",
"testBorderRadiusWith:" : "CG 6/30/2018 12:05",
"testBorderRadiusWith:" : "Max 7/25/2018 11:04",
"testText" : "mats 6/13/2018 10:56",
"testTextColor" : "mats 6/13/2018 10:58",
"testTextColorOn:" : "mats 6/13/2018 10:54",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
updating
checkForChangedContent

self model = nil
self model isNil
ifFalse: [
| stringCollection |
stringCollection := self model perform: self getListSelector.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ getMenu: shiftKeyState
"Answer the menu for this text view, supplying an empty menu to be filled in. If the menu selector takes an extra argument, pass in the current state of the shift key."

| menu aMenu aTitle |
self menu == nil ifTrue: [^ nil].
self isNil ifTrue: [^ nil].
menu := MenuMorph new defaultTarget: self model.
aTitle := self getMenuTitleSelector ifNotNil: [self model perform: self getMenuTitleSelector].
self menu numArgs = 1 ifTrue:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"changeSelected" : "CG 7/11/2018 17:40",
"changeSelected:" : "CG 7/11/2018 17:40",
"changed" : "mats 7/9/2018 15:07",
"checkForChangedContent" : "mats 7/10/2018 11:18",
"checkForChangedContent" : "Max 7/25/2018 10:52",
"clearFilterAutomatically" : "CG 7/11/2018 17:40",
"clearFilterAutomatically:" : "CG 7/11/2018 17:40",
"commandKeyTypedIntoMenu:" : "mats 7/9/2018 15:31",
Expand All @@ -31,7 +31,7 @@
"getListSizeSelector" : "CG 7/11/2018 17:42",
"getListSizeSelector:" : "CG 7/11/2018 17:42",
"getMaterialIconFrom:" : "mats 7/10/2018 14:06",
"getMenu:" : "CG 7/11/2018 17:43",
"getMenu:" : "Max 7/25/2018 10:59",
"getMenuTitleSelector" : "CG 7/11/2018 17:43",
"getMenuTitleSelector:" : "CG 7/11/2018 17:43",
"handleBasicKeys:" : "CG 7/11/2018 17:43",
Expand Down

0 comments on commit dd55b49

Please sign in to comment.