Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
manfredsteyer committed Sep 16, 2024
2 parents 19fbe52 + 1bae09c commit 671c2e7
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 1 deletion.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,21 @@ npm i @softarc/detective -D
npx detective
```

## Defining aliases

In case users have used multiple names, as appearing in the `git log`, use the `aliases` option in the file `.detective/config.json` created the first time detective runs:

```json
{
[...]
"aliases": {
"jdoe": "John Doe",
"janedoe": "Jane Doe"
}
[...]
}
```

## Defining Teams

For the Team Alignment Analysis, you need to map team names to the names of your team members as found in `git log`. This is done in the file `.detective/config.json` created the first time detective runs:
Expand Down
1 change: 1 addition & 0 deletions apps/backend/src/infrastructure/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const initConfig: Config = {
files: [],
logs: [],
},
aliases: {},
teams: {
'example-team-a': ['John Doe', 'Jane Doe'],
'example-team-b': ['Max Muster', 'Susi Sorglos'],
Expand Down
2 changes: 2 additions & 0 deletions apps/backend/src/model/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ export type Config = {
groups: string[];
filter: Filter;
teams: Record<string, string[]>;
aliases: Record<string, string>;
entries: [];
};

export const emptyConfig: Config = {
scopes: [],
groups: [],
teams: {},
aliases: {},
entries: [],
filter: {
logs: [],
Expand Down
2 changes: 2 additions & 0 deletions apps/backend/src/services/team-alignment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ export async function calcTeamAlignment(
}
}

userName = config.aliases?.[userName] || userName;

users.add(userName);

const key = calcKey(byUser, userName, userToTeam);
Expand Down
2 changes: 1 addition & 1 deletion apps/backend/src/utils/git-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export async function parseGitLog(
callback({ header, body });
body = [];
state = 'header';
} else if (!line.includes('\t')) {
} else if (line.split('\t').length < 3) {
header = parseHeader(line);
} else {
const bodyEntry = parseBodyEntry(line, renameMap);
Expand Down

0 comments on commit 671c2e7

Please sign in to comment.