fastruby / fastruby/skunk

RFC: Formula needs attention (churn * cost * penalty produces unexpected results)

Open
#41 1 comment 1 reaction 0 assignees View on GitHub
bug
Dominant language
Ruby
Stars
547
Forks
33
PR merge metrics
No merged PRs in 30d

Description

## Context

Initially the SkunkScore was calculated as churn * cost * penalty. This made sense based on the churn vs. complexity idea -> https://www.agileconnection.com/article/getting-empirical-about-refactoring

However, I quickly realized that this formula would not work when running `skunk -b master` -- more here: https://www.fastruby.io/blog/code-quality/escaping-the-tar-pit-at-rubyconf.html

So I decided to change the formula to be cost * penalty.

## Alternatives

I think a potential solution is to apply a modified weight to churn, so that the formula could look like this:

```
skunk_score = (magical_weight * churn) * cost * penalty_factor
```

That way, the formula could work both as a snapshot and as a comparison between two branches.

## Test

Testing this should show that removing complexity in a module, git committing, and then running `skunk -b master` produces a lower skunk score.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.