我想将查询从NDepend限制为一组特定的类型。但是如果我尝试使用正常的赋值,我会收到以下错误:
Only single statement queries are supported. If you wish to define a function or a variable global to the query, use a range variable defined in a 'let' clause declared before the query. For example: let myVar = ThirdParty.Types.WithName("IDisposable").Single() let myFunc = new Func<IType, bool>(t => t.NbLinesOfCode > 10) let ... from t in Types where t.Implement(myVar) && myFunc(t) select new { t, t.NbLinesOfCode }
但我的第二次尝试也失败了
let temp = from t in Types
let depth0 = t.DepthOfIsUsedBy("PrintOddsDrawing")
where depth0 >= 0 orderby depth0
select new { t, depth0, t.NbTypesUsed }
// <Name>Methods too complex - critical</Name>
warnif count > 0 from m in JustMyCode.Methods where
m.CyclomaticComplexity > 30 ||
m.ILCyclomaticComplexity > 60 ||
m.ILNestingDepth > 6
orderby m.CyclomaticComplexity descending,
m.ILCyclomaticComplexity descending,
m.ILNestingDepth descending
select new { m, m.CyclomaticComplexity,
m.ILCyclomaticComplexity,
m.ILNestingDepth }
答案 0 :(得分:1)
只需将function Spot(value) {
this.x = null;
this.y = null;
this.values = [value];
}
var point = new Spot('foo')
console.log(point);
标题放在查询的开头
warnif count > 0
第二个问题:是否还有一种方法可以将所有代码气味调查仅应用于与我工作的类型相关的简化子集
您可以执行类似的查询(将warnif count > 0
let temp = from t in Types
...
替换为您自己的子集定义)
TypesAndMembers.WithNameLike("m")