diff --git a/config/contents/duplicated_code.md.erb b/config/contents/duplicated_code.md.erb index 22bfe557..99b585fd 100644 --- a/config/contents/duplicated_code.md.erb +++ b/config/contents/duplicated_code.md.erb @@ -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 diff --git a/spec/cc/engine/analyzers/javascript/main_spec.rb b/spec/cc/engine/analyzers/javascript/main_spec.rb index 3e6209d6..e39cecac 100644 --- a/spec/cc/engine/analyzers/javascript/main_spec.rb +++ b/spec/cc/engine/analyzers/javascript/main_spec.rb @@ -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 @@ -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 diff --git a/spec/cc/engine/analyzers/php/main_spec.rb b/spec/cc/engine/analyzers/php/main_spec.rb index 048abc38..3da556f8 100644 --- a/spec/cc/engine/analyzers/php/main_spec.rb +++ b/spec/cc/engine/analyzers/php/main_spec.rb @@ -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 diff --git a/spec/cc/engine/analyzers/python/main_spec.rb b/spec/cc/engine/analyzers/python/main_spec.rb index 981814b9..2580cff6 100644 --- a/spec/cc/engine/analyzers/python/main_spec.rb +++ b/spec/cc/engine/analyzers/python/main_spec.rb @@ -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 @@ -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 diff --git a/spec/cc/engine/analyzers/ruby/main_spec.rb b/spec/cc/engine/analyzers/ruby/main_spec.rb index 0ac546c6..70596594 100644 --- a/spec/cc/engine/analyzers/ruby/main_spec.rb +++ b/spec/cc/engine/analyzers/ruby/main_spec.rb @@ -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