Skip to content

[Mouse Without Borders] - de-linting codebase #44508

@mikeclayton

Description

@mikeclayton

Description of the new feature / enhancement

Following on from #35155 [Mouse Without Borders] - refactoring "Common" classes there's a fair number of legacy lint / quality issues in the Mouse Without Borders codebase that were pragmatically carried over like-for-like during the original port of Mouse Without Borders into PowerToys in order to avoid introducing new bugs.

There are currently about 500 warnings in the Mouse Without Borders projects. None of these are critical build-breaking problems, but they clutter the codebase and make it slightly harder to maintain. Addressing some of these issues will clean up the codebase, reduce the number of IDE warnings in the project and make it easier to maintain in future.

I have capacity to address some of these issues if there is appetite for the work...

Examples


Properties with explicit backing fields

A number of properties have explicit backing fields that could be converted to automatic properties:

private static string lastDragDropFile;

internal static string LastDragDropFile
{
    get => Clipboard.lastDragDropFile;
    set => Clipboard.lastDragDropFile = value;
}

->

internal static string LastDragDropFile
{
    get;
    set;
}

Exposed fields

Fields could be exposed as properties and the casing fixed to reduce warning pragmas.

#pragma warning disable SA1307 // Accessible fields should begin with upper-case letter
    internal static long clipboardCopiedTime;
#pragma warning restore SA1307
internal static long ClipboardCopiedTime
{
    get;
    set;
}

Unused code

There's a bunch of unused code that can be removed:

Image

as well as other instances such as MyKnownBitmap that only has a single reference which is an explicit default constructor that itself has zero references.


Unnecessary using directives

Image

Other

There's a bunch of other warnings IDE#### warnings and non-functional linting issues that can be addressed at the same time.

Scenario when this would be used?

These are non functional changes that will only really involve small localised areas of code.

The changes will reduce clutter in the codebase and reduce the number of IDE warnings.

Supporting information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs-TriageFor issues raised to be triaged and prioritized by internal Microsoft teamsProduct-Mouse Without BordersRefers to the Mouse Without Borders module

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions