Sick Gaming
[Tut] Best Solidity Linter - Printable Version

+- Sick Gaming (https://www.sickgaming.net)
+-- Forum: Programming (https://www.sickgaming.net/forum-76.html)
+--- Forum: Python (https://www.sickgaming.net/forum-83.html)
+--- Thread: [Tut] Best Solidity Linter (/thread-99788.html)



[Tut] Best Solidity Linter - xSicKxBot - 08-10-2022

Best Solidity Linter

<div>
<div class="kk-star-ratings kksr-auto kksr-align-left kksr-valign-top" data-payload="{&quot;align&quot;:&quot;left&quot;,&quot;id&quot;:&quot;550693&quot;,&quot;slug&quot;:&quot;default&quot;,&quot;valign&quot;:&quot;top&quot;,&quot;reference&quot;:&quot;auto&quot;,&quot;class&quot;:&quot;&quot;,&quot;count&quot;:&quot;0&quot;,&quot;readonly&quot;:&quot;&quot;,&quot;score&quot;:&quot;0&quot;,&quot;best&quot;:&quot;5&quot;,&quot;gap&quot;:&quot;5&quot;,&quot;greet&quot;:&quot;Rate this post&quot;,&quot;legend&quot;:&quot;0\/5 - (0 votes)&quot;,&quot;size&quot;:&quot;24&quot;,&quot;width&quot;:&quot;0&quot;,&quot;_legend&quot;:&quot;{score}\/{best} - ({count} {votes})&quot;,&quot;font_factor&quot;:&quot;1.25&quot;}">
<div class="kksr-stars">
<div class="kksr-stars-inactive">
<div class="kksr-star" data-star="1" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" data-star="2" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" data-star="3" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" data-star="4" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" data-star="5" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
</p></div>
<div class="kksr-stars-active" style="width: 0px;">
<div class="kksr-star" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
</p></div>
</div>
<div class="kksr-legend" style="font-size: 19.2px;"> <span class="kksr-muted">Rate this post</span> </div>
</div>
<p class="has-global-color-8-background-color has-background"><img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4a1.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /> A <strong>code linter</strong> is a static code analysis tool to find programming errors, bugs, style mistakes, and suspicious constructs. </p>
<p>The best Solidity Linter is Ethlint with a close second Solhint. Most other linters are not well qualified to compete with those early tools!</p>
<h2>Solidity Linter #1 – Ethlint</h2>
<div class="wp-block-image">
<figure class="aligncenter size-full"><a href="https://www.npmjs.com/package/ethlint" target="_blank" rel="noreferrer noopener"><img loading="lazy" width="500" height="300" src="https://blog.finxter.com/wp-content/uploads/2022/08/image-4.png" alt="" class="wp-image-550709" srcset="https://blog.finxter.com/wp-content/uploads/2022/08/image-4.png 500w, https://blog.finxter.com/wp-content/uploads/2022/08/image-4-300x180.png 300w" sizes="(max-width: 500px) 100vw, 500px" /></a></figure>
</div>
<p><a href="https://www.npmjs.com/package/ethlint" data-type="URL" data-id="https://www.npmjs.com/package/ethlint" target="_blank" rel="noreferrer noopener">Ethlint</a> comes with the popular slogan <em>“yet another Solidity linting tool”</em>.</p>
<p>I think the name is not well chosen because, due the fact that Solidity is super young, there is not a swamp of linting tools available, yet.</p>
<p>You can install it using the following expression:</p>
<pre class="wp-block-preformatted"><code>npm install -g solhint</code></pre>
<p>Here’s how you’d run this:</p>
<pre class="wp-block-preformatted"><code>solhint [options] &lt;file> […other_files]</code></pre>
<p class="has-global-color-8-background-color has-background"><img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4a1.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Learn More</strong>: <a href="https://www.npmjs.com/package/ethlint" data-type="URL" data-id="https://www.npmjs.com/package/ethlint" target="_blank" rel="noreferrer noopener">Ethlint Linting Tool</a></p>
<h2>Solidity Linter #2 – Solhint </h2>
<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" width="300" height="85" src="https://blog.finxter.com/wp-content/uploads/2022/08/image-5.png" alt="" class="wp-image-550712"/></figure>
</div>
<p><a href="https://github.com/protofire/solhint" data-type="URL" data-id="https://github.com/protofire/solhint" target="_blank" rel="noreferrer noopener">Solhint</a> is a linter for Solidity that provides security and a style guide validations.</p>
<p>You can install the Linter using this command:</p>
<pre class="wp-block-preformatted"><code>npm install -g ethlintsolium -V</code></pre>
<p>After initial configuration, the execution is as simple as running this command in your shell:</p>
<pre class="wp-block-preformatted"><code>> npm run solhint</code></pre>
<p class="has-global-color-8-background-color has-background"><img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4a1.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Learn More</strong>:<a href="https://github.com/protofire/solhint"> Solhint L</a><a href="https://github.com/protofire/solhint" target="_blank" rel="noreferrer noopener">inting Tool</a></p>
<p>I would recommend more but I think those are the two best tools at this point.</p>
<p>If you want to learn Soldity, I’d applause you because this means you rely less on Linters (a goal worth pursuing)! <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f642.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>You can check out our in-depth tutorial here:</p>
<h2><a href="https://academy.finxter.com/university/solidity-basics/" target="_blank" rel="noreferrer noopener" title="https://academy.finxter.com/university/solidity-basics/">Learn Solidity Course</a></h2>
<p>Solidity is the programming language of the future.</p>
<p>It gives you the rare and sought-after superpower to program against the “Internet Computer”, i.e., against decentralized Blockchains such as <em>Ethereum</em>, <em>Binance Smart Chain</em>, <em>Ethereum Classic</em>, <em>Tron</em>, and <em>Avalanche </em>– to mention just a few Blockchain infrastructures that support Solidity.</p>
<p>In particular, Solidity allows you to<em> create smart contracts</em>, i.e., pieces of code that automatically execute on specific conditions in a completely decentralized environment. For example, smart contracts empower you to create your own <em>decentralized autonomous organizations</em> (DAOs) that run on Blockchains without being subject to centralized control.</p>
<p>NFTs, DeFi, DAOs, and Blockchain-based games are all based on smart contracts.</p>
<p><a href="https://academy.finxter.com/university/solidity-basics/" target="_blank" rel="noreferrer noopener" title="https://academy.finxter.com/university/solidity-basics/">This course</a> is a simple, low-friction introduction to creating your first smart contract using the Remix IDE on the Ethereum testnet – without fluff, significant upfront costs to purchase ETH, or unnecessary complexity.</p>
<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><a href="https://academy.finxter.com/university/solidity-basics/" target="_blank" rel="noopener"><img loading="lazy" src="https://blog.finxter.com/wp-content/uploads/2021/10/image-121.png" alt="" class="wp-image-37299" width="491" height="287" srcset="https://blog.finxter.com/wp-content/uploads/2021/10/image-121.png 982w, https://blog.finxter.com/wp-content/uploads/2021/10/image-121-300x175.png 300w, https://blog.finxter.com/wp-content/uploads/2021/10/image-121-768x448.png 768w" sizes="(max-width: 491px) 100vw, 491px" /></a></figure>
</div>
</div>


https://www.sickgaming.net/blog/2022/08/06/best-solidity-linter/