Skip to content

A tool to find copy-paste code in your Xcode project and see them as ⚠️ Warnings!

License

Notifications You must be signed in to change notification settings

AlexPinhasov/AutoCopyPaste

Repository files navigation

AutoCopyPaste

A tool to find copy-paste code in your Xcode project and see them as ⚠️ Warnings!.

Platform Author Swift

Behind the scenesInstallationAuthorLicense

AutoLocalized scans your project and search for your localization files and project files containing localized keys. By using Rules and Validation methods ensuring your keys and files are organized, clean, and always up to date with your work.

Behind the scenes

I use this incedible framework https://github.com/pmd/pmd to help me find copy paste code.

For every code duplication found this package

  • Shows the file origin, how many lines are copied and where.

To Do's:

  • Use pmd to search for dead variables/functions .
  • Add Wiki
  • Finish README.md
  • Add build and test pass marks

Installation

1. Install Homebrew

  • after that run "brew install pmd" in terminal

2. AutoLocalized is available through SPM (Swift Package Manager). To install it, simply follow the next steps. Add AutoLocalized as a dependecy using SPM:

  • File -> Swift Packages -> Add Package Dependency

3. Create a "New Run Script Phase" under you target in "Build Phases" tab and copy the script below.

xml_data=$(pmd cpd --files ${PROJECT_NAME} --minimum-tokens 50 --language swift --encoding UTF-8 --format xml --failOnViolation true)

SDKROOT=macosx

cd ~/Library/Developer/Xcode/DerivedData/${PROJECT_NAME}-*/SourcePackages/checkouts/AutoCopyPaste
swift run -c release AutoCopyPaste "${xml_data}"
  • If you get an "error:invalid Access" error after building, just build agian it will go away. (SPM bug)

Author

AlexPinhasov, alexp.software@gmail.com

License

AutoCopyPaste is available under the MIT license. See the LICENSE file for more info.

About

A tool to find copy-paste code in your Xcode project and see them as ⚠️ Warnings!

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages