Repository: PyCQA/isort

Issue:
isort ignores `reverse_sort` when `force_sort_within_sections` is true
i have a mix of imports that i want sorted by length, and running isort on it while force_sort_within_sections and reverse_sort are both true causes them to be sorted shortest line to longest, rather than longest to shortest, as expected.
> `pyproject.toml`
> ```toml
> [tool.isort]
> length_sort = true
> reverse_sort = true
> force_sort_within_sections = true
> ```

> IN
> ```python
> import blaaa
> from bl4aaaaaaaaaaaaaaaa import r
> import blaaaaaaaaaaaa
> import bla
> import blaaaaaaa
> from bl1aaaaaaaaaaaaaa import this_is_1
> from bl2aaaaaaa import THIIIIIIIIIIIISS_is_2
> from bl3aaaaaa import less
> ```

> OUT
> ```python
> import bla
> import blaaa
> import blaaaaaaa
> import blaaaaaaaaaaaa
> from bl3aaaaaa import less
> from bl4aaaaaaaaaaaaaaaa import r
> from bl1aaaaaaaaaaaaaa import this_is_1
> from bl2aaaaaaa import THIIIIIIIIIIIISS_is_2
> ```

> EXPECTED
> ```python
> from bl2aaaaaaa import THIIIIIIIIIIIISS_is_2
> from bl1aaaaaaaaaaaaaa import this_is_1
> from bl4aaaaaaaaaaaaaaaa import r
> from bl3aaaaaa import less
> import blaaaaaaaaaaaa
> import blaaaaaaa
> import blaaa
> import bla
> ```

Comments:

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8a67e349..217e2bef 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,7 +6,8 @@ Find out more about isort's release policy [here](https://pycqa.github.io/isort/
 
 ### 5.9.0 TBD
   - Fixed (https://github.com/PyCQA/isort/pull/1695) added imports being added to doc string in some cases.
-  - Fixed (https://github.com/PyCQA/isort/pull/1714) in rare case line continuation combined with tab can output invalid code.
+  - Fixed (https://github.com/PyCQA/isort/pull/1714) in rare cases line continuation combined with tabs can output invalid code.
+  - Fixed (https://github.com/PyCQA/isort/pull/1726) isort ignores reverse_sort when force_sort_within_sections is true.
   - Implemented #1697: Provisional support for PEP 582: skip `__pypackages__` directories by default.
   - Implemented #1705: More intuitive handling of isort:skip_file comments on streams.
 
diff --git a/isort/output.py b/isort/output.py
index 61c2e30e..fb74ef73 100644
--- a/isort/output.py
+++ b/isort/output.py
@@ -108,6 +108,7 @@ def sorted_imports(
             new_section_output = sorting.naturally(
                 new_section_output,
                 key=partial(sorting.section_key, config=config),
+                reverse=config.reverse_sort,
             )
 
             # uncollapse comments


Test patch:
diff --git a/tests/unit/test_ticketed_features.py b/tests/unit/test_ticketed_features.py
index a0e5e164..17aaf166 100644
--- a/tests/unit/test_ticketed_features.py
+++ b/tests/unit/test_ticketed_features.py
@@ -1082,3 +1082,36 @@ from ._foo import a
 from ._bar import All, Any, Not
 """
     )
+
+
+def test_isort_can_combine_reverse_sort_with_force_sort_within_sections_issue_1726():
+    """isort should support reversing import order even with force sort within sections turned on.
+    See: https://github.com/PyCQA/isort/issues/1726
+    """
+    assert (
+        isort.code(
+            """
+import blaaa
+from bl4aaaaaaaaaaaaaaaa import r
+import blaaaaaaaaaaaa
+import bla
+import blaaaaaaa
+from bl1aaaaaaaaaaaaaa import this_is_1
+from bl2aaaaaaa import THIIIIIIIIIIIISS_is_2
+from bl3aaaaaa import less
+""",
+            length_sort=True,
+            reverse_sort=True,
+            force_sort_within_sections=True,
+        )
+        == """
+from bl2aaaaaaa import THIIIIIIIIIIIISS_is_2
+from bl1aaaaaaaaaaaaaa import this_is_1
+from bl4aaaaaaaaaaaaaaaa import r
+from bl3aaaaaa import less
+import blaaaaaaaaaaaa
+import blaaaaaaa
+import blaaa
+import bla
+"""
+    )