#4 code quality

Preview:

Citation preview

Code quality tools and metrics

eleks.com

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

Agenda

• Good code or not?• Metrics• Tools

Which code is good

• Metrics does exists to understand fitness of your code

• Various tools exists which helps to analyze it

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. 

Metrics

Cyclomatic complexity

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

Cyclomatic complexity

Chidamber & Kemerer object-oriented metrics

Shyam R. ChidamberChris F. Kemerer

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

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

Limitations of metrics

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

SonarQube - http://www.sonarqube.org

• Centralize code quality metrics

• Plugin based

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

SonarQube – Helicopter View

SonarQube – Issues View

File View

Quality Gates

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

Inspired by Technology.Driven by Value.

Find us at eleks.com

Have a question? Write to eleksinfo@eleks.com

Recommended