Closed konstin closed 6 years ago
In einigen PHP-Dateien mit ähnlichen Aufgaben findet sich identischer oder sehr ähnlicher code, der entfernt werden sollte.
Die Dateien, bei denen das der Fall ist, lassen sich gut mit tools wie phpcpd finden:
phpcpd
phpcpd 2.0.2 by Sebastian Bergmann. Found 8 exact clones with 236 duplicated lines in 11 files: - /home/konsti/Ratsinformant/protected/models/Tagesordnungspunkt.php:51-107 /home/konsti/Ratsinformant/protected/models/TagesordnungspunktHistory.php:51-107 - /home/konsti/Ratsinformant/protected/models/AntragHistory.php:90-116 /home/konsti/Ratsinformant/protected/models/Antrag.php:155-181 - /home/konsti/Ratsinformant/protected/config/main.template.php:58-119 /home/konsti/Ratsinformant/protected/config/main.php:58-119 - /home/konsti/Ratsinformant/protected/RISParser/BAAntragParser.php:193-219 /home/konsti/Ratsinformant/protected/RISParser/StadtratsvorlageParser.php:274-300 - /home/konsti/Ratsinformant/protected/RISParser/StadtratsvorlageParser.php:154-160 /home/konsti/Ratsinformant/protected/RISParser/StadtratsantragParser.php:119-125 - /home/konsti/Ratsinformant/protected/RISParser/BAAntragParser.php:116-132 /home/konsti/Ratsinformant/protected/RISParser/BAInitiativeParser.php:107-123 - /home/konsti/Ratsinformant/protected/RISParser/BAAntragParser.php:193-218 /home/konsti/Ratsinformant/protected/RISParser/BAInitiativeParser.php:180-205 - /home/konsti/Ratsinformant/protected/controllers/AntraegeController.php:75-95 /home/konsti/Ratsinformant/protected/controllers/AntraegeController.php:104-124 1.12% duplicated lines out of 21085 total lines of code. Time: 287 ms, Memory: 23.00Mb
Idealerweise sollte die Suche nach doppeltem Code automatisiert durchgeführt werden.
:+1:
codeclimate hat das noch etwas besser analysiert: https://codeclimate.com/github/codeformunich/Muenchen-Transparent/issues/categories/duplication
In einigen PHP-Dateien mit ähnlichen Aufgaben findet sich identischer oder sehr ähnlicher code, der entfernt werden sollte.
Die Dateien, bei denen das der Fall ist, lassen sich gut mit tools wie
phpcpd
finden:Idealerweise sollte die Suche nach doppeltem Code automatisiert durchgeführt werden.