Page Comparison - Introducing dupFinder (v.20 vs v.21)

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • /exclude – allows excluding files from the duplicates search. The value is a semicolon-delimited wildcards (for example, *Generated.cs). Note that the paths should be either absolute or relative to the working directory.
  • /exclude-by-comment – allows excluding files that have a matching substrings in the opening comments. Multiple values are separated with the semicolon.
  • /exclude-code-regions – allows excluding code regions that have a matching substrings in their names. (e.g. ‘generated code’ will exclude regions containing ‘Windows Form Designer generated code’). Multiple values are separated with the semicolon.
  • /discard-fields, /discard-literals, /discard-local-vars, /discard-types – these options specify whether to filter out similar fragments as non-duplicates if they have different variables, fields, methods, types or literals. The default value for all of them is ‘false’. To illustrate the way it works, consider the following example. There are two code fragments otherwise identical, one contains myStatusBar.SetText("Logging In...");, the other contains myStatusBar.SetText("Not Logged In");. If 'discard-literals' is 'false' (which it is by default) these fragments are considered duplicates. To exclude such items from the list of detected duplicates, you can use /discard-literals=true.
  • /discard-cost – allows setting a threshold for code complexity of the duplicated fragments. The fragments with lower complexity are discarded as non-duplicates. The value for this option is provided in relative units. Using this option, you can filter out equal code fragments that present no semantic duplication. E.g. you can often have the following statements in tests: Assert.AreEqual(gold, result);. If the ‘discard-cost’ value is less than 10, statements like that will appear as duplicates, which is obviously unhelpful. You’ll need to play a bit with this value to find a balance between avoiding false positives and missing real duplicates. The proper values will differ for different codebases.
  • /properties – lets you override MSBuild properties. You can set each property separately (/properties:prop1=val1 /properties:prop2=val2), or use a semicolon to separate multiple properties (/properties:prop1=val1;prop2=val2). The specified properties are applied to all analyzed projects. Currently, there is no direct way to set a property to a specific project only. The workaround is to create a custom property in this project and assign it to the desired property, then use the custom property in dupFinder parameters.
  • /normalize-types – allows normalizing type names to the last subtype.
  • /show-text – if you use this parameter, the detected duplicate fragments will be embedded into the report.
  • /config-create and /config – these options allow you to pass the parameters described above with a configuration file. The first option will create a configuration file according to the current parameters; the second option is used to load the parameters from this file.

...