Skip to content

Code optimization and quality improvements suggestion #13

Description

@L34T

Outdated namespace? Timers seems missed (3)


Possible NullReferenceException / null assignment to non-nullable entity (13)


Typo (32)


Merging into logical pattern. if (foo = 1 || foo = 2) into if (foo is 1 or 2) (11)


CA1854: Prefer TryGetValue over ContainsKey ( https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1854 ) (22)


Class validation checks become inefficient when compared over logical OR due to Logical AND's high priority. (3)


Some small sudgestions:

Where(foo).Count() may be replaced with Count(foo)

(CA1860) ActivePhases is List. Lists(like all other collections) have it's size stored. So ActivePhases.Count == 0 could be used instead (23)

(CA1847) Single quotation marks in characterName.Contains() forsing search for char instead substring (8)

Object initialization may increase readability new foo() {bar = 1, baz = 2}

Switch statement used in switch expression way so it may be converted into expression (11)

return challenge.ChallengeType switch {
    ChallengeType.DamageOut => foo,
    ChallengeType.DamageIn => bar }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions