Skip to content
This repository was archived by the owner on Jul 19, 2025. It is now read-only.
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
13 changes: 10 additions & 3 deletions config/contents/duplicated_code.md.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,17 @@ Duplicated code can lead to software that is hard to understand and difficult to

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

## Issue Mass
## Tuning

Duplicated code has a calculated mass, which can be thought of as a measure of how much logic has been duplicated.
This issue has a mass of `<%= mass %>`: if you would like to change the minimum mass that will be reported as an issue, please see the details in [`codeclimate-duplication`'s documentation](https://docs.codeclimate.com/docs/duplication).
**This issue has a mass of <%= mass %>**.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum [mass](https://docs.codeclimate.com/docs/duplication#mass) a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See [`codeclimate-duplication`'s documentation](https://docs.codeclimate.com/docs/duplication) for more information about tuning the mass threshold in your `.codeclimate.yml`.

## Refactorings

Expand Down
4 changes: 2 additions & 2 deletions spec/cc/engine/analyzers/javascript/main_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
{"path" => "foo.js", "lines" => { "begin" => 2, "end" => 2} },
{"path" => "foo.js", "lines" => { "begin" => 3, "end" => 3} }
])
expect(json["content"]["body"]).to match /This issue has a mass of `11`/
expect(json["content"]["body"]).to match /This issue has a mass of 11/
expect(json["fingerprint"]).to eq("c4d29200c20d02297c6f550ad2c87c15")
end

Expand Down Expand Up @@ -60,7 +60,7 @@
{"path" => "foo.js", "lines" => { "begin" => 2, "end" => 2} },
{"path" => "foo.js", "lines" => { "begin" => 3, "end" => 3} }
])
expect(json["content"]["body"]).to match /This issue has a mass of `11`/
expect(json["content"]["body"]).to match /This issue has a mass of 11/
expect(json["fingerprint"]).to eq("d9dab8e4607e2a74da3b9eefb49eacec")
end

Expand Down
2 changes: 1 addition & 1 deletion spec/cc/engine/analyzers/php/main_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
expect(json["other_locations"]).to eq([
{"path" => "foo.php", "lines" => { "begin" => 10, "end" => 14} },
])
expect(json["content"]["body"]).to match /This issue has a mass of `11`/
expect(json["content"]["body"]).to match /This issue has a mass of 11/
expect(json["fingerprint"]).to eq("8234e10d96fd6ef608085c22c91c9ab1")
end

Expand Down
4 changes: 2 additions & 2 deletions spec/cc/engine/analyzers/python/main_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
{"path" => "foo.py", "lines" => { "begin" => 2, "end" => 2} },
{"path" => "foo.py", "lines" => { "begin" => 3, "end" => 3} }
])
expect(json["content"]["body"]).to match /This issue has a mass of `6`/
expect(json["content"]["body"]).to match /This issue has a mass of 6/
expect(json["fingerprint"]).to eq("3f3d34361bcaef98839d9da6ca9fcee4")
end

Expand Down Expand Up @@ -59,7 +59,7 @@
{"path" => "foo.py", "lines" => { "begin" => 2, "end" => 2} },
{"path" => "foo.py", "lines" => { "begin" => 3, "end" => 3} }
])
expect(json["content"]["body"]).to match /This issue has a mass of `6`/
expect(json["content"]["body"]).to match /This issue has a mass of 6/
expect(json["fingerprint"]).to eq("019118ceed60bf40b35aad581aae1b02")
end

Expand Down
2 changes: 1 addition & 1 deletion spec/cc/engine/analyzers/ruby/main_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def self.sub_degrees(str)
expect(json["other_locations"]).to eq([
{"path" => "foo.rb", "lines" => { "begin" => 9, "end" => 13} },
])
expect(json["content"]["body"]).to match /This issue has a mass of `18`/
expect(json["content"]["body"]).to match /This issue has a mass of 18/
expect(json["fingerprint"]).to eq("b7e46d8f5164922678e48942e26100f2")
end

Expand Down