Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/huonw/copypasteck
A simple plugin for checking for copy-paste errors in Rust
https://github.com/huonw/copypasteck
Last synced: about 1 month ago
JSON representation
A simple plugin for checking for copy-paste errors in Rust
- Host: GitHub
- URL: https://github.com/huonw/copypasteck
- Owner: huonw
- License: apache-2.0
- Created: 2014-07-17T11:47:42.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-03-20T01:36:31.000Z (over 9 years ago)
- Last Synced: 2024-09-14T04:22:59.994Z (2 months ago)
- Language: Rust
- Size: 250 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# copypasteck
[![Build Status](https://travis-ci.org/huonw/copypasteck.png)](https://travis-ci.org/huonw/copypasteck)
A basic `rustc` lint plugin for checking for copy-paste
duplication. This will warn about `if` and `match` branches with
duplicated conditions or contents.## Example
```toml
# Cargo.toml
[package]
name = "example"
version = "0.1.0"
authors = ["You "][dependencies.copypasteck]
git = "https://github.com/huonw/copypasteck"
``````rust
// src/main.rs
#![feature(phase)]#[phase(plugin)] extern crate copypasteck;
fn main() {
let a = 10i;
if a > 5 {
println!("hi");
} else if a > 5 {
println!("bye");
}
}
``````
$ cargo build
Updating git repository `https://github.com/huonw/copypasteck`
Compiling copypasteck v0.1.0 (https://github.com/huonw/copypasteck)
Compiling example v0.1.0 (file:...)
.../src/main.rs:9:15: 9:20 warning: contents of `if` condition identical to previous condition; was there a copy-paste error?, #[warn(copy_paste)] on by default
.../src/main.rs:9 } else if a > 5 {
^~~~~
.../src/main.rs:7:8: 7:13 note: previous condition here
.../src/main.rs:7 if a > 5 {
^~~~~
```## License
This is distributed under the same terms as Rust itself, dual MIT and
Apache. See `LICENSE-*`.