Skip to content

Commit ea83e33

Browse files
committed
v0.9.1
1 parent 6f56ad5 commit ea83e33

3 files changed

Lines changed: 25 additions & 16 deletions

File tree

CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [v0.9.1] - 2026-09-12
11+
12+
### Tests
13+
- Analyzer tests no longer hardcode diagnostic spans. The seven `.WithSpan(line, col, line, col)`
14+
expectations are replaced by markup in the test source (`{|#0:...|}`) with `.WithLocation(0)`, so
15+
reformatting a test source does not break its expectation. Message arguments are still checked.
16+
Closes T3.
17+
1018
## [v0.9.0] - 2026-09-12
1119

1220
### Changed
@@ -409,7 +417,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
409417
### Removed
410418
- Empty placeholder test `tests/ObjectPoolLinter.Tests/UnitTest1.cs`.
411419

412-
[Unreleased]: https://github.com/joezhuo2/ObjectPoolLinter/compare/v0.9.0...HEAD
420+
[Unreleased]: https://github.com/joezhuo2/ObjectPoolLinter/compare/v0.9.1...HEAD
421+
[v0.9.1]: https://github.com/joezhuo2/ObjectPoolLinter/compare/v0.9.0...v0.9.1
413422
[v0.9.0]: https://github.com/joezhuo2/ObjectPoolLinter/compare/v0.8.8...v0.9.0
414423
[v0.8.8]: https://github.com/joezhuo2/ObjectPoolLinter/compare/v0.8.7...v0.8.8
415424
[v0.8.7]: https://github.com/joezhuo2/ObjectPoolLinter/compare/v0.8.6...v0.8.7

src/ObjectPoolLinter.Package/ObjectPoolLinter.Package.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
<PropertyGroup>
1111
<PackageId>ObjectPoolLinter</PackageId>
12-
<Version>0.9.0</Version>
12+
<Version>0.9.1</Version>
1313
<Authors>Joe Zhuo</Authors>
1414
<Copyright>Copyright (c) 2026 Joe Zhuo</Copyright>
1515
<Description>Roslyn analyzer for Unity C# that flags object allocations in hot paths and offers code fixes that route them through an object pool, minimizing GC and frame hitches.</Description>

tests/ObjectPoolLinter.Tests/ObjectPoolAnalyzerTests.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,13 @@ public class MyBehaviour : MonoBehaviour
8282
{
8383
void Update()
8484
{
85-
var list = new System.Collections.Generic.List<int>();
85+
var list = {|#0:new System.Collections.Generic.List<int>()|};
8686
}
8787
}
8888
";
8989

9090
var expected = new DiagnosticResult(ObjectPoolAnalyzer.DiagnosticId, DiagnosticSeverity.Warning)
91-
.WithSpan(8, 20, 8, 62)
91+
.WithLocation(0)
9292
.WithArguments("Update", "System.Collections.Generic.List<int>");
9393

9494
await VerifyAnalyzerAsync(source, expected);
@@ -105,13 +105,13 @@ public class MyBehaviour : MonoBehaviour
105105
public Object prefab;
106106
void Update()
107107
{
108-
Object.Instantiate(prefab);
108+
{|#0:Object.Instantiate(prefab)|};
109109
}
110110
}
111111
";
112112

113113
var expected = new DiagnosticResult(ObjectPoolAnalyzer.DiagnosticId, DiagnosticSeverity.Warning)
114-
.WithSpan(9, 9, 9, 35)
114+
.WithLocation(0)
115115
.WithArguments("Update", "Instantiate");
116116

117117
await VerifyAnalyzerAsync(source, expected);
@@ -181,13 +181,13 @@ public class MyBehaviour : MonoBehaviour
181181
{
182182
void FixedUpdate()
183183
{
184-
var list = new System.Collections.Generic.List<int>();
184+
var list = {|#0:new System.Collections.Generic.List<int>()|};
185185
}
186186
}
187187
";
188188

189189
var expected = new DiagnosticResult(ObjectPoolAnalyzer.DiagnosticId, DiagnosticSeverity.Warning)
190-
.WithSpan(8, 20, 8, 62)
190+
.WithLocation(0)
191191
.WithArguments("FixedUpdate", "System.Collections.Generic.List<int>");
192192

193193
await VerifyAnalyzerAsync(source, expected);
@@ -383,13 +383,13 @@ public class MyBehaviour : MonoBehaviour
383383
{
384384
void OnTriggerStay(Collider other)
385385
{
386-
var list = new System.Collections.Generic.List<int>();
386+
var list = {|#0:new System.Collections.Generic.List<int>()|};
387387
}
388388
}
389389
";
390390

391391
var expected = new DiagnosticResult(ObjectPoolAnalyzer.DiagnosticId, DiagnosticSeverity.Warning)
392-
.WithSpan(8, 20, 8, 62)
392+
.WithLocation(0)
393393
.WithArguments("OnTriggerStay", "System.Collections.Generic.List<int>");
394394

395395
await VerifyAnalyzerAsync(source, expected);
@@ -441,13 +441,13 @@ public class MyBehaviour : MonoBehaviour
441441
{
442442
void OnCollisionStay2D(Collision2D collision)
443443
{
444-
var list = new System.Collections.Generic.List<int>();
444+
var list = {|#0:new System.Collections.Generic.List<int>()|};
445445
}
446446
}
447447
";
448448

449449
var expected = new DiagnosticResult(ObjectPoolAnalyzer.DiagnosticId, DiagnosticSeverity.Warning)
450-
.WithSpan(8, 20, 8, 62)
450+
.WithLocation(0)
451451
.WithArguments("OnCollisionStay2D", "System.Collections.Generic.List<int>");
452452

453453
await VerifyAnalyzerAsync(source, expected);
@@ -463,13 +463,13 @@ public class MyBehaviour : MonoBehaviour
463463
{
464464
void OnAnimatorIK(int layerIndex)
465465
{
466-
var list = new System.Collections.Generic.List<int>();
466+
var list = {|#0:new System.Collections.Generic.List<int>()|};
467467
}
468468
}
469469
";
470470

471471
var expected = new DiagnosticResult(ObjectPoolAnalyzer.DiagnosticId, DiagnosticSeverity.Warning)
472-
.WithSpan(8, 20, 8, 62)
472+
.WithLocation(0)
473473
.WithArguments("OnAnimatorIK", "System.Collections.Generic.List<int>");
474474

475475
await VerifyAnalyzerAsync(source, expected);
@@ -613,13 +613,13 @@ public class MyBehaviour : UnityEngine.MonoBehaviour
613613
{
614614
void Update()
615615
{
616-
var list = new System.Collections.Generic.List<int>();
616+
var list = {|#0:new System.Collections.Generic.List<int>()|};
617617
}
618618
}
619619
";
620620

621621
var expected = new DiagnosticResult(ObjectPoolAnalyzer.DiagnosticId, DiagnosticSeverity.Warning)
622-
.WithSpan(11, 20, 11, 62)
622+
.WithLocation(0)
623623
.WithArguments("Update", "System.Collections.Generic.List<int>");
624624

625625
await VerifyWithoutUnityAsync(source, expected);

0 commit comments

Comments
 (0)