Skip to content

Sorting isn't using natural sort #662

Open
@cyotek

Description

@cyotek

Environment

  • Visual Studio version: 2019 Enterprise
  • CodeMaid version: 11.0
  • Code language: C#

Description

CodeMaid appears to be using logical sort when ordering members, therefore member names with numbers can get ordered incorrectly for a human.

Steps to recreate

  • Create methods containing at least one double digit number, e.g.
    public void Scenario8Test2()
    {
    }

    public void Scenario8Test10()
    {
    }
  • Instruct CodeMaid to organise the document

Current behavior

CodeMaid will order logically, so using the above example you'll end up with

    public void Scenario8Test10()
    {
    }

    public void Scenario8Test2()
    {
    }

Not exactly the way a human would order them :)

Expected behavior

It would be nicer if CodeMaid used natural sorting for member names.

Why are you creating methods with numbers in them?

I'm not a monster, really! SpecFlow auto generates test methods that are worse, and as the order is important for readability purposes (because each "test" has multiple methods with a different condition) I can't cleanup the file using its default names. I've started renaming them by scenario and step so that when I organise the file they still appear in the correct order (and to stop me going batty reading the names it does produce). The method names don't entirely matter as there's a bunch of Given, When, Then attributes for each test method with a textual description.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions