By default, Flow marks any commit with over 1000 lines of additions or edits as an outlier. With Advanced outlier detection, you can tailor your outlier commit settings to your organizational needs. To mark a single commit as an outlier, learn how to manually mark a commit as an outlier.
Provide permissions
To set up advanced outlier detection, you need the Manage configurations permission. To manually mark commits as outliers, you need the Manage commits permission.
Enable advanced outlier detection
To enable advanced outlier detection:
- In the top navigation, click Settings.
- In the left navigation, click Configurations under Report settings.
- Go to the Outliers tab.
- Click the toggle under Outlier detection mode.
Once this is enabled, you can configure up to three detection settings sections to set up your outlier rules.
- Impact: dictate which commits are marked as an outlier based on the raw Impact score or by a percentage range of all Impact scores of commits that Flow has processed for your organization.
- Size: dictate which commits are marked as an outlier based on the total lines of code of the commit. Here you can also ignore whitespace or lines with a certain number of characters.
- Regular Expressions: dictate which commits are marked as an outlier using regular expressions.
Impact
You can determine which commits are outliers by setting filters for Impact scores.
- Ignore commits by percentage. This option excludes processed commits in the top percentage of commits by Impact. The numbers that you enter in the boxes for this option are percentages, not a number of commits. These percentages are configurable. You must use a percentage greater than zero.
- Ignore commits by Impact. This option excludes commits above and below certain Impacts. These Impact thresholds are configurable.
Tip: To get an idea for what raw Impact values are for your team, review the Team health insights report, and base your outlier Impact score off of your team’s data. You must use a percentage greater than 0.
Size
You can determine which commits are outliers by the size of the commit.
Flow looks at the number of lines added or edited, not the number of lines deleted, when choosing whether to mark a commit as an outlier due to size. If a commit contains added, edited, or deleted lines, only the number of added or edited lines is used for Advanced size settings.
- Set the minimum number of edited or added lines for Flow to count the commit. Any commit with fewer lines edited or added than the threshold you set is excluded. This threshold is configurable.
- Ignore whitespaces to exclude any lines with no characters in the calculation.
- Ignore lines with fewer than a set number of non-whitespace characters in the calculation. This threshold is configurable.
- Set the maximum number of lines edited or added in a commit for a commit to be included. Any commit with more lines of code edited or added than this is excluded. This threshold is configurable.
Regular expression
You can determine which commits are outliers by using regular expressions to match either the user associated with the commit or the commit message itself. Create as many rules here as you need.
To create a rule:
- Toggle Enable.
- Click Create Rule.
- Type in your regular expression and choose whether to Match on user, Match on message, or both.
Testing regular expressions
If you have commits that you know should be marked as outliers and should be included within your regular expression, test your regular expression to determine which commits it includes. Click Test a regular expression.
In the resulting modal, input:
- Your regular expression.
- Commit SHA(s) to test against specific commits. You can put in the entire SHA number or just the first six characters.
- Indicate whether you want to Match on user, Match on message, or both. Matches will be considered outliers based on your regular expression. Does Not Match will remain a regular commit within your reports.
Click Load commits and show matches to see a list of commits and whether they match your regular expression.
If you don't have any commits you want to test your regular expression with, leave Commits to test blank to load your 100 most recent commits.
Once your regular expression returns the commits you expect, exit the modal to create the rule.
Finishing up
Turning off your Advanced outlier detection settings will return your organization to the default outlier settings of any commit larger than 1000 lines being an outlier.
Turning off your outlier settings also returns any manually marked commit to its original state.
Below are a few use cases and the necessary settings to implement them in your own account.
- Default outlier detection of commits with more than 1000 lines and manually marked commits:
- Enable outlier detection mode.
- Enable advanced size settings and set the absolute minimum edit size to zero, and the maximum size to 1000. Leave all other boxes unchecked.
- No automatic filters but the ability to manually mark commits as outliers:
- Enable outlier detection mode.
- Leave Impact, size and regular expression settings toggled off.