Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Jul 19, 2025. It is now read-only.

Commit bdf5bcd

Browse files
committed
Merge pull request #26 from codeclimate/devon/update-readme-documentation
Update README documentation
2 parents a63c39e + 8a2d053 commit bdf5bcd

File tree

1 file changed

+35
-38
lines changed

1 file changed

+35
-38
lines changed

‎README.md‎

Lines changed: 35 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,66 @@
11
# codeclimate-duplication
22

33
`codeclimate-duplication` is an engine that wraps [flay] and supports Ruby,
4-
Python, JavaScript, and PHP. You can run it in the command line using the Code
5-
Climate CLI, or on our [hosted analysis platform][codeclimate].
6-
7-
[codeclimate]: https://codeclimate.com/dashboard
4+
Python, JavaScript, and PHP. You can run it on the command line using the Code
5+
Climate CLI or on our [hosted analysis platform][codeclimate].
86

97
## Installation
108

11-
1. If you haven't already, [install the Code Climate CLI][cli]
12-
2. Run `codeclimate engines:enable duplication`. This command both installs the
13-
engine and enables it in your `.codeclimate.yml` file.
14-
3. You're ready to analyze! Browse into your project's folder and run
15-
`codeclimate analyze`.
16-
17-
[flay]: https://github.com/seattlerb/flay
18-
[cli]: https://github.com/codeclimate/codeclimate
9+
1. Install the [Code Climate CLI][cli], if you haven't already.
10+
2. Run `codeclimate engines:enable duplication`. This command installs the
11+
engine and enables it in your `.codeclimate.yml` file.
12+
3. You're ready to analyze! `cd` into your project's folder and run `codeclimate
13+
analyze`.
1914

2015
## Configuring
2116

22-
You can add the following to your `.codeclimate.yml` to get started with the
23-
duplication engine.
17+
### Languages
18+
19+
By enabling the duplication engine with the Code Climate CLI, all supported
20+
languages are configured by default, but we recommend adjusting this
21+
configuration to enable only the languages you care about. If you have a project
22+
with Ruby and JavaScript files, you might want the following configuration:
2423

2524
```yaml
2625
engines:
2726
duplication:
2827
enabled: true
2928
config:
3029
languages:
31-
YOUR_LANGUAGE:
30+
- ruby
31+
- javascript
3232
```
3333
34-
This will tell Code Climate to run the duplication engine with `YOUR_LANGUAGE`.
35-
You can also specify a `paths` array under `YOUR_LANGUAGE` which use Ruby's
36-
[`Dir.glob`][glob] format.
37-
38-
For example, all JavaScript and JSX files:
34+
This will tell the duplication engine to analyze Ruby and JavaScript files.
3935
40-
```yaml
41-
engines:
42-
duplication:
43-
enabled: true
44-
config:
45-
languages:
46-
javascript:
47-
paths:
48-
- "**/*.js"
49-
- "**/*.jsx"
50-
```
36+
### Threshold
5137
52-
[glob]: http://ruby-doc.org/core-1.9.3/Dir.html#method-c-glob
38+
We set useful threshold defaults for the languages we support but you may want
39+
to adjust these settings based on your project guidelines.
5340
54-
You can also specify the mass threshold which is what determines how much "mass"
55-
a block of code needs before it's checked for duplication. This varies from
56-
language to language with higher numbers needing more mass to trigger a check
57-
and lower numbers needing less mass.
41+
The threshold configuration represents the minimum "mass" a code block must have
42+
to be analyzed for duplication. If the engine is too easily reporting
43+
duplication, try raising the threshold. If you suspect that the engine isn't
44+
catching enough duplication, try lowering the threshold. The best setting tends
45+
to differ from language to language.
5846
59-
For example you could tell the engine to check only very large blocks of code:
47+
To adjust this setting, add a `mass_threshold` key with your preferred value for
48+
an enabled language:
6049

6150
```yaml
6251
engines:
6352
duplication:
6453
enabled: true
6554
config:
6655
languages:
56+
ruby:
57+
mass_threshold: 20
6758
javascript:
68-
mass_threshold: 300
6959
```
60+
61+
Note that you have the update the YAML structure under the `langauges` key to
62+
the Hash type to support extra configuration.
63+
64+
[codeclimate]: https://codeclimate.com/dashboard
65+
[flay]: https://github.com/seattlerb/flay
66+
[cli]: https://github.com/codeclimate/codeclimate

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /