-

   rss_rss_hh_new

 - e-mail

 

 -

 LiveInternet.ru:
: 17.03.2011
:
:
: 51

:


Copy-Paste-Detector Swift Xcode

, 24 2017 . 10:12 +


DRY Principle


- DRY (Dont Repeat Yourself). - . , , . , !
, , . . . 10 . , 10 . , 100000 .
?


  • , . , .
  • . , , .
  • . , . , .


, DRY, code-review.
, , .


  • Code-review , , . , .
  • , , pull request . , .
  • , . . . =! .

, , . , ?


CPD


Swift 2 .



, .
pmd brew install pmd.
, pmd . Swift CPD (copy paste detector). . : https://github.com/realm/SwiftLint


Xcode


, . Xcode Build Phases, , .


build script CopyPaste Detection Build Phases :


# Running CPD
pmd cpd --files ${EXECUTABLE_NAME} --minimum-tokens 50 --language swift --encoding UTF-8 --format net.sourceforge.pmd.cpd.XMLRenderer > cpd-output.xml --failOnViolation true
# Running script
php ./cpd_script.php -cpd-xml cpd-output.xml

, . , CPD , . minimum-tokens , . , , . , 50 Swift. , , , , . format , xml-. failOnViolation , , 1 .


, xml . Xcode warnings. :



xml warnings Xcode. , warnings Xcode .


, cmd+B/R , . .


Issue Navigator:




:




opypaste


, , . , copypaste . , . .


, Xcode . !

Original source: habrahabr.ru (comments, light).

https://habrahabr.ru/post/331238/

:  

: [1] []
 

:
: 

: ( )

:

  URL