upgrading...
TRANSCRIPT
Why�is�it�a�good�time�to�refactor�your�code?�(1)
Trust�me:�if�you�had�time�for�upgrading,�you�would�have�time�for�refactoring
2/39
Why�is�it�a�good�time�to�refactor�your�code?�(2)
��������������������������������������������������������������������������������������������������������������������������������������������������������������
some�upgraded�behaviors�require�refactoring�after�all
3/39
Why�is�it�a�good�time�to�refactor�your�code?�(3)
����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
You�wan�to�implement�old�functions�via�new�features
4/39
RoadmapⅠ.�Community�Guidelines
Ⅱ.�Code�coverage
Ⅲ.�Dependencies�updating
Ⅳ.�Density�of�Comments
Ⅴ.�Cyclomatic�complexity
Ⅵ.�Static�code�analyzer
Ⅶ.�Commit�messages
5/39
Ⅰ.�Community�Guidelines�(1)
ruby-style-guide
A�community-driven�Ruby�coding�style�guide
https://github.com/bbatsov/ruby-style-guide
6/39
Ⅰ.�Community�Guidelines�(3)
rails-style-guide
A�community-driven�Rails�3�&�4�style�guide
https://github.com/bbatsov/rails-style-guide
8/39
Ⅱ.�Code�coverage�(1)simplecov
Code�coverage�for�Ruby�1.9+�with�a�powerful�configuration�library�and�automatic�merging�of�coverage�across�test�suites
gem�install�simplecov
10/39
Ⅳ.�Density�of�Comments�(2)inch
Documentation�measurement�tool�for�Ruby,�based�on�YARD.
gem�install�inch
17/39
Ⅴ.�Cyclomatic�complexity�(1)
developed�by�Thomas�J.�McCabe,�Sr.�in�1976
For�this�strongly�connected�control�flow�graph,�Cyclomatic�complexity�=�3�is�the�number�of�linearly�independent�cycles�that�exist�in�the�graph,�i.e.�those�cycles�that�do�not�contain�other�cycles�within�themselves.
21/39
Ⅴ.�Cyclomatic�complexity�(4)
���������������������������������������������
ex.�Cyclomatic�complexity�=�2
24/39
Ⅴ.�Cyclomatic�complexity�(5)
�������������������������������������������������������������������������
ex.�Cyclomatic�complexity�=�3
25/39
Ⅴ.�Cyclomatic�complexity�(6)
�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
ex.�Cyclomatic�complexity�=�826/39
Ⅴ.�Cyclomatic�complexity�(7�-�before)
������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
27/39
Ⅴ.�Cyclomatic�complexity�(8�-�after)
������������������������������������������������������
���������������������������������������������������������������������������������������������������������������������������������������������������
28/39
Ⅴ.�Cyclomatic�complexity�(9�-�after)
������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
29/39
How�to�write�good�commit�messages?
Use�English
Use�the�imperative,�present�tense:�“change”,�not�“changed”�or�“changes”;�“Fix�bug#1234”�is�better�than�“Fixed�bug�#1234”
Use�50-char�title�and�Use�72-character�columns�for�word-wrapping.
Read�more:�https://github.com/torvalds/linux/pull/17#issuecomment-5654674 38/39