Repository: obsidian-tasks-group/obsidian-tasks
Pull request #2612 (2024-01-23 23:05:27)

refactor: Reduce cyclic dependencies in src/
<!--- Provide a general summary of your changes in the Title above -->

# Description

Reduce cyclic dependencies between source files, by:

- Moving `Priority` and `TaskRegularExpressions` out of `Task.ts`
- Moving `getPrintableSymbol()` from `StatusRegistryReport.ts` to `StatusSettingsReport.ts`

I decided to version control `circular-deps.txt` for a while, to keep an eye on any growth of cyclic dependencies. It does have the annoyance that it contains a flickering time measurement, but I'm assuming it's likely only me and @ilandikov who might run it, and we can try and revert any changes if the only difference is from running the tool and getting a differing timing.

The file can be updated with:

```bash
yarn run circular-deps-text
```

And see the similar

```bash
yarn run circular-deps-image
```

## Motivation and Context

It's kind of a constant process of trying to simplify code by reducing these dependencies. See #1402 for an earlier attempt.

## How has this been tested?

<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, tests ran to see how -->
<!--- your change affects other areas of the code, etc. -->

## Screenshots (if appropriate)

Before and after:

![image](https://github.com/obsidian-tasks-group/obsidian-tasks/assets/4840096/147ede52-4f1b-4b28-995e-9570afc48545)


## Types of changes

<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->

Internal changes:

- [x] **Refactor** (prefix: `refactor` - non-breaking change which only improves the design or structure of existing code, and making no changes to its external behaviour)

## Checklist

<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->

- [x] My code follows the code style of this project and passes `yarn run lint`.
- [ ] My change requires a change to the documentation.
- [ ] I have [updated the documentation](https://publish.obsidian.md/tasks-contributing/Documentation/About+Documentation) accordingly.
- [x] My change has adequate [Unit Test coverage](https://publish.obsidian.md/tasks-contributing/Testing/About+Testing).

## Terms

<!--
By submitting this pull request, you must agree to follow our
[contributing guide](https://publish.obsidian.md/tasks-contributing) and
[Code of Conduct](https://github.com/obsidian-tasks-group/obsidian-tasks/blob/main/CODE_OF_CONDUCT.md).
Put an x in the boxes to confirm you agree.
-->

- [x] My contribution follow this project's [contributing guide](https://publish.obsidian.md/tasks-contributing)
- [x] I agree to follow this project's [Code of Conduct](https://github.com/obsidian-tasks-group/obsidian-tasks/blob/main/CODE_OF_CONDUCT.md)



Patch:
diff --git a/.gitignore b/.gitignore
index 2259ca80..029b6147 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,7 +21,7 @@ yarn-error.log
 
 # Code analysis output files
 /circular-deps.png
-/circular-deps.txt
+#/circular-deps.txt
 
 # approval test files
 *.received.*
diff --git a/circular-deps.txt b/circular-deps.txt
new file mode 100644
index 00000000..8c71429d
--- /dev/null
+++ b/circular-deps.txt
@@ -0,0 +1,15 @@
+Processed 152 files (995ms) (16 warnings)
+
+1) Config/Settings.ts > Suggestor/Suggestor.ts
+2) Task/Task.ts > Config/Settings.ts > Suggestor/Suggestor.ts
+3) Task/Task.ts > Config/Settings.ts > Suggestor/Suggestor.ts > TaskSerializer/DefaultTaskSerializer.ts
+4) Task/Task.ts > Config/Settings.ts > TaskSerializer/DataviewTaskSerializer.ts
+5) Task/Task.ts > Task/DateFallback.ts
+6) Task/Task.ts > Task/Urgency.ts
+7) Task/Task.ts > lib/LogTasksHelper.ts
+8) Query/Query.ts > Query/Explain/Explainer.ts
+9) Query/FilterParser.ts > Query/Filter/BooleanField.ts
+10) main.ts > Config/SettingsTab.ts
+11) Obsidian/Cache.ts > Obsidian/TasksEvents.ts
+12) main.ts > Renderer/QueryRenderer.ts
+
diff --git a/src/Commands/CreateOrEditTaskParser.ts b/src/Commands/CreateOrEditTaskParser.ts
index 3d74076b..7f746ae2 100644
--- a/src/Commands/CreateOrEditTaskParser.ts
+++ b/src/Commands/CreateOrEditTaskParser.ts
@@ -1,10 +1,12 @@
 import { Status } from '../Statuses/Status';
-import { Priority, Task, TaskRegularExpressions } from '../Task/Task';
+import { Task } from '../Task/Task';
 import { DateFallback } from '../Task/DateFallback';
 import { StatusRegistry } from '../Statuses/StatusRegistry';
 import { TaskLocation } from '../Task/TaskLocation';
 import { getSettings } from '../Config/Settings';
 import { GlobalFilter } from '../Config/GlobalFilter';
+import { Priority } from '../Task/Priority';
+import { TaskRegularExpressions } from '../Task/TaskRegularExpressions';
 
 function getDefaultCreatedDate() {
     const { setCreatedDate } = getSettings();
diff --git a/src/Commands/ToggleDone.ts b/src/Commands/ToggleDone.ts
index 93d0a3c7..d4502a25 100644
--- a/src/Commands/ToggleDone.ts
+++ b/src/Commands/ToggleDone.ts
@@ -1,8 +1,9 @@
 import { Editor, type EditorPosition, type MarkdownFileInfo, MarkdownView } from 'obsidian';
 import { StatusRegistry } from '../Statuses/StatusRegistry';
 
-import { Task, TaskRegularExpressions } from '../Task/Task';
+import { Task } from '../Task/Task';
 import { TaskLocation } from '../Task/TaskLocation';
+import { TaskRegularExpressions } from '../Task/TaskRegularExpressions';
 
 export const toggleDone = (checking: boolean, editor: Editor, view: MarkdownView | MarkdownFileInfo) => {
     if (checking) {
diff --git a/src/Query/Filter/PriorityField.ts b/src/Query/Filter/PriorityField.ts
index 57a22eec..492f7dad 100644
--- a/src/Query/Filter/PriorityField.ts
+++ b/src/Query/Filter/PriorityField.ts
@@ -1,7 +1,8 @@
-import { Priority, Task } from '../../Task/Task';
+import type { Task } from '../../Task/Task';
 import { Explanation } from '../Explain/Explanation';
 import type { Comparator } from '../Sort/Sorter';
 import type { GrouperFunction } from '../Group/Grouper';
+import { Priority } from '../../Task/Priority';
 import { Field } from './Field';
 import { Filter } from './Filter';
 import { FilterOrErrorMessage } from './FilterOrErrorMessage';
diff --git a/src/Renderer/TaskLineRenderer.ts b/src/Renderer/TaskLineRenderer.ts
index 84b02f9c..48c51a15 100644
--- a/src/Renderer/TaskLineRenderer.ts
+++ b/src/Renderer/TaskLineRenderer.ts
@@ -6,9 +6,9 @@ import { replaceTaskWithTasks } from '../Obsidian/File';
 import type { TaskLayoutComponent, TaskLayoutOptions } from '../Layout/TaskLayoutOptions';
 import type { QueryLayoutOptions } from '../Layout/QueryLayoutOptions';
 import type { Task } from '../Task/Task';
-import * as taskModule from '../Task/Task';
 import { StatusMenu } from '../ui/Menus/StatusMenu';
 import { StatusRegistry } from '../Statuses/StatusRegistry';
+import { TaskRegularExpressions } from '../Task/TaskRegularExpressions';
 import { TaskFieldRenderer } from './TaskFieldRenderer';
 
 /**
@@ -309,7 +309,7 @@ export class TaskLineRenderer {
             }
 
             function toTooltipDate({ signifier, date }: { signifier: string; date: Moment }): string {
-                return `${signifier} ${date.format(taskModule.TaskRegularExpressions.dateFormat)} (${date.from(
+                return `${signifier} ${date.format(TaskRegularExpressions.dateFormat)} (${date.from(
                     window.moment().startOf('day'),
                 )})`;
             }
diff --git a/src/Scripting/TasksDate.ts b/src/Scripting/TasksDate.ts
index ef8871ef..ef6cd580 100644
--- a/src/Scripting/TasksDate.ts
+++ b/src/Scripting/TasksDate.ts
@@ -1,7 +1,7 @@
 import type { DurationInputArg2, Moment, unitOfTime } from 'moment';
 import { Notice } from 'obsidian';
-import { TaskRegularExpressions } from '../Task/Task';
 import { PropertyCategory } from '../lib/PropertyCategory';
+import { TaskRegularExpressions } from '../Task/TaskRegularExpressions';
 
 /**
  * TasksDate encapsulates a date, for simplifying the JavaScript expressions users need to
diff --git a/src/Statuses/StatusRegistryReport.ts b/src/Statuses/StatusRegistryReport.ts
index d60c4e5c..e40b25e4 100644
--- a/src/Statuses/StatusRegistryReport.ts
+++ b/src/Statuses/StatusRegistryReport.ts
@@ -47,14 +47,3 @@ ${settingsTable}
 These are the settings actually used by Tasks.
 ${mermaidText}`;
 }
-
-export function getPrintableSymbol(symbol: string) {
-    // Do not put backticks around an empty symbol, as the two backticks are rendered
-    // by Obsidian as ordinary characters and the meaning is unclear.
-    // Better to just display nothing in this situation.
-    if (symbol === '') {
-        return symbol;
-    }
-    const result = symbol !== ' ' ? symbol : 'space';
-    return '`' + result + '`';
-}
diff --git a/src/Statuses/StatusSettingsReport.ts b/src/Statuses/StatusSettingsReport.ts
index b614927e..ad93f834 100644
--- a/src/Statuses/StatusSettingsReport.ts
+++ b/src/Statuses/StatusSettingsReport.ts
@@ -1,14 +1,24 @@
 import { StatusSettings } from '../Config/StatusSettings';
 import { MarkdownTable } from '../lib/MarkdownTable';
 import type { StatusConfiguration } from './StatusConfiguration';
-import { getPrintableSymbol } from './StatusRegistryReport';
-import { Status } from './Status';
 import { StatusType } from './StatusConfiguration';
+import { Status } from './Status';
 
 function getFirstIndex(statusConfigurations: StatusConfiguration[], wantedSymbol: string) {
     return statusConfigurations.findIndex((s) => s.symbol === wantedSymbol);
 }
 
+export function getPrintableSymbol(symbol: string) {
+    // Do not put backticks around an empty symbol, as the two backticks are rendered
+    // by Obsidian as ordinary characters and the meaning is unclear.
+    // Better to just display nothing in this situation.
+    if (symbol === '') {
+        return symbol;
+    }
+    const result = symbol !== ' ' ? symbol : 'space';
+    return '`' + result + '`';
+}
+
 function checkIfConventionalType(status: StatusConfiguration, problems: string[]) {
     // Check if conventional type is being used:
     const conventionalType = Status.getTypeForUnknownSymbol(status.symbol);
diff --git a/src/Suggestor/Suggestor.ts b/src/Suggestor/Suggestor.ts
index fb0b3a96..25cce472 100644
--- a/src/Suggestor/Suggestor.ts
+++ b/src/Suggestor/Suggestor.ts
@@ -3,8 +3,9 @@ import { DateParser } from '../Query/DateParser';
 import { doAutocomplete } from '../lib/DateAbbreviations';
 import { Recurrence } from '../Task/Recurrence';
 import type { DefaultTaskSerializerSymbols } from '../TaskSerializer/DefaultTaskSerializer';
-import { Task, TaskRegularExpressions } from '../Task/Task';
+import { Task } from '../Task/Task';
 import { GlobalFilter } from '../Config/GlobalFilter';
+import { TaskRegularExpressions } from '../Task/TaskRegularExpressions';
 import type { SuggestInfo, SuggestionBuilder } from '.';
 
 /**
diff --git a/src/Task/Priority.ts b/src/Task/Priority.ts
new file mode 100644
index 00000000..e5e9ad99
--- /dev/null
+++ b/src/Task/Priority.ts
@@ -0,0 +1,19 @@
+/**
+ * When sorting, make sure low always comes after none. This way any tasks with low will be below any exiting
+ * tasks that have no priority which would be the default.
+ *
+ * Values can be converted to strings with:
+ * - {@link priorityNameUsingNone} in {@link PriorityTools}
+ * - {@link priorityNameUsingNormal} in {@link PriorityTools}
+ *
+ * @export
+ * @enum {number}
+ */
+export enum Priority {
+    Highest = '0',
+    High = '1',
+    Medium = '2',
+    None = '3',
+    Low = '4',
+    Lowest = '5',
+}
diff --git a/src/Task/Task.ts b/src/Task/Task.ts
index 3ccb2b4b..920583e3 100644
--- a/src/Task/Task.ts
+++ b/src/Task/Task.ts
@@ -14,90 +14,8 @@ import { DateFallback } from './DateFallback';
 import { Urgency } from './Urgency';
 import type { Recurrence } from './Recurrence';
 import type { TaskLocation } from './TaskLocation';
-
-/**
- * When sorting, make sure low always comes after none. This way any tasks with low will be below any exiting
- * tasks that have no priority which would be the default.
- *
- * Values can be converted to strings with:
- * - {@link priorityNameUsingNone} in {@link PriorityTools}
- * - {@link priorityNameUsingNormal} in {@link PriorityTools}
- *
- * @export
- * @enum {number}
- */
-export enum Priority {
-    Highest = '0',
-    High = '1',
-    Medium = '2',
-    None = '3',
-    Low = '4',
-    Lowest = '5',
-}
-
-export class TaskRegularExpressions {
-    public static readonly dateFormat = 'YYYY-MM-DD';
-    public static readonly dateTimeFormat = 'YYYY-MM-DD HH:mm';
-
-    // Matches indentation before a list marker (including > for potentially nested blockquotes or Obsidian callouts)
-    public static readonly indentationRegex = /^([\s\t>]*)/;
-
-    // Matches - * and + list markers, or numbered list markers (eg 1.)
-    public static readonly listMarkerRegex = /([-*+]|[0-9]+\.)/;
-
-    // Matches a checkbox and saves the status character inside
-    public static readonly checkboxRegex = /\[(.)\]/u;
-
-    // Matches the rest of the task after the checkbox.
-    public static readonly afterCheckboxRegex = / *(.*)/u;
-
-    // Main regex for parsing a line. It matches the following:
-    // - Indentation
-    // - List marker
-    // - Status character
-    // - Rest of task after checkbox markdown
-    // See Task.extractTaskComponents() for abstraction around this regular expression.
-    // That is private for now, but could be made public in future if needed.
-    public static readonly taskRegex = new RegExp(
-        TaskRegularExpressions.indentationRegex.source +
-            TaskRegularExpressions.listMarkerRegex.source +
-            ' +' +
-            TaskRegularExpressions.checkboxRegex.source +
-            TaskRegularExpressions.afterCheckboxRegex.source,
-        'u',
-    );
-
-    // Used with the "Create or Edit Task" command to parse indentation and status if present
-    public static readonly nonTaskRegex = new RegExp(
-        TaskRegularExpressions.indentationRegex.source +
-            TaskRegularExpressions.listMarkerRegex.source +
-            '? *(' +
-            TaskRegularExpressions.checkboxRegex.source +
-            ')?' +
-            TaskRegularExpressions.afterCheckboxRegex.source,
-        'u',
-    );
-
-    // Used with "Toggle Done" command to detect a list item that can get a checkbox added to it.
-    public static readonly listItemRegex = new RegExp(
-        TaskRegularExpressions.indentationRegex.source + TaskRegularExpressions.listMarkerRegex.source,
-    );
-
-    // Match on block link at end.
-    public static readonly blockLinkRegex = / \^[a-zA-Z0-9-]+$/u;
-
-    // Regex to match all hash tags, basically hash followed by anything but the characters in the negation.
-    // To ensure URLs are not caught it is looking of beginning of string tag and any
-    // tag that has a space in front of it. Any # that has a character in front
-    // of it will be ignored.
-    // EXAMPLE:
-    // description: '#dog #car http://www/ddd#ere #house'
-    // matches: #dog, #car, #house
-    // MAINTENANCE NOTE:
-    //  If hashTags is modified, please update 'Recognising Tags' in Tags.md in the docs.
-    public static readonly hashTags = /(^|\s)#[^ !@#$%^&*(),.?":{}|<>]+/g;
-    public static readonly hashTagsFromEnd = new RegExp(this.hashTags.source + '$');
-}
+import type { Priority } from './Priority';
+import { TaskRegularExpressions } from './TaskRegularExpressions';
 
 /**
  * Storage for the task line, broken down in to sections.
diff --git a/src/Task/TaskRegularExpressions.ts b/src/Task/TaskRegularExpressions.ts
new file mode 100644
index 00000000..1763e34d
--- /dev/null
+++ b/src/Task/TaskRegularExpressions.ts
@@ -0,0 +1,63 @@
+export class TaskRegularExpressions {
+    public static readonly dateFormat = 'YYYY-MM-DD';
+    public static readonly dateTimeFormat = 'YYYY-MM-DD HH:mm';
+
+    // Matches indentation before a list marker (including > for potentially nested blockquotes or Obsidian callouts)
+    public static readonly indentationRegex = /^([\s\t>]*)/;
+
+    // Matches - * and + list markers, or numbered list markers (eg 1.)
+    public static readonly listMarkerRegex = /([-*+]|[0-9]+\.)/;
+
+    // Matches a checkbox and saves the status character inside
+    public static readonly checkboxRegex = /\[(.)\]/u;
+
+    // Matches the rest of the task after the checkbox.
+    public static readonly afterCheckboxRegex = / *(.*)/u;
+
+    // Main regex for parsing a line. It matches the following:
+    // - Indentation
+    // - List marker
+    // - Status character
+    // - Rest of task after checkbox markdown
+    // See Task.extractTaskComponents() for abstraction around this regular expression.
+    // That is private for now, but could be made public in future if needed.
+    public static readonly taskRegex = new RegExp(
+        TaskRegularExpressions.indentationRegex.source +
+            TaskRegularExpressions.listMarkerRegex.source +
+            ' +' +
+            TaskRegularExpressions.checkboxRegex.source +
+            TaskRegularExpressions.afterCheckboxRegex.source,
+        'u',
+    );
+
+    // Used with the "Create or Edit Task" command to parse indentation and status if present
+    public static readonly nonTaskRegex = new RegExp(
+        TaskRegularExpressions.indentationRegex.source +
+            TaskRegularExpressions.listMarkerRegex.source +
+            '? *(' +
+            TaskRegularExpressions.checkboxRegex.source +
+            ')?' +
+            TaskRegularExpressions.afterCheckboxRegex.source,
+        'u',
+    );
+
+    // Used with "Toggle Done" command to detect a list item that can get a checkbox added to it.
+    public static readonly listItemRegex = new RegExp(
+        TaskRegularExpressions.indentationRegex.source + TaskRegularExpressions.listMarkerRegex.source,
+    );
+
+    // Match on block link at end.
+    public static readonly blockLinkRegex = / \^[a-zA-Z0-9-]+$/u;
+
+    // Regex to match all hash tags, basically hash followed by anything but the characters in the negation.
+    // To ensure URLs are not caught it is looking of beginning of string tag and any
+    // tag that has a space in front of it. Any # that has a character in front
+    // of it will be ignored.
+    // EXAMPLE:
+    // description: '#dog #car http://www/ddd#ere #house'
+    // matches: #dog, #car, #house
+    // MAINTENANCE NOTE:
+    //  If hashTags is modified, please update 'Recognising Tags' in Tags.md in the docs.
+    public static readonly hashTags = /(^|\s)#[^ !@#$%^&*(),.?":{}|<>]+/g;
+    public static readonly hashTagsFromEnd = new RegExp(this.hashTags.source + '$');
+}
diff --git a/src/TaskSerializer/DataviewTaskSerializer.ts b/src/TaskSerializer/DataviewTaskSerializer.ts
index a11dfe49..d3be4b34 100644
--- a/src/TaskSerializer/DataviewTaskSerializer.ts
+++ b/src/TaskSerializer/DataviewTaskSerializer.ts
@@ -1,6 +1,6 @@
 import type { TaskLayoutComponent } from '../Layout/TaskLayoutOptions';
 import type { Task } from '../Task/Task';
-import { Priority } from '../Task/Task';
+import { Priority } from '../Task/Priority';
 import { DefaultTaskSerializer } from './DefaultTaskSerializer';
 
 /**
diff --git a/src/TaskSerializer/DefaultTaskSerializer.ts b/src/TaskSerializer/DefaultTaskSerializer.ts
index c67457c7..85b4ca7a 100644
--- a/src/TaskSerializer/DefaultTaskSerializer.ts
+++ b/src/TaskSerializer/DefaultTaskSerializer.ts
@@ -1,7 +1,9 @@
 import type { Moment } from 'moment';
 import { type TaskLayoutComponent, TaskLayoutOptions } from '../Layout/TaskLayoutOptions';
 import { Recurrence } from '../Task/Recurrence';
-import { Priority, Task, TaskRegularExpressions } from '../Task/Task';
+import { Task } from '../Task/Task';
+import { Priority } from '../Task/Priority';
+import { TaskRegularExpressions } from '../Task/TaskRegularExpressions';
 import type { TaskDetails, TaskSerializer } from '.';
 
 /* Interface describing the symbols that {@link DefaultTaskSerializer}
diff --git a/src/lib/PriorityTools.ts b/src/lib/PriorityTools.ts
index 290161fd..7e0ed47b 100644
--- a/src/lib/PriorityTools.ts
+++ b/src/lib/PriorityTools.ts
@@ -1,4 +1,4 @@
-import { Priority } from '../Task/Task';
+import { Priority } from '../Task/Priority';
 
 export class PriorityTools {
     /**
diff --git a/src/ui/EditInstructions/PriorityInstructions.ts b/src/ui/EditInstructions/PriorityInstructions.ts
index e02efba6..f2ba71c1 100644
--- a/src/ui/EditInstructions/PriorityInstructions.ts
+++ b/src/ui/EditInstructions/PriorityInstructions.ts
@@ -1,5 +1,6 @@
-import { Priority, Task } from '../../Task/Task';
+import { Task } from '../../Task/Task';
 import { PriorityTools } from '../../lib/PriorityTools';
+import { Priority } from '../../Task/Priority';
 import type { TaskEditingInstruction } from './TaskEditingInstruction';
 
 /**
diff --git a/src/ui/EditTask.svelte b/src/ui/EditTask.svelte
index f867169c..240b99f8 100644
--- a/src/ui/EditTask.svelte
+++ b/src/ui/EditTask.svelte
@@ -5,13 +5,14 @@
     import { getSettings, TASK_FORMATS } from '../Config/Settings';
     import { GlobalFilter } from '../Config/GlobalFilter';
     import { Status } from '../Statuses/Status';
-    import { Priority, Task } from '../Task/Task';
+    import { Task } from '../Task/Task';
     import { doAutocomplete } from '../lib/DateAbbreviations';
     import { TasksDate } from '../Scripting/TasksDate';
     import { addDependencyToParent, ensureTaskHasId, generateUniqueId, removeDependency } from "../Task/TaskDependency";
     import { replaceTaskWithTasks } from "../Obsidian/File";
     import type { EditableTask } from "./EditableTask";
     import Dependency from "./Dependency.svelte";
+    import { Priority } from '../Task/Priority';
 
     // These exported variables are passed in as props by TaskModal.onOpen():
     export let task: Task;


Test patch:
diff --git a/tests/Commands/CreateOrEditTaskParser.test.ts b/tests/Commands/CreateOrEditTaskParser.test.ts
index e6f821ef..b24fede8 100644
--- a/tests/Commands/CreateOrEditTaskParser.test.ts
+++ b/tests/Commands/CreateOrEditTaskParser.test.ts
@@ -3,9 +3,9 @@
  */
 import moment from 'moment';
 import { resetSettings, updateSettings } from '../../src/Config/Settings';
-import { Priority } from '../../src/Task/Task';
 import { taskFromLine } from '../../src/Commands/CreateOrEditTaskParser';
 import { GlobalFilter } from '../../src/Config/GlobalFilter';
+import { Priority } from '../../src/Task/Priority';
 
 window.moment = moment;
 
diff --git a/tests/CustomMatchers/CustomMatchersForTaskSerializer.ts b/tests/CustomMatchers/CustomMatchersForTaskSerializer.ts
index ae35b84b..ec322e5b 100644
--- a/tests/CustomMatchers/CustomMatchersForTaskSerializer.ts
+++ b/tests/CustomMatchers/CustomMatchersForTaskSerializer.ts
@@ -2,8 +2,9 @@ import { diff } from 'jest-diff';
 import type { MatcherFunction } from 'expect';
 import moment from 'moment';
 import type { TaskDetails } from '../../src/TaskSerializer';
-import { Priority, TaskRegularExpressions } from '../../src/Task/Task';
 import { Recurrence } from '../../src/Task/Recurrence';
+import { Priority } from '../../src/Task/Priority';
+import { TaskRegularExpressions } from '../../src/Task/TaskRegularExpressions';
 
 declare global {
     namespace jest {
diff --git a/tests/DocumentationSamples/UrgencyDocs/DocsSamplesForUrgency.test.ts b/tests/DocumentationSamples/UrgencyDocs/DocsSamplesForUrgency.test.ts
index 7dca1349..03325edc 100644
--- a/tests/DocumentationSamples/UrgencyDocs/DocsSamplesForUrgency.test.ts
+++ b/tests/DocumentationSamples/UrgencyDocs/DocsSamplesForUrgency.test.ts
@@ -7,7 +7,8 @@ import moment from 'moment';
 import { verifyMarkdownForDocs } from '../../TestingTools/VerifyMarkdown';
 import { TaskBuilder } from '../../TestingTools/TaskBuilder';
 import { Urgency } from '../../../src/Task/Urgency';
-import { Priority } from '../../../src/Task/Task';
+
+import { Priority } from '../../../src/Task/Priority';
 
 window.moment = moment;
 
diff --git a/tests/Query/DateParser.test.ts b/tests/Query/DateParser.test.ts
index f4871da6..fb693846 100644
--- a/tests/Query/DateParser.test.ts
+++ b/tests/Query/DateParser.test.ts
@@ -3,7 +3,8 @@
  */
 import moment from 'moment';
 import { DateParser } from '../../src/Query/DateParser';
-import { TaskRegularExpressions } from '../../src/Task/Task';
+
+import { TaskRegularExpressions } from '../../src/Task/TaskRegularExpressions';
 
 window.moment = moment;
 
diff --git a/tests/Query/Filter/FunctionField.test.ts b/tests/Query/Filter/FunctionField.test.ts
index 22507d85..91ed1fe0 100644
--- a/tests/Query/Filter/FunctionField.test.ts
+++ b/tests/Query/Filter/FunctionField.test.ts
@@ -6,7 +6,6 @@ import moment from 'moment';
 import { FunctionField } from '../../../src/Query/Filter/FunctionField';
 import { Status } from '../../../src/Statuses/Status';
 import type { Task } from '../../../src/Task/Task';
-import { Priority } from '../../../src/Task/Task';
 import {
     toGroupTaskFromBuilder,
     toGroupTaskUsingSearchInfo,
@@ -22,6 +21,7 @@ import {
 import { fromLine } from '../../TestingTools/TestHelpers';
 import { Query } from '../../../src/Query/Query';
 import { TasksDate } from '../../../src/Scripting/TasksDate';
+import { Priority } from '../../../src/Task/Priority';
 
 window.moment = moment;
 
diff --git a/tests/Query/Filter/PriorityField.test.ts b/tests/Query/Filter/PriorityField.test.ts
index 106506e5..5bee8f7e 100644
--- a/tests/Query/Filter/PriorityField.test.ts
+++ b/tests/Query/Filter/PriorityField.test.ts
@@ -1,4 +1,3 @@
-import { Priority } from '../../../src/Task/Task';
 import { TaskBuilder } from '../../TestingTools/TaskBuilder';
 import { testFilter } from '../../TestingTools/FilterTestHelpers';
 import { PriorityField } from '../../../src/Query/Filter/PriorityField';
@@ -9,6 +8,7 @@ import {
     expectTaskComparesBefore,
     expectTaskComparesEqual,
 } from '../../CustomMatchers/CustomMatchersForSorting';
+import { Priority } from '../../../src/Task/Priority';
 
 function testTaskFilterForTaskWithPriority(filter: string, priority: Priority, expected: boolean) {
     const builder = new TaskBuilder();
diff --git a/tests/Query/Filter/UrgencyField.test.ts b/tests/Query/Filter/UrgencyField.test.ts
index a28b0c39..d3931fe2 100644
--- a/tests/Query/Filter/UrgencyField.test.ts
+++ b/tests/Query/Filter/UrgencyField.test.ts
@@ -2,7 +2,6 @@
  * @jest-environment jsdom
  */
 import moment from 'moment';
-import { Priority } from '../../../src/Task/Task';
 import { TaskBuilder } from '../../TestingTools/TaskBuilder';
 import { UrgencyField } from '../../../src/Query/Filter/UrgencyField';
 
@@ -12,6 +11,7 @@ import {
     expectTaskComparesEqual,
 } from '../../CustomMatchers/CustomMatchersForSorting';
 import { fromLine } from '../../TestingTools/TestHelpers';
+import { Priority } from '../../../src/Task/Priority';
 
 window.moment = moment;
 
diff --git a/tests/Query/Query.test.ts b/tests/Query/Query.test.ts
index 6d803fbd..84cefa4a 100644
--- a/tests/Query/Query.test.ts
+++ b/tests/Query/Query.test.ts
@@ -4,7 +4,7 @@
 import moment from 'moment';
 import { Query } from '../../src/Query/Query';
 import { Status } from '../../src/Statuses/Status';
-import { Priority, Task } from '../../src/Task/Task';
+import { Task } from '../../src/Task/Task';
 import { TaskLocation } from '../../src/Task/TaskLocation';
 import { fieldCreators } from '../../src/Query/FilterParser';
 import type { Field } from '../../src/Query/Filter/Field';
@@ -18,6 +18,7 @@ import { createTasksFromMarkdown, fromLine } from '../TestingTools/TestHelpers';
 import type { FilteringCase } from '../TestingTools/FilterTestHelpers';
 import { shouldSupportFiltering } from '../TestingTools/FilterTestHelpers';
 import { TaskBuilder } from '../TestingTools/TaskBuilder';
+import { Priority } from '../../src/Task/Priority';
 
 window.moment = moment;
 
diff --git a/tests/Renderer/TaskLineRenderer.test.ts b/tests/Renderer/TaskLineRenderer.test.ts
index 6e284be2..30180696 100644
--- a/tests/Renderer/TaskLineRenderer.test.ts
+++ b/tests/Renderer/TaskLineRenderer.test.ts
@@ -9,12 +9,12 @@ import { type TaskLayoutComponent, TaskLayoutOptions, taskLayoutComponents } fro
 import { DateParser } from '../../src/Query/DateParser';
 import { QueryLayoutOptions } from '../../src/Layout/QueryLayoutOptions';
 import type { Task } from '../../src/Task/Task';
-import { TaskRegularExpressions } from '../../src/Task/Task';
 import type { TextRenderer } from '../../src/Renderer/TaskLineRenderer';
 import { TaskLineRenderer } from '../../src/Renderer/TaskLineRenderer';
 import { fromLine } from '../TestingTools/TestHelpers';
 import { verifyWithFileExtension } from '../TestingTools/ApprovalTestHelpers';
 import { TaskBuilder } from '../TestingTools/TaskBuilder';
+import { TaskRegularExpressions } from '../../src/Task/TaskRegularExpressions';
 
 jest.mock('obsidian');
 window.moment = moment;
diff --git a/tests/Scripting/ScriptingTestHelpers.ts b/tests/Scripting/ScriptingTestHelpers.ts
index aa71b75e..87d41b63 100644
--- a/tests/Scripting/ScriptingTestHelpers.ts
+++ b/tests/Scripting/ScriptingTestHelpers.ts
@@ -1,6 +1,6 @@
 import moment from 'moment';
-import { TaskRegularExpressions } from '../../src/Task/Task';
 import { TasksDate } from '../../src/Scripting/TasksDate';
+import { TaskRegularExpressions } from '../../src/Task/TaskRegularExpressions';
 
 export function formatToRepresentType(x: any): string {
     if (typeof x === 'string') {
diff --git a/tests/Task/Task.test.ts b/tests/Task/Task.test.ts
index aff2eeb1..7eab6c49 100644
--- a/tests/Task/Task.test.ts
+++ b/tests/Task/Task.test.ts
@@ -3,7 +3,7 @@
  */
 import moment from 'moment';
 import { Status } from '../../src/Statuses/Status';
-import { Priority, Task } from '../../src/Task/Task';
+import { Task } from '../../src/Task/Task';
 import { resetSettings, updateSettings } from '../../src/Config/Settings';
 import { GlobalFilter } from '../../src/Config/GlobalFilter';
 import type { StatusCollection } from '../../src/Statuses/StatusCollection';
@@ -13,6 +13,7 @@ import { StatusConfiguration, StatusType } from '../../src/Statuses/StatusConfig
 import { fromLine } from '../TestingTools/TestHelpers';
 import { TaskBuilder } from '../TestingTools/TaskBuilder';
 import { RecurrenceBuilder } from '../TestingTools/RecurrenceBuilder';
+import { Priority } from '../../src/Task/Priority';
 
 window.moment = moment;
 
diff --git a/tests/Task/Urgency.test.ts b/tests/Task/Urgency.test.ts
index 45f520d7..6946ce34 100644
--- a/tests/Task/Urgency.test.ts
+++ b/tests/Task/Urgency.test.ts
@@ -5,9 +5,9 @@
 import moment from 'moment';
 import { TaskBuilder } from '../TestingTools/TaskBuilder';
 import { Urgency } from '../../src/Task/Urgency';
-import { Priority } from '../../src/Task/Task';
 import { calculateRelativeDate } from '../TestingTools/DateTestHelpers';
 import { fromLine } from '../TestingTools/TestHelpers';
+import { Priority } from '../../src/Task/Priority';
 
 window.moment = moment;
 
diff --git a/tests/TaskSerializer/DataviewTaskSerializer.test.ts b/tests/TaskSerializer/DataviewTaskSerializer.test.ts
index 6eb4ee8b..71155185 100644
--- a/tests/TaskSerializer/DataviewTaskSerializer.test.ts
+++ b/tests/TaskSerializer/DataviewTaskSerializer.test.ts
@@ -2,12 +2,12 @@
  * @jest-environment jsdom
  */
 import moment from 'moment';
-import { Priority } from '../../src/Task/Task';
 import { RecurrenceBuilder } from '../TestingTools/RecurrenceBuilder';
 import { TaskBuilder } from '../TestingTools/TaskBuilder';
 import { DATAVIEW_SYMBOLS, DataviewTaskSerializer } from '../../src/TaskSerializer/DataviewTaskSerializer';
 import type { Task } from '../../src/Task/Task';
 import type { TaskDetails } from '../../src/TaskSerializer';
+import { Priority } from '../../src/Task/Priority';
 
 jest.mock('obsidian');
 window.moment = moment;
diff --git a/tests/TaskSerializer/DefaultTaskSerializer.test.ts b/tests/TaskSerializer/DefaultTaskSerializer.test.ts
index b80903a2..02704acd 100644
--- a/tests/TaskSerializer/DefaultTaskSerializer.test.ts
+++ b/tests/TaskSerializer/DefaultTaskSerializer.test.ts
@@ -2,12 +2,12 @@
  * @jest-environment jsdom
  */
 import moment from 'moment';
-import { Priority } from '../../src/Task/Task';
 import type { Settings } from '../../src/Config/Settings';
 import { DefaultTaskSerializer } from '../../src/TaskSerializer';
 import { RecurrenceBuilder } from '../TestingTools/RecurrenceBuilder';
 import { DEFAULT_SYMBOLS, type DefaultTaskSerializerSymbols } from '../../src/TaskSerializer/DefaultTaskSerializer';
 import { TaskBuilder } from '../TestingTools/TaskBuilder';
+import { Priority } from '../../src/Task/Priority';
 
 jest.mock('obsidian');
 window.moment = moment;
diff --git a/tests/TaskSerializer/TaskSerializer.test.ts b/tests/TaskSerializer/TaskSerializer.test.ts
index 3ecbe1d2..083a2c60 100644
--- a/tests/TaskSerializer/TaskSerializer.test.ts
+++ b/tests/TaskSerializer/TaskSerializer.test.ts
@@ -3,9 +3,11 @@
  */
 
 import moment from 'moment';
-import { Priority, Task, TaskRegularExpressions } from '../../src/Task/Task';
+import { Task } from '../../src/Task/Task';
 import type { TaskDetails, TaskSerializer } from '../../src/TaskSerializer';
 import { TaskBuilder } from '../TestingTools/TaskBuilder';
+import { Priority } from '../../src/Task/Priority';
+import { TaskRegularExpressions } from '../../src/Task/TaskRegularExpressions';
 
 jest.mock('obsidian');
 window.moment = moment;
diff --git a/tests/TestingTools/TaskBuilder.ts b/tests/TestingTools/TaskBuilder.ts
index 57ff6ab9..4c1ab91e 100644
--- a/tests/TestingTools/TaskBuilder.ts
+++ b/tests/TestingTools/TaskBuilder.ts
@@ -1,11 +1,12 @@
 // Builder
 import type { Moment } from 'moment';
 import { Status } from '../../src/Statuses/Status';
-import { Priority, Task } from '../../src/Task/Task';
+import { Task } from '../../src/Task/Task';
 import { Recurrence } from '../../src/Task/Recurrence';
 import { DateParser } from '../../src/Query/DateParser';
 import { StatusConfiguration, StatusType } from '../../src/Statuses/StatusConfiguration';
 import { TaskLocation } from '../../src/Task/TaskLocation';
+import { Priority } from '../../src/Task/Priority';
 
 /**
  * A fluent class for creating tasks for tests.
diff --git a/tests/TestingTools/TestHelpers.ts b/tests/TestingTools/TestHelpers.ts
index 650f5172..c09e9252 100644
--- a/tests/TestingTools/TestHelpers.ts
+++ b/tests/TestingTools/TestHelpers.ts
@@ -1,9 +1,10 @@
-import { Priority, Task } from '../../src/Task/Task';
+import { Task } from '../../src/Task/Task';
 import { TaskLocation } from '../../src/Task/TaskLocation';
 import { PriorityTools } from '../../src/lib/PriorityTools';
 import { Status } from '../../src/Statuses/Status';
 import { StatusType } from '../../src/Statuses/StatusConfiguration';
 import { Recurrence } from '../../src/Task/Recurrence';
+import { Priority } from '../../src/Task/Priority';
 import { TaskBuilder } from './TaskBuilder';
 
 export function fromLine({
diff --git a/tests/TestingTools/VerifyStatuses.ts b/tests/TestingTools/VerifyStatuses.ts
index 7a7c92be..e9325222 100644
--- a/tests/TestingTools/VerifyStatuses.ts
+++ b/tests/TestingTools/VerifyStatuses.ts
@@ -1,5 +1,4 @@
 import { verify } from 'approvals/lib/Providers/Jest/JestApprovals';
-import { getPrintableSymbol } from '../../src/Statuses/StatusRegistryReport';
 import type { Status } from '../../src/Statuses/Status';
 import { MarkdownTable } from '../../src/lib/MarkdownTable';
 import type { Task } from '../../src/Task/Task';
@@ -11,6 +10,7 @@ import { StatusField } from '../../src/Query/Filter/StatusField';
 import { StatusTypeField } from '../../src/Query/Filter/StatusTypeField';
 import { StatusNameField } from '../../src/Query/Filter/StatusNameField';
 import { StatusRegistry } from '../../src/Statuses/StatusRegistry';
+import { getPrintableSymbol } from '../../src/Statuses/StatusSettingsReport';
 import { TaskBuilder } from './TaskBuilder';
 import { verifyMarkdownForDocs } from './VerifyMarkdown';
 import { verifyWithFileExtension } from './ApprovalTestHelpers';
diff --git a/tests/lib/PriorityTools.test.ts b/tests/lib/PriorityTools.test.ts
index 397a0308..8773345e 100644
--- a/tests/lib/PriorityTools.test.ts
+++ b/tests/lib/PriorityTools.test.ts
@@ -1,5 +1,5 @@
-import { Priority } from '../../src/Task/Task';
 import { PriorityTools } from '../../src/lib/PriorityTools';
+import { Priority } from '../../src/Task/Priority';
 
 describe('priority naming', () => {
     it.each(Object.values(Priority))('should name priority value: "%i"', (priority) => {
diff --git a/tests/ui/EditInstructions/PriorityInstructions.test.ts b/tests/ui/EditInstructions/PriorityInstructions.test.ts
index 1dfc28ef..40bc1ea8 100644
--- a/tests/ui/EditInstructions/PriorityInstructions.test.ts
+++ b/tests/ui/EditInstructions/PriorityInstructions.test.ts
@@ -1,6 +1,6 @@
 import { TaskBuilder } from '../../TestingTools/TaskBuilder';
-import { Priority } from '../../../src/Task/Task';
 import { SetPriority, allPriorityInstructions } from '../../../src/ui/EditInstructions/PriorityInstructions';
+import { Priority } from '../../../src/Task/Priority';
 
 describe('SetPriority', () => {
     const lowPriorityTask = new TaskBuilder().priority(Priority.Low).build();
diff --git a/tests/ui/Menus/PriorityMenu.test.ts b/tests/ui/Menus/PriorityMenu.test.ts
index 9b72ccab..57bc39ba 100644
--- a/tests/ui/Menus/PriorityMenu.test.ts
+++ b/tests/ui/Menus/PriorityMenu.test.ts
@@ -1,6 +1,6 @@
 import { PriorityMenu } from '../../../src/ui/Menus/PriorityMenu';
 import { TaskBuilder } from '../../TestingTools/TaskBuilder';
-import { Priority } from '../../../src/Task/Task';
+import { Priority } from '../../../src/Task/Priority';
 import { TestableTaskSaver, menuToString } from './MenuTestingHelpers';
 
 export {};