Files
codeql/csharp/ql/test/query-tests/MagicConstants/AttributeInts.cs
2018-08-02 17:53:23 +01:00

31 lines
671 B
C#

using System;
class IdAttribute : Attribute
{
public IdAttribute(int x = 0) { }
public int id;
}
class IntAttributes
{
// GOOD: Constants in attributes shouldn't be flagged, and shouldn't contribute to the count.
[Id(id = 555)]
void f1()
{
}
// GOOD: Constants in attributes shouldn't be flagged, and shouldn't contribute to the count.
[Id(555 + 555)]
void f2()
{
// BAD
var x = 555 +
555 + 555 + 555 + 555 + 555 + 555 + 555 + 555 + 555 + 555 +
555 + 555 + 555 + 555 + 555 + 555 + 555 + 555 + 555 + 555;
}
}
// semmle-extractor-options: /r:System.ComponentModel.Primitives.dll