When QualityAssistant Meets Pharo: Enforced Code Critiques Motivate More Valuable Rules

Post on 10-Feb-2017

130 views 1 download

transcript

@yuriy_tymchuk

When QualityAssistant Meets Pharo Enforced Code Critiques Motivate

More Valuable Rules

, Mohammad Ghafari, Oscar Nierstrasz Software Composition Group @ University of Bern

The Concept

The Concept

Rule

The Concept

Rule

The Concept

Rule Critique

produces

The Concept

Rule Critique

produces

The Concept

Rule Critique

[|]Code

produces

improves

The Concept

Rule Critique

[|]Code

produces

improves (feedback)

improves

The Concept

Rule Critique

[|]Code

produces

improves (feedback)

improves

The Concept

Rule Critique

[|]Code

produces

improves

The Concept

Rule Critique

[|]Code

produces

improves

The Existing CriticBrowser

Newly Introduced QualityAssistant

SmallLint Issues per Milestone

0

10

20

30

40

50

Pharo 3 Pharo 4 Pharo 5 Pharo 6*

Changes in Rules

Changes in Rules

Fixed

Changes in Rules

Fixed Removed

Added

Changes in Rules

Fixed Removed

Fixed

Fixed

(Collection>>#add:) protocol #adding

Fixed

(Collection>>#add:) protocol

(ArrayedCollection>>#add:) protocol #adding

#adding

Fixed

(Collection>>#add:) protocol

(ArrayedCollection>>#add:) protocol #adding

#accessing

Fixed

(Collection>>#add:) protocol

(ArrayedCollection>>#add:) protocol #adding

#accessing

Fixed

(Collection>>#add:) protocol#'as yet unclassified'

(ArrayedCollection>>#add:) protocol #adding

Fixed

(Collection>>#add:) protocol#'as yet unclassified'

(ArrayedCollection>>#add:) protocol #adding

Trivial Bug

Fixed

Fixed

RBModi!esCollectionRule

Fixed

RBModi!esCollectionRule

Horrible Bug

Removed

Removed

Probably missing ‘; yourself’

Non-blocks in special messages

References an abstract class

Removed

Probably missing ‘; yourself’

Non-blocks in special messages

References an abstract classsize = 1 ifTrue: ’:’ ifFalse: ’s:’

Removed

Probably missing ‘; yourself’

Non-blocks in special messages

References an abstract classString new

size = 1 ifTrue: ’:’ ifFalse: ’s:’

Removed

Probably missing ‘; yourself’

Non-blocks in special messages

References an abstract classString new

size = 1 ifTrue: ’:’ ifFalse: ’s:’

Educational

Added

Added

assert: a = b

ifNotNilDo: ifNotNil:

Smalltalk at: Smalltalk globals at:

assert: a equals: b

Added

assert: a = b

ifNotNilDo: ifNotNil:

Smalltalk at: Smalltalk globals at:

assert: a equals: b

Migration

Added

assert: a = b

ifNotNilDo: ifNotNil:

Smalltalk at: Smalltalk globals at:

assert: a equals: b

Migration

Recipe: use rewrite rules

Added

Added

BoxedFloat64 reference to

Added

BoxedFloat64 reference to

Private Access

Added

BoxedFloat64 reference to

Recipe: annotate/maintain a collection of system classes/methods

Private Access

Added

Added

b := RTMondrian new. b edges connectFrom: #superclass. b nodes: RTShape withAllSubclasses.

Added

b := RTMondrian new. b edges connectFrom: #superclass. b nodes: RTShape withAllSubclasses.

b := RTMondrian new. b edges connectFrom: #superclass. b nodes: RTShape withAllSubclasses.

Added

b := RTMondrian new. b edges connectFrom: #superclass. b nodes: RTShape withAllSubclasses.

Invocation order

b := RTMondrian new. b edges connectFrom: #superclass. b nodes: RTShape withAllSubclasses.

Added

b := RTMondrian new. b edges connectFrom: #superclass. b nodes: RTShape withAllSubclasses.

Recipe:initialize super initialize. self add: #edges requiresPreSend: #nodes:.

Invocation Order

b := RTMondrian new. b edges connectFrom: #superclass. b nodes: RTShape withAllSubclasses.

Added

Added

ReAbstractRule class >> #checksPackage; >> #checksClass; >> #checksMethod; >> #checksNode

Added

ReAbstractRule class >> #checksPackage; >> #checksClass; >> #checksMethod; >> #checksNode

true?

Added

ReAbstractRule class >> #checksPackage; >> #checksClass; >> #checksMethod; >> #checksNode

true?

Class Structure

Added

ReAbstractRule class >> #checksPackage; >> #checksClass; >> #checksMethod; >> #checksNode

true?

Recipe:(aClass inheritsFrom: ReAbstractRule) and: [ selectors anySatisfy: [ :s | aClass perform: s ] ]

Class Structure

Added

Added

gtInspectorMethodsIn: composite <gtInspectorPresentationOrder: 20> | methods | methods := (self methods collect: #asRingDefinition) sorted: [ :x :y | x selector < y selector ] composite list title: 'Methods'; display: methods; format: #selector; tags: [ :each | {each methodClass name} ]

Added

gtInspectorMethodsIn: composite <gtInspectorPresentationOrder: 20> | methods | methods := (self methods collect: #asRingDefinition) sorted: [ :x :y | x selector < y selector ] composite list title: 'Methods'; display: methods; format: #selector; tags: [ :each | {each methodClass name} ]

Added

gtInspectorMethodsIn: composite <gtInspectorPresentationOrder: 20> composite list title: 'Methods'; display: ((self methods collect: #asRingDefinition) sorted: [ :x :y | x selector < y selector ]);

format: #selector; tags: [ :each | {each methodClass name} ]

Added

gtInspectorMethodsIn: composite <gtInspectorPresentationOrder: 20> composite list title: 'Methods'; display: [ (self methods collect: #asRingDefinition) sorted: [ :x :y | x selector < y selector ] ]; format: #selector; tags: [ :each | {each methodClass name} ]

Added Lazy evaluation

gtInspectorMethodsIn: composite <gtInspectorPresentationOrder: 20> composite list title: 'Methods'; display: [ (self methods collect: #asRingDefinition) sorted: [ :x :y | x selector < y selector ] ]; format: #selector; tags: [ :each | {each methodClass name} ]

gtInspectorMethodsIn: composite <gtInspectorPresentationOrder: 20> composite list title: 'Methods'; display: [ (self methods collect: #asRingDefinition) sorted: [ :x :y | x selector < y selector ] ]; format: #selector; tags: [ :each | {each methodClass name} ]

Added Lazy evaluation

Recipe:presentation: aPresentation isTheLeftmostRecepientIn: aStatement

^ (aStatement isMessage or: [ aStatement isCascade ]) and: [ aStatement leftmostChainReceiver = aPresentation ]

Feedback

Feedback

http://renraku.inf.usi.ch/rules

Feedbackhttp://renraku.inf.usi.ch/rules

Feedbackhttp://renraku.inf.usi.ch/rules

Feedbackhttp://renraku.inf.usi.ch/rules

Feedbackhttp://renraku.inf.usi.ch/rules

@yuriy_tymchuk

When QualityAssistant Meets Pharo Enforced Code Critiques Motivate

More Valuable Rules

, Mohammad Ghafari, Oscar Nierstrasz Software Composition Group @ University of Bern

@yuriy_tymchuk

When QualityAssistant Meets Pharo Enforced Code Critiques Motivate

More Valuable Rules

, Mohammad Ghafari, Oscar Nierstrasz Software Composition Group @ University of Bern

Important Fixes

@yuriy_tymchuk

When QualityAssistant Meets Pharo Enforced Code Critiques Motivate

More Valuable Rules

, Mohammad Ghafari, Oscar Nierstrasz Software Composition Group @ University of Bern

Important Fixes

Educational Rules Removed

@yuriy_tymchuk

When QualityAssistant Meets Pharo Enforced Code Critiques Motivate

More Valuable Rules

, Mohammad Ghafari, Oscar Nierstrasz Software Composition Group @ University of Bern

Important Fixes

Educational Rules Removed

Domain Rules Added

@yuriy_tymchuk

When QualityAssistant Meets Pharo Enforced Code Critiques Motivate

More Valuable Rules

, Mohammad Ghafari, Oscar Nierstrasz Software Composition Group @ University of Bern

Important Fixes

Educational Rules Removed

Domain Rules Added

Migration

@yuriy_tymchuk

When QualityAssistant Meets Pharo Enforced Code Critiques Motivate

More Valuable Rules

, Mohammad Ghafari, Oscar Nierstrasz Software Composition Group @ University of Bern

Important Fixes

Educational Rules Removed

Domain Rules Added

Migration Private access

@yuriy_tymchuk

When QualityAssistant Meets Pharo Enforced Code Critiques Motivate

More Valuable Rules

, Mohammad Ghafari, Oscar Nierstrasz Software Composition Group @ University of Bern

Important Fixes

Educational Rules Removed

Domain Rules Added

Migration Private access Invocation order

@yuriy_tymchuk

When QualityAssistant Meets Pharo Enforced Code Critiques Motivate

More Valuable Rules

, Mohammad Ghafari, Oscar Nierstrasz Software Composition Group @ University of Bern

Important Fixes

Educational Rules Removed

Domain Rules Added

Migration Private access Invocation order Class structure

@yuriy_tymchuk

When QualityAssistant Meets Pharo Enforced Code Critiques Motivate

More Valuable Rules

, Mohammad Ghafari, Oscar Nierstrasz Software Composition Group @ University of Bern

Important Fixes

Educational Rules Removed

Domain Rules Added

Migration Private access Invocation order Class structure Lazy evaluation