Python ãªãã¡ã¯ã¿ãªã³ã°ã«ä½¿ããCloneDigger
çããããã«ã¡ã¯
ãå
æ°ã§ãããç§ã¯å
æ°ãªã®ãã»ã»ã»ï¼
TOEICã®ãªãã³ã¸ãæããæãæ¥ãã®ã ãããã
ãã¦ã¨ãä»æ¥ã¯ãªãã¡ã¯ã¿ãªã³ã°ã«ä½¿ããã½ããã§ããCloneDiggerãç´¹ä»ãããã¨æãã¾ãã
ä¸è¨ã§ããã¨ãã½ããã¦ã§ã¢ã®ã¯ãã¼ã³ã³ã¼ããæ¤åºï¼é¡ä¼¼ã³ã¼ãã®æ¤åºãè¡ããã¨ã§ãã
CloneDiggerã®æ¦è¦
CloneDiggerã¨ã¯ï¼
Pythonã®ã½ã¼ã¹ã³ã¼ãå
ã®Clone Codeãæ¤åºãã¾ããGPL Licenseãä¿æãã¦ããããã§ãã
以ä¸ãå
¬å¼ã«ããCode Cloneã®ã¹ã©ã¤ããã
Code Cloneã¨ã¯ãªã«ãï¼
ã½ã¼ã¹ã³ã¼ãå ã«ããä¼¼ã¦ããã³ã¼ãã®ãã¨ã§ãã
ã½ã¼ã¹ã³ã¼ãã«ã¯20%ç¨ã®Clone Codeãããããã§ã
ã¾ããã½ã¼ã¹ã³ã¼ãã®ã¯ãã¼ã³ã¯5-20%ç¨ããããã§ãã
ã½ã¼ã¹ã³ã¼ãã¯ãã¼ã³ãç¨ããããè¦å
æé·æ¦ç¥ãã¡ã³ããã³ã¹ã®å©ç¹ãæ ¹æ¬çãªåå ãéçºæ¦ç¥ã«ãããã®ã ããã§ãã
ãªããã½ã¼ã¹ã³ã¼ãã¯ãã¼ã³ã¯ãããªãï¼
æåã«æ¸ããã³ã¼ããééãã£ã¦ããã¨å ¨ã¦ã®ã³ã¼ããå¤æ´ããå¿ è¦ããããã¾ãå¤æ´ããã®ããã©ãããããª
ã©ããã£ã¦æ¤åºããã®ï¼
ããªã¼ç¶ã«æ§é ã解æãã¦æ¤åºãããããã
CloneDiggerã®ã¤ã³ã¹ãã¼ã«
sudo pip install clonedigger
å®è¡
$ clonedigger [fileå] Parsing clone.py ... done 1 sequences average sequence length: 4.000000 maximum sequence length: 4 Number of statements: 4 Calculating size for each statement... done Building statement hash... done Number of different hash values: 2 Building patterns... 2 patterns were discovered Choosing pattern for each statement... done Finding similar sequences of statements... 0 sequences were found Refining candidates... 0 clones were found Removing dominated clones... 0 clones were removed
ã¨ããã¨åããã©ã«ãã®ä¸ã«output.htmlãåå¨ãã¾ãã
åºåãã¡ã¤ã«
htmlãè¦ããããªæãã§è¦ãã°å¤§ä¸å¤«ã§ãã
ä¸ã®æ¹ãè¦ãã¨ä»¥ä¸ã®ãããªæãã«ãªãã¾ãã
æ¤åºãããCloneåã ãåå¨ããéãé¨åãä¸è´é¨åã赤ãé¨åã¯ç°ãªãé¨åã§ãã
è¦ã¯ãããåèã«ããªãããèªåã®ã³ã¼ãã¯ãã¼ã³ãç´ãã¦ããã¾ãããã¨ãããã¨ã§ãã