duplicate_code 0.8.1

A tool for parsing directories scanning all the files within to find duplicate segments of code across files.
# Duplicate Code
[![crates.io](https://img.shields.io/crates/v/duplicate_code)](https://crates.io/crates/duplicate_code) [![pipeline status](https://gitlab.com/DeveloperC/duplicate_code/badges/master/pipeline.svg)](https://gitlab.com/DeveloperC/duplicate_code/commits/master) [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org) [![License: AGPL v3](https://img.shields.io/badge/License-AGPLv3-blue.svg)](https://www.gnu.org/licenses/agpl-3.0)


A tool for parsing directories scanning all the files within to find duplicate segments of code across files.


## Content
 * [Usage]#usage
   + [Usage - Additional Flags]#usage-additional-flags
   + [Usage - Logging]#usage-logging
 * [Compiling via Local Repository]#compiling-via-local-repository
 * [Compiling via Cargo]#compiling-via-cargo
 * [Issues/Feature Requests]#issuesfeature-requests


## Usage
Duplicate Code scans the current directory and all sub-directories to find every file, then each file is compared against all the other files to find duplicate segments across the files.


## Usage - Additional Flags
| Flag                | |
|---------------------|-|
| --ignore-line-regex | Ignore every line that matches any of these provided regexes. For example, to ignore the imports and package declarations in Java code  `--ignore-line-regex '^import ' '^package '`. |
| --ignore-file-regex | Ignore every file that matches any of these provided regexes. For example, to all XML and CSV files  `--ignore-file-regex '[.]xml$' '[.]csv$'`. |
| --minimum-successive-lines | The minimum number of successive lines that must match to be considered a duplicate. The default value is 3.|
| --json | Output all the duplicates information as single line JSON. So it can easily be stored, ingested and processed by other programs. |

## Usage - Logging
The crates `pretty_env_logger` and `log` are used to provide logging.
The environment variable `RUST_LOG` can be used to set the logging level.
See [https://crates.io/crates/pretty_env_logger](https://crates.io/crates/pretty_env_logger) for more detailed documentation.


## Compiling via Local Repository
Checkout the code repository locally, change into the repository's directory and then build via cargo.
Using the `--release` flag produces an optimised binary but takes longer to compile.

```
git clone git@gitlab.com:DeveloperC/duplicate_code.git
cd duplicate_code/
cargo build --release
```

The compiled binary is present in `target/release/duplicate_code`.


## Compiling via Cargo
Cargo is the Rust package manager, using the `install` sub-command it pulls the crate from `crates.io` and then compiles the binary locally.
`cargo install` places the produced binary at `$HOME/.cargo/bin/duplicate_code`.

```
cargo install duplicate_code
```


## Issues/Feature Requests
To report a bug/issue or request a new feature use [https://gitlab.com/DeveloperC/duplicate_code/-/issues](https://gitlab.com/DeveloperC/duplicate_code/-/issues).