Skip to content
This repository was archived by the owner on Jul 19, 2025. It is now read-only.

Add README and LICENSE #11

Merged
merged 1 commit into from
Oct 19, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2015 Code Climate, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
67 changes: 67 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,68 @@
# codeclimate-duplication

`codeclimate-duplication` is an engine that wraps [flay] and supports Ruby,
Python, JavaScript, and PHP. You can run it in the command line using the Code
Climate CLI, or on our [hosted analysis platform][codeclimate].

[codeclimate]: https://codeclimate.com/dashboard

## Installation

1. If you haven't already, [install the Code Climate CLI][cli]
2. Run `codeclimate engines:enable duplication`. This command both installs the
engine and enables it in your `.codeclimate.yml` file.
3. You're ready to analyze! Browse into your project's folder and run
`codeclimate analyze`.

[cli]: https://github.com/codeclimate/codeclimate

## Configuring

You can add the following to your `.codeclimate.yml` to get started with the
duplication engine.

```yaml
engines:
duplication:
enabled: true
config:
languages:
YOUR_LANGUAGE:
```

This will tell Code Climate to run the duplication engine with `YOUR_LANGUAGE`.
You can also specify a `paths` array under `YOUR_LANGUAGE` which use Ruby's
[`Dir.glob`][glob] format.

For example, all JavaScript and JSX files:

```yaml
engines:
duplication:
enabled: true
config:
languages:
javascript:
paths:
- "**/*.js"
- "**/*.jsx"
```

[glob]: http://ruby-doc.org/core-1.9.3/Dir.html#method-c-glob

You can also specify the mass threshold which is what determines how much "mass"
a block of code needs before it's checked for duplication. This varies from
language to language with higher numbers needing more mass to trigger a check
and lower numbers needing less mass.

For example you could tell the engine to check only very large blocks of code:

```
engines:
duplication:
enabled: true
config:
languages:
javascript:
mass_threshold: 300
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part isn't true yet, it needs to be updated to work with the new config format. Thank you README driven development.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should omit it until it's true

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise someone will try it and mention that it doesn't work :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just going to keep this open until that gets fixed. It should be a quick, minor fix.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah - that's fair

```