Understanding Rework, New Work, and Maintenance

Key Scenarios Explained

First let us understand what does each of the metric mean:

Maintenance:

Maintenance is the lines of code modified that were written before the last 30 days. This is also synonymous with Refactor or Tech Debt.

Maintenance Percentage =
(lines of code modified that were written prior to 30 days) / (total lines of code
added or modified)
  • It is 30 days by default but is configurable in the settings page.

Rework:

Rework refers to the changes made to code that was initially written within the last 30 days. It provides insights into the stability and quality of recent code changes. This can usually happen due to developer fixing QA bugs or responding to PR review feedback.

Rework Percentage =
(lines of code modified that were written in the last 30 days) / (total lines of 
code added or modified)

sdfdsf

New Work:

It shows the total lines of code added or modified.

New Work Percentage =
(lines of code that were written in the specified duration) / (total lines of code 
added or modified)

Here are some scenarios to help you understand the differences between Rework, New Work, and Maintenance (for the examples we will consider "T" as today):

Scenario 1: 2 lines of code were removed and replaced by 5 lines

Before: T

let a = 10;
let b = a * 2;

After: T + 10

let a = 10;
let b = 0;
if (a > 0) 
    b = a * 2;
else 
    b = 1;

Rework : 2, since the lines were deleted/modified within 10 days

New Work : 5, since in total 5 lines were added to the code

Maintenance : 0

Scenario 2: 3 lines are added in before 1 line (the original 1 line is moved to last)

Before: T

let total = 100;

After: T + 60

let discount = 10;
let tax = 5;
let subtotal = 90;
let total = 100;

Rework : 0, since there are no modifications in the existing lines of code

Maintenance : 0, since there are no modifications in the existing lines of code

New Work : 3, these are fresh lines of code and no changes were made to the existing lines, it will only be considered in New Work and not Rework or Maintenance.

Scenario 3:

Case 1: Five lines of code were written 5 months ago and were modified today.

Case 2: Additional changes will be made to the same lines 10 days from now.

  • For the first case, since the original code was written 5 months ago, it will be considered as Maintenance.

  • For the second case, since it is an updated version of the code and changes were done >10 days ago, it will be considered as Rework.

Scenario 4: A whitespace was added to one line, and the code was indented on another line

Before: T

if(a > b){
    return a;
}

After: T + 80

if (a > b) {  // Added a whitespace between 'if' and the parenthesis
        return a;   // Indented this line by an extra tab
}

Rework : 0, whitespaces and indentations do not get considered as change

Maintenance : 0, whitespaces and indentations do not get considered as change

New Work : 0, since there were no additions to the lines

Scenario 5: I made some changes in .settings file, will those also be tracked in calculation?

  • For our processing and calculations, we automatically exclude files and directories that start or end with the following: .settings, dist, tmp, out-tsc, node_modules, bower_components, .idea, typings, .vscode, vendor/, coverage.

  • Additionally, if any files contain the following in their paths, they are also excluded: src, assets, images.

  • All of these options can be adjusted on the settings page, where you can also specify additional files to be excluded.

Scenario 6: 1 word from 1 line was deleted

Before: T

let greeting = "Hello, World!";

After: T + 20

let greeting = "Hello!";

Rework : 1, since modification was made to code within 20 days

New Work : 1, since any change other than a complete line deletion is considered an edit

Maintenance : 0

Scenario 7: 1 word from 1 line was deleted and replaced with another 1 word

Before: T

let greeting = "Hello, World!";

After: T + 60

let greeting = "Hello, Everyone!";

Rework : 0, since no modifications were made within Rework period

Maintenance : 1, since modifications were made to code post the Rework period of 30 days

New Work : 1, since each character replaced or added in any line of code is considered as New Work

Scenario 8: 2 words from 1 line were deleted and replaced by 1 word

Before: T

let status = "Task is pending";

After: T + 5

let status = "Pending";

Rework : 1

  • since modifications were made to the code within the Rework period of 30 days

  • the LoC changed is 1 since we only consider the lines of code where changes were made, not the number of characters

New Work : 1, since something was added to the line of code

Maintenance : 0

Scenario 9: 3 words were added towards the end of 1 existing line of code

Before: T

let message = "Hello";

After: T + 90

let message = "Hello, how are you";

Maintenance : 1

  • since modifications were made to the code post the Rework period

  • even though the code was added at the end, it is still part of a line of code and therefore will be considered as a change.

New Work : 1, since something was added to the line of code

Rework : 0

For more information or assistance, please contact our support team at support@hivel.ai.

Last updated