#4 code quality

19
Code quality tools and metrics eleks.com

Upload: eleksdev

Post on 10-Feb-2017

1.548 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: #4 code quality

Code quality tools and metrics

eleks.com

Denys Skrypnyk
Не вистачає слайду з Схемками по Темплейту Сібіковського.
Denys Skrypnyk
Зараз Саша таке малює, тому можеш глянути в неї.
Halyna Hlynska
По темплейту Сібіковського в гугл доці не вийде. Тому що нам потрібен конструктор, щоб люди самі собі складали з квадратіків/стрілочок схемки тут та одразу правили. Зараз зроблю базову витяжку з усього нами намальованого.
Page 2: #4 code quality

Agenda

• Good code or not?• Metrics• Tools

Page 3: #4 code quality
Page 4: #4 code quality
Page 5: #4 code quality

Which code is good

• Metrics does exists to understand fitness of your code

• Various tools exists which helps to analyze it

Page 6: #4 code quality

Technical debt

..is extra development work that arises when code that is easy to implement in the short run is used instead of applying the best overall solution. 

Page 7: #4 code quality

Metrics

Page 8: #4 code quality

Cyclomatic complexity

It provides a numeric value representing the complexity of a function or method

Page 9: #4 code quality

Cyclomatic complexity

Page 10: #4 code quality

Chidamber & Kemerer object-oriented metrics

Shyam R. ChidamberChris F. Kemerer

http://faculty.salisbury.edu/~stlauterburg/cosc425/metricforood_chidamberkemerer94.pdf

Page 11: #4 code quality

Chidamber & Kemerer object-oriented metrics

Name Description

DIT Depth of inheritance tree

NOC Number of children

NPM Number of public methods

RFC Response for class - # of methods executed due to method call

CE Efferent coupling - # of other classes this class uses (outgoing calls)

CA Afferent coupling - how many other classes use this class (incoming calls)

WMC Weighted methods/class∑ of cyclomatic complexity

Page 12: #4 code quality

Limitations of metrics

• no “1 True Metric”• gathered but ignored• inaction / overaction• signal to noise prefer trends to discrete values

Page 13: #4 code quality

SonarQube - http://www.sonarqube.org

• Centralize code quality metrics

• Plugin based

Reports• Code coverage • Rule compliance• Documentation • Complexity • Technical debt

Page 14: #4 code quality

SonarQube – Helicopter View

Page 15: #4 code quality

SonarQube – Issues View

Page 16: #4 code quality

File View

Page 17: #4 code quality

Quality Gates

Page 18: #4 code quality

Sonarlint - http://www.sonarlint.org/

Page 19: #4 code quality

Inspired by Technology.Driven by Value.

Find us at eleks.com

Have a question? Write to [email protected]