09 Sep 2020 12:43:34 UTC
- Distribution: School-Code-Compare
- Source (raw)
- Browse (raw)
- How to Contribute
- Testers (165 / 0 / 1)
- KwaliteeBus factor: 1
- 78.98% Coverage
- License: perl_5
- Perl: v5.14.0
- Activity24 month
- Download (28.82KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest versionBORISD Boris Däppen
compare-code - find files with similar code
This program is developed in an education/school environment. It's purpose is to help detect similiarities in the code of IT projects, and therefore making assessments (more) fair.
The script compares files containing source code (or any plain text) to each other. The general approach for comparison is: whitespace and comments are always removed (see
--helpfor more), then the comparison is done using the Levenshtein algorithm. Future releases may bring more sophisticated techniques.
This program is written in the Perl Programming Language.
If you are unfamiliar with GNU/Linux you might want to read doc::Windows in the doc directory.
compare-code ./lib -i perl compare-code -i cpp -f list_of_filepaths.txt -o html -p find path/to/projects -type f -name Cow.java | compare-code -i java
compare-code [DIR...] [OPTIONS...] Arguments: DIR analyse files in given directory Input can otherwise also be specified over: - the option --file / -f - STDIN, receiving filepaths (e.g. from a find command) Options: --all, -a show all results in output Don't hide skipped comparisons. Will somethimes cause a lot of output. --basedir, -b skip comparisons within projects under base directory Folders one below will be seen as project directories. Files inside projects will not be compared with each other. --charset, -c chars used for comparison Define one or more subsets of chars, used to compare the files: - visibles all chars without witespace - numsignes (default) like visibles, but words ignored in meaning (but not in position) - signes only special chars, no words or numbers --file, -f file to read from (containing filepaths) --help, -h show this manual --in, -i input format, optimize for language Supportet arguments: - hashy: python, perl, bash - slashy: php, js, java, cpp, cs, c - html, xml - txt (default) --mime, -m only compare if same MIME-type This options needs the Perl Library File::LibMagic installed. You will also need libmagic development files on your system. --out, -o output format You can define an output format: - html - tab (default) - csv --persist, -p print result to file (instead STDOUT) Saved in local directory with name pattern: - comparison_[year-month-day-hour-minute]_[method].[format] --sort, -s sort data by line before comparison Useful to ignore order of method declaration. Will most likely also find more false positives. --verbose, -v show actually compared data on STDERR --yes, -y Don't prompt for questions Program will start working without further confirmation. (Answer all user prompts with [yes])
Boris Däppen <email@example.com>
This software is copyright (c) 2020 by Boris Däppen.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Module Install Instructions
To install School::Code::Compare, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install School::Code::Compare
For more information on module installation, please visit the detailed CPAN module installation guide.