xunit/xunit

Implement scoring for how "literal" an expression is

Chiusa

#1251 aperta il 7 mag 2017

 (0 commenti) (0 reazioni) (0 assegnatari)C# (761 fork)batch import
AnalyzersFeaturehelp wanted

Metriche repository

Star
 (3873 stelle)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

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

Guida contributor