Skip to content

Commit

Permalink
Merge pull request #5 from keyoke/keyoke/features
Browse files Browse the repository at this point in the history
Keyoke/features
  • Loading branch information
keyoke authored Sep 13, 2021
2 parents 5dcf386 + 49bdb4f commit d70e537
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 6 additions & 0 deletions overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,10 @@ Checks are automatically performed based on the following fields :
- Title
- Description

Similarity is established based on an index 0.0 - 1.0 :
- 0.0 being least similar
- 1.0 being most similar.

By default this extension leverages a similarity index of 0.8.

This extension can be leveraged in combination with the [Find similar workitems](https://marketplace.visualstudio.com/items?itemName=tschmiedlechner.find-similar-workitems) extension to establish which work items are similar to the current item.
5 changes: 3 additions & 2 deletions src/block-duplicate-observer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import * as stringSimilarity from "string-similarity";
import * as striptags from "striptags";

class duplicateObserver {
_similarityIndex : number = 0.8;
_workItemFormService: IWorkItemFormService;
_locationService: ILocationService;
_projectService: IProjectPageService;
Expand Down Expand Up @@ -115,15 +116,15 @@ class duplicateObserver {
var title_similarity: number = stringSimilarity.compareTwoStrings(currentWorkItemTitle, workitem.fields['System.Title']);

// Lets compare title first
if (title_similarity >= 0.8) {
if (title_similarity >= this._similarityIndex) {
duplicate = true;
return false;
}
else {
// then compare the description
var description_similarity: number = stringSimilarity.compareTwoStrings(currentWorkItemDescription, striptags(workitem.fields['System.Description']));

if (description_similarity >= 0.8) {
if (description_similarity >= this._similarityIndex) {
duplicate = true;
return false;
}
Expand Down

0 comments on commit d70e537

Please sign in to comment.