-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
448 changed files
with
234,147 additions
and
3 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
<!DOCTYPE html> | ||
<!--[if IE]><![endif]--> | ||
<html> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
<title>Libplanet.Analyzers: Static analysis on Libplanet-powered apps | Libplanet </title> | ||
<meta name="viewport" content="width=device-width"> | ||
<meta name="title" content="Libplanet.Analyzers: Static analysis on Libplanet-powered apps | Libplanet "> | ||
|
||
<link rel="shortcut icon" href="../images/favicon.ico"> | ||
<link rel="stylesheet" href="../styles/docfx.vendor.css"> | ||
<link rel="stylesheet" href="../styles/docfx.css"> | ||
<link rel="stylesheet" href="../styles/main.css"> | ||
<meta property="docfx:navrel" content="../toc.html"> | ||
<meta property="docfx:tocrel" content="../toc.html"> | ||
|
||
|
||
|
||
</head> | ||
<body data-spy="scroll" data-target="#affix" data-offset="120"> | ||
<div id="wrapper"> | ||
<header> | ||
|
||
<nav id="autocollapse" class="navbar navbar-inverse ng-scope" role="navigation"> | ||
<div class="container"> | ||
<div class="navbar-header"> | ||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar"> | ||
<span class="sr-only">Toggle navigation</span> | ||
<span class="icon-bar"></span> | ||
<span class="icon-bar"></span> | ||
<span class="icon-bar"></span> | ||
</button> | ||
|
||
<a class="navbar-brand" href="../index.html"> | ||
<img id="logo" class="svg" src="../images/logo.svg" alt=""> | ||
</a> | ||
</div> | ||
<div class="collapse navbar-collapse" id="navbar"> | ||
<form class="navbar-form navbar-right" role="search" id="search"> | ||
<div class="form-group"> | ||
<input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off"> | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
</nav> | ||
|
||
<div class="subnav navbar navbar-default"> | ||
<div class="container hide-when-search" id="breadcrumb"> | ||
<ul class="breadcrumb"> | ||
<li></li> | ||
</ul> | ||
</div> | ||
</div> | ||
</header> | ||
<div role="main" class="container body-content hide-when-search"> | ||
<div class="article row grid"> | ||
<div class="col-md-10"> | ||
<article class="content wrap" id="_content" data-uid=""> | ||
<h1 id="libplanetanalyzers-static-analysis-on-libplanet-powered-apps">Libplanet.Analyzers: Static analysis on Libplanet-powered apps</h1> | ||
|
||
<p><a href="https://www.nuget.org/packages/Libplanet.Analyzers/"><img src="https://img.shields.io/nuget/v/Libplanet.Analyzers.svg?style=flat" alt="NuGet"></a> | ||
<a href="https://www.nuget.org/packages/Libplanet.Analyzers/"><img src="https://img.shields.io/nuget/vpre/Libplanet.Analyzers.svg?style=flat" alt="NuGet (prerelease)"></a></p> | ||
<p>This Roslyn analyzer checks if code has common mistakes prone to made with | ||
Libplanet-powered game apps. E.g., breaking determinism in <code>IAction</code> | ||
implementations.</p> | ||
<pre><code class="lang-xml"><!-- The below Version attribute should match to your Libplanet's version. --> | ||
<PackageReference Include="Libplanet.Analyzers" Version="0.0.0"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
</code></pre> | ||
<p>If you want to check your script on Unity editor:</p> | ||
<ul> | ||
<li>Ensure you use Unity 2020.2 or higher.</li> | ||
<li>Read the official docs: <a href="https://docs.unity3d.com/2020.2/Documentation/Manual/roslyn-analyzers.html"><em>Roslyn analyzers and ruleset files</em></a>.</li> | ||
</ul> | ||
<h2 id="rules">Rules</h2> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>Rule</th> | ||
<th></th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td><a href="rules/LAA1001.html">LAA1001</a></td> | ||
<td>SystemRandomBreaksActionDeterminism</td> | ||
</tr> | ||
<tr> | ||
<td><a href="rules/LAA1002.html">LAA1002</a></td> | ||
<td>DictionariesOrSetsShouldBeOrderedToEnumerate</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</article> | ||
</div> | ||
|
||
<div class="hidden-sm col-md-2" role="complementary"> | ||
<div class="sideaffix"> | ||
<div class="contribution"> | ||
<ul class="nav"> | ||
<li> | ||
<a href="https://github.com/planetarium/libplanet/blob/4.0.6/Libplanet.Analyzers/README.md/#L1" class="contribution-link">Improve this Doc</a> | ||
</li> | ||
</ul> | ||
</div> | ||
<nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix"> | ||
<h5>In This Article</h5> | ||
<div></div> | ||
</nav> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<footer> | ||
<div class="grad-bottom"></div> | ||
<div class="footer"> | ||
<div class="container"> | ||
<span class="pull-right"> | ||
<a href="#top">Back to top</a> | ||
</span> | ||
Copyright © 2018–2023 <a href="https://planetariumhq.com/">Planetarium</a> | ||
|
||
</div> | ||
</div> | ||
</footer> | ||
</div> | ||
|
||
<script type="text/javascript" src="../styles/docfx.vendor.js"></script> | ||
<script type="text/javascript" src="../styles/docfx.js"></script> | ||
<script type="text/javascript" src="../styles/main.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
<!DOCTYPE html> | ||
<!--[if IE]><![endif]--> | ||
<html> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
<title>LAA1001: SystemRandomBreaksActionDeterminism | Libplanet </title> | ||
<meta name="viewport" content="width=device-width"> | ||
<meta name="title" content="LAA1001: SystemRandomBreaksActionDeterminism | Libplanet "> | ||
|
||
<link rel="shortcut icon" href="../../images/favicon.ico"> | ||
<link rel="stylesheet" href="../../styles/docfx.vendor.css"> | ||
<link rel="stylesheet" href="../../styles/docfx.css"> | ||
<link rel="stylesheet" href="../../styles/main.css"> | ||
<meta property="docfx:navrel" content="../../toc.html"> | ||
<meta property="docfx:tocrel" content="../../toc.html"> | ||
|
||
|
||
|
||
</head> | ||
<body data-spy="scroll" data-target="#affix" data-offset="120"> | ||
<div id="wrapper"> | ||
<header> | ||
|
||
<nav id="autocollapse" class="navbar navbar-inverse ng-scope" role="navigation"> | ||
<div class="container"> | ||
<div class="navbar-header"> | ||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar"> | ||
<span class="sr-only">Toggle navigation</span> | ||
<span class="icon-bar"></span> | ||
<span class="icon-bar"></span> | ||
<span class="icon-bar"></span> | ||
</button> | ||
|
||
<a class="navbar-brand" href="../../index.html"> | ||
<img id="logo" class="svg" src="../../images/logo.svg" alt=""> | ||
</a> | ||
</div> | ||
<div class="collapse navbar-collapse" id="navbar"> | ||
<form class="navbar-form navbar-right" role="search" id="search"> | ||
<div class="form-group"> | ||
<input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off"> | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
</nav> | ||
|
||
<div class="subnav navbar navbar-default"> | ||
<div class="container hide-when-search" id="breadcrumb"> | ||
<ul class="breadcrumb"> | ||
<li></li> | ||
</ul> | ||
</div> | ||
</div> | ||
</header> | ||
<div role="main" class="container body-content hide-when-search"> | ||
<div class="article row grid"> | ||
<div class="col-md-10"> | ||
<article class="content wrap" id="_content" data-uid=""> | ||
<h1 id="laa1001-systemrandombreaksactiondeterminism"><def>LAA1001</def>: SystemRandomBreaksActionDeterminism</h1> | ||
|
||
<p>Since random values derived from local system's seeds break <code>IAction</code>'s | ||
determinism, <code>IActionContext.Random</code> property should be used instead.</p> | ||
<h2 id="examples">Examples</h2> | ||
<p>The following code is warned by the rule LAA1001:</p> | ||
<pre><code class="lang-csharp">public IAccountStateDelta Execute(IActionContext context) | ||
{ | ||
var states = context.PreviousState; | ||
System.Random random = new System.Random(); // LAA1001 | ||
states.SetState(_targetAddress, (Bencodex.Types.Integer)random.Next()); | ||
return states; | ||
} | ||
</code></pre> | ||
<p>This can be addressed like below:</p> | ||
<pre><code class="lang-csharp">public IAccountStateDelta Execute(IActionContext context) | ||
{ | ||
var states = context.PreviousState; | ||
IRandom random = context.Random; // Fixed | ||
states.SetState(_targetAddress, (Bencodex.Types.Integer)random.Next()); | ||
return states; | ||
} | ||
</code></pre> | ||
</article> | ||
</div> | ||
|
||
<div class="hidden-sm col-md-2" role="complementary"> | ||
<div class="sideaffix"> | ||
<div class="contribution"> | ||
<ul class="nav"> | ||
<li> | ||
<a href="https://github.com/planetarium/libplanet/blob/4.0.6/Libplanet.Analyzers/rules/LAA1001.md/#L1" class="contribution-link">Improve this Doc</a> | ||
</li> | ||
</ul> | ||
</div> | ||
<nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix"> | ||
<h5>In This Article</h5> | ||
<div></div> | ||
</nav> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<footer> | ||
<div class="grad-bottom"></div> | ||
<div class="footer"> | ||
<div class="container"> | ||
<span class="pull-right"> | ||
<a href="#top">Back to top</a> | ||
</span> | ||
Copyright © 2018–2023 <a href="https://planetariumhq.com/">Planetarium</a> | ||
|
||
</div> | ||
</div> | ||
</footer> | ||
</div> | ||
|
||
<script type="text/javascript" src="../../styles/docfx.vendor.js"></script> | ||
<script type="text/javascript" src="../../styles/docfx.js"></script> | ||
<script type="text/javascript" src="../../styles/main.js"></script> | ||
</body> | ||
</html> |
Oops, something went wrong.