xunit/xunit

Implement scoring for how "literal" an expression is

Fermée

#1 251 ouverte le 7 mai 2017

 (0 commentaire) (0 réaction) (0 personne assignée)C# (761 forks)batch import
AnalyzersFeaturehelp wanted

Métriques du dépôt

Stars
 (3 873 étoiles)
Métriques de merge PR
 (Métriques PR en attente)

Description

From @marcind on September 12, 2016 20:2

Rule xUnit2000 has logic for determining whether an expression is a "literal". Change the logic to implement a scoring mechanism. Something like the following (most "literal" first)

  1. null, Literal Expressions, typeof, nameof, sizeof, default, enum values
  2. Consts and static read-only fields/properties (include reference types or not?)
  3. New "instances" of structs
  4. Certain factory methods on structs (e.g. DateTime.Parse)
  5. Everything else.

If the second arg has a lower score than the first arg, trigger the rule.

Copied from original issue: xunit/xunit.analyzers#27

Guide contributeur