Skip to content
This repository was archived by the owner on Dec 18, 2023. It is now read-only.

Commit 92d3212

Browse files
Sergey KanzhelevSergey Kanzhelev
authored andcommitted
stylecop enabled for product code
1 parent e5e989d commit 92d3212

148 files changed

Lines changed: 1343 additions & 1421 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

OpenCensus.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1212
NuGet.config = NuGet.config
1313
EndProjectSection
1414
EndProject
15+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{7CB2F02E-03FA-4FFF-89A5-C51F107623FD}"
16+
ProjectSection(SolutionItems) = preProject
17+
build\OpenCensus.prod.ruleset = build\OpenCensus.prod.ruleset
18+
build\stylecop.json = build\stylecop.json
19+
EndProjectSection
20+
EndProject
1521
Global
1622
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1723
Debug|Any CPU = Debug|Any CPU

build/OpenCensus.prod.ruleset

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<RuleSet Name="OpenCensus SDK Rules" Description="Open Census SDK ruleset for product code." ToolsVersion="15.0">
3+
<Localization ResourceAssembly="Microsoft.VisualStudio.CodeAnalysis.RuleSets.Strings.dll" ResourceBaseName="Microsoft.VisualStudio.CodeAnalysis.RuleSets.Strings.Localized">
4+
<Name Resource="OpenCensusSDKRules_Name" />
5+
<Description Resource="OpenCensusSDKRules_Description" />
6+
</Localization>
7+
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
8+
<Rule Id="SA1000" Action="Error" />
9+
<Rule Id="SA1001" Action="Error" />
10+
<Rule Id="SA1002" Action="Error" />
11+
<Rule Id="SA1003" Action="Error" />
12+
<Rule Id="SA1004" Action="Error" />
13+
<Rule Id="SA1005" Action="Error" />
14+
<Rule Id="SA1006" Action="Error" />
15+
<Rule Id="SA1007" Action="Error" />
16+
<Rule Id="SA1008" Action="Error" />
17+
<Rule Id="SA1009" Action="Error" />
18+
<Rule Id="SA1010" Action="Error" />
19+
<Rule Id="SA1011" Action="Error" />
20+
<Rule Id="SA1012" Action="Error" />
21+
<Rule Id="SA1013" Action="Error" />
22+
<Rule Id="SA1014" Action="Error" />
23+
<Rule Id="SA1015" Action="Error" />
24+
<Rule Id="SA1016" Action="Error" />
25+
<Rule Id="SA1017" Action="Error" />
26+
<Rule Id="SA1018" Action="Error" />
27+
<Rule Id="SA1019" Action="Error" />
28+
<Rule Id="SA1020" Action="Error" />
29+
<Rule Id="SA1021" Action="Error" />
30+
<Rule Id="SA1022" Action="Error" />
31+
<Rule Id="SA1023" Action="Error" />
32+
<Rule Id="SA1024" Action="Error" />
33+
<Rule Id="SA1025" Action="Error" />
34+
<Rule Id="SA1026" Action="Error" />
35+
<Rule Id="SA1027" Action="Error" />
36+
<Rule Id="SA1028" Action="None" />
37+
<Rule Id="SA1100" Action="Error" />
38+
<Rule Id="SA1101" Action="Error" />
39+
<Rule Id="SA1102" Action="Error" />
40+
<Rule Id="SA1103" Action="Error" />
41+
<Rule Id="SA1104" Action="Error" />
42+
<Rule Id="SA1105" Action="Error" />
43+
<Rule Id="SA1106" Action="Error" />
44+
<Rule Id="SA1107" Action="Error" />
45+
<Rule Id="SA1108" Action="Error" />
46+
<Rule Id="SA1110" Action="Error" />
47+
<Rule Id="SA1111" Action="Error" />
48+
<Rule Id="SA1112" Action="Error" />
49+
<Rule Id="SA1113" Action="None" />
50+
<Rule Id="SA1114" Action="None" />
51+
<Rule Id="SA1115" Action="Error" />
52+
<Rule Id="SA1116" Action="None" />
53+
<Rule Id="SA1117" Action="None" />
54+
<Rule Id="SA1118" Action="None" />
55+
<Rule Id="SA1119" Action="Error" />
56+
<Rule Id="SA1120" Action="Error" />
57+
<Rule Id="SA1121" Action="None" />
58+
<Rule Id="SA1122" Action="Error" />
59+
<Rule Id="SA1123" Action="Error" />
60+
<Rule Id="SA1124" Action="None" />
61+
<Rule Id="SA1125" Action="Error" />
62+
<Rule Id="SA1127" Action="None" />
63+
<Rule Id="SA1128" Action="None" />
64+
<Rule Id="SA1129" Action="None" />
65+
<Rule Id="SA1130" Action="Error" />
66+
<Rule Id="SA1131" Action="None" />
67+
<Rule Id="SA1132" Action="None" />
68+
<Rule Id="SA1133" Action="Error" />
69+
<Rule Id="SA1134" Action="None" />
70+
<Rule Id="SA1200" Action="Error" />
71+
<Rule Id="SA1201" Action="Error" />
72+
<Rule Id="SA1202" Action="Error" />
73+
<Rule Id="SA1203" Action="Error" />
74+
<Rule Id="SA1204" Action="Error" />
75+
<Rule Id="SA1205" Action="Error" />
76+
<Rule Id="SA1206" Action="Error" />
77+
<Rule Id="SA1207" Action="Error" />
78+
<Rule Id="SA1208" Action="Error" />
79+
<Rule Id="SA1209" Action="Error" />
80+
<Rule Id="SA1210" Action="Error" />
81+
<Rule Id="SA1211" Action="Error" />
82+
<Rule Id="SA1212" Action="Error" />
83+
<Rule Id="SA1213" Action="Error" />
84+
<Rule Id="SA1214" Action="Error" />
85+
<Rule Id="SA1216" Action="Error" />
86+
<Rule Id="SA1217" Action="Error" />
87+
<Rule Id="SA1300" Action="Error" />
88+
<Rule Id="SA1302" Action="Error" />
89+
<Rule Id="SA1303" Action="Error" />
90+
<Rule Id="SA1304" Action="Error" />
91+
<Rule Id="SA1306" Action="Error" />
92+
<Rule Id="SA1307" Action="Error" />
93+
<Rule Id="SA1308" Action="Error" />
94+
<Rule Id="SA1309" Action="Error" />
95+
<Rule Id="SA1310" Action="Error" />
96+
<Rule Id="SA1311" Action="Error" />
97+
<Rule Id="SA1312" Action="Error" />
98+
<Rule Id="SA1313" Action="Error" />
99+
<Rule Id="SA1400" Action="Error" />
100+
<Rule Id="SA1401" Action="None" />
101+
<Rule Id="SA1402" Action="Error" />
102+
<Rule Id="SA1403" Action="Error" />
103+
<Rule Id="SA1404" Action="Error" />
104+
<Rule Id="SA1405" Action="Error" />
105+
<Rule Id="SA1406" Action="Error" />
106+
<Rule Id="SA1407" Action="Error" />
107+
<Rule Id="SA1408" Action="Error" />
108+
<Rule Id="SA1410" Action="Error" />
109+
<Rule Id="SA1411" Action="Error" />
110+
<Rule Id="SA1500" Action="Error" />
111+
<Rule Id="SA1501" Action="Error" />
112+
<Rule Id="SA1502" Action="Error" />
113+
<Rule Id="SA1503" Action="Error" />
114+
<Rule Id="SA1504" Action="Error" />
115+
<Rule Id="SA1505" Action="Error" />
116+
<Rule Id="SA1506" Action="Error" />
117+
<Rule Id="SA1507" Action="Error" />
118+
<Rule Id="SA1508" Action="Error" />
119+
<Rule Id="SA1509" Action="Error" />
120+
<Rule Id="SA1510" Action="Error" />
121+
<Rule Id="SA1511" Action="Error" />
122+
<Rule Id="SA1512" Action="None" />
123+
<Rule Id="SA1513" Action="Error" />
124+
<Rule Id="SA1514" Action="Error" />
125+
<Rule Id="SA1515" Action="None" />
126+
<Rule Id="SA1516" Action="Error" />
127+
<Rule Id="SA1517" Action="Error" />
128+
<Rule Id="SA1518" Action="Error" />
129+
<Rule Id="SA1519" Action="Error" />
130+
<Rule Id="SA1520" Action="Error" />
131+
<Rule Id="SA1600" Action="None" />
132+
<Rule Id="SA1601" Action="Error" />
133+
<Rule Id="SA1602" Action="Error" />
134+
<Rule Id="SA1604" Action="Error" />
135+
<Rule Id="SA1605" Action="Error" />
136+
<Rule Id="SA1606" Action="Error" />
137+
<Rule Id="SA1607" Action="Error" />
138+
<Rule Id="SA1608" Action="Error" />
139+
<Rule Id="SA1610" Action="Error" />
140+
<Rule Id="SA1611" Action="Warning" />
141+
<Rule Id="SA1612" Action="Error" />
142+
<Rule Id="SA1613" Action="Error" />
143+
<Rule Id="SA1614" Action="Error" />
144+
<Rule Id="SA1615" Action="None" />
145+
<Rule Id="SA1616" Action="Error" />
146+
<Rule Id="SA1617" Action="Error" />
147+
<Rule Id="SA1618" Action="None" />
148+
<Rule Id="SA1619" Action="Error" />
149+
<Rule Id="SA1620" Action="Error" />
150+
<Rule Id="SA1621" Action="Error" />
151+
<Rule Id="SA1622" Action="Error" />
152+
<Rule Id="SA1623" Action="Error" />
153+
<Rule Id="SA1624" Action="Error" />
154+
<Rule Id="SA1625" Action="Error" />
155+
<Rule Id="SA1626" Action="Error" />
156+
<Rule Id="SA1627" Action="Error" />
157+
<Rule Id="SA1633" Action="None" />
158+
<Rule Id="SA1634" Action="Error" />
159+
<Rule Id="SA1635" Action="Error" />
160+
<Rule Id="SA1636" Action="None" />
161+
<Rule Id="SA1637" Action="Error" />
162+
<Rule Id="SA1638" Action="Error" />
163+
<Rule Id="SA1640" Action="Error" />
164+
<Rule Id="SA1641" Action="Error" />
165+
<Rule Id="SA1642" Action="None" />
166+
<Rule Id="SA1643" Action="Error" />
167+
<Rule Id="SA1648" Action="Error" />
168+
<Rule Id="SA1649" Action="Error" />
169+
<Rule Id="SA1651" Action="Error" />
170+
<Rule Id="SA1652" Action="Error" />
171+
</Rules>
172+
</RuleSet>

src/OpenCensus/Api/Stats/Aggregations/IDistribution.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ namespace OpenCensus.Stats.Aggregations
1818
{
1919
public interface IDistribution : IAggregation
2020
{
21-
2221
IBucketBoundaries BucketBoundaries { get; }
2322
}
2423
}

src/OpenCensus/Api/Stats/IMeasurement.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ namespace OpenCensus.Stats
2121

2222
public interface IMeasurement
2323
{
24-
M Match<M>(Func<IMeasurementDouble, M> p0, Func<IMeasurementLong, M> p1, Func<IMeasurement, M> defaultFunction);
25-
2624
IMeasure Measure { get; }
25+
26+
M Match<M>(Func<IMeasurementDouble, M> p0, Func<IMeasurementLong, M> p1, Func<IMeasurement, M> defaultFunction);
2727
}
2828
}

src/OpenCensus/Api/Tags/ITagsComponent.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ namespace OpenCensus.Tags
2020

2121
public interface ITagsComponent
2222
{
23-
2423
ITagger Tagger { get; }
2524

2625
ITagPropagationComponent TagPropagationComponent { get; }

src/OpenCensus/Api/Trace/ITracer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ public interface ITracer
2424

2525
IScope WithSpan(ISpan span);
2626

27-
//<C> Callable<C> withSpan(Span span, final Callable<C> callable)
28-
//Runnable withSpan(Span span, Runnable runnable)
27+
// <C> Callable<C> withSpan(Span span, final Callable<C> callable)
28+
// Runnable withSpan(Span span, Runnable runnable)
2929
ISpanBuilder SpanBuilder(string spanName);
3030

3131
ISpanBuilder SpanBuilderWithExplicitParent(string spanName, ISpan parent = null);

src/OpenCensus/Impl/Common/DateTimeOffsetClock.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public ITimestamp Now
3535
{
3636
get
3737
{
38-
var nowNanoTicks = NowNanos;
38+
var nowNanoTicks = this.NowNanos;
3939
var nowSecTicks = nowNanoTicks / NANOS_PER_SECOND;
4040
var excessNanos = nowNanoTicks - (nowSecTicks * NANOS_PER_SECOND);
4141
return new Timestamp(nowSecTicks, (int)excessNanos);

src/OpenCensus/Impl/Common/Duration.cs

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,20 @@ namespace OpenCensus.Common
1818
{
1919
public class Duration : IDuration
2020
{
21-
const long MAX_SECONDS = 315576000000L;
22-
const int MAX_NANOS = 999999999;
21+
private const long MAX_SECONDS = 315576000000L;
22+
private const int MAX_NANOS = 999999999;
2323
private static readonly IDuration ZERO = new Duration(0, 0);
2424

2525
public Duration(long seconds, int nanos)
2626
{
27-
Seconds = seconds;
28-
Nanos = nanos;
27+
this.Seconds = seconds;
28+
this.Nanos = nanos;
2929
}
3030

31+
public long Seconds { get; }
32+
33+
public int Nanos { get; }
34+
3135
public static IDuration Create(long seconds, int nanos)
3236
{
3337
if (seconds < -MAX_SECONDS || seconds > MAX_SECONDS)
@@ -50,25 +54,20 @@ public static IDuration Create(long seconds, int nanos)
5054

5155
public int CompareTo(IDuration other)
5256
{
53-
54-
int cmp = (Seconds < other.Seconds) ? -1 : ((Seconds > other.Seconds) ? 1 : 0);
57+
int cmp = (this.Seconds < other.Seconds) ? -1 : ((this.Seconds > other.Seconds) ? 1 : 0);
5558
if (cmp != 0)
5659
{
5760
return cmp;
5861
}
5962

60-
return (Nanos < other.Nanos) ? -1 : ((Nanos > other.Nanos) ? 1 : 0);
63+
return (this.Nanos < other.Nanos) ? -1 : ((this.Nanos > other.Nanos) ? 1 : 0);
6164
}
6265

63-
public long Seconds { get; }
64-
65-
public int Nanos { get; }
66-
6766
public override string ToString()
6867
{
6968
return "Duration{"
70-
+ "seconds=" + Seconds + ", "
71-
+ "nanos=" + Nanos
69+
+ "seconds=" + this.Seconds + ", "
70+
+ "nanos=" + this.Nanos
7271
+ "}";
7372
}
7473

@@ -79,9 +78,8 @@ public override bool Equals(object o)
7978
return true;
8079
}
8180

82-
if (o is Duration)
81+
if (o is Duration that)
8382
{
84-
Duration that = (Duration)o;
8583
return (this.Seconds == that.Seconds)
8684
&& (this.Nanos == that.Nanos);
8785
}

0 commit comments

Comments
 (0)