Skip to content

Commit

Permalink
Automatic update of developer site
Browse files Browse the repository at this point in the history
  • Loading branch information
mantid-builder committed Jan 30, 2025
1 parent 60e19e3 commit e81c689
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Standards/CPPModernization.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ <h3>Navigation</h3>
<div class="body col-md-12 content" role="main">

<section id="c-code-modernization-guidelines">
<span id="cppmordernization"></span><h1>C++ Code Modernization Guidelines<a class="headerlink" href="#c-code-modernization-guidelines" title="Link to this heading"></a></h1>
<span id="cppmodernization"></span><h1>C++ Code Modernization Guidelines<a class="headerlink" href="#c-code-modernization-guidelines" title="Link to this heading"></a></h1>
<p>Whenever editing code, try to follow the “Boy Scout Rule”, i.e., leave code surrounding your in a better state than before.
For Mantid in particular, pay attention to the following:</p>
<ul class="simple">
Expand Down
65 changes: 65 additions & 0 deletions Standards/CPPStandards.html
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ <h3>Navigation</h3>
<li><p><a class="reference internal" href="#expressions-and-statements" id="id14">Expressions and Statements</a></p></li>
<li><p><a class="reference internal" href="#comments" id="id15">Comments</a></p></li>
<li><p><a class="reference internal" href="#error-handling" id="id16">Error Handling</a></p></li>
<li><p><a class="reference internal" href="#cppcheck" id="id17">Cppcheck</a></p>
<ul>
<li><p><a class="reference internal" href="#suppressions-file" id="id18">Suppressions File</a></p></li>
<li><p><a class="reference internal" href="#suppressing-false-positives" id="id19">Suppressing False Positives</a></p></li>
</ul>
</li>
</ul>
</nav>
<section id="references">
Expand Down Expand Up @@ -510,6 +516,65 @@ <h2><a class="toc-backref" href="#id16" role="doc-backlink">Error Handling</a><a
</li>
</ol>
</section>
<section id="cppcheck">
<h2><a class="toc-backref" href="#id17" role="doc-backlink">Cppcheck</a><a class="headerlink" href="#cppcheck" title="Link to this heading"></a></h2>
<p>Cppcheck analyses all C++ code in the project to locate undefined behavior
and poor coding practices. Updates to Cppcheck result in such a large number of
these potential problems being found that it is impractical to solve them all
in the Pull Request where the update takes place.</p>
<section id="suppressions-file">
<h3><a class="toc-backref" href="#id18" role="doc-backlink">Suppressions File</a><a class="headerlink" href="#suppressions-file" title="Link to this heading"></a></h3>
<p>When Cppcheck is updated, a suppressions file will be created using the
suppressions file generator script, <code class="docutils literal notranslate"><span class="pre">generate_cppcheck_suppressions_list.py</span></code>.</p>
<p>This file, <code class="docutils literal notranslate"><span class="pre">CppCheck_Suppressions.txt.in</span></code>, contains a list of all the problems
that Cppcheck found in the codebase. It has two functions:</p>
<ul class="simple">
<li><p>Suppress all errors for problems that are known to be entirely or
almost-entirely false positives.</p></li>
<li><p>Act as a to-do list for any remaining problems that should be fixed when found
during normal development.</p></li>
</ul>
<p>When modifying a <code class="docutils literal notranslate"><span class="pre">.cpp</span></code> file, it is likely that changes in line numbers will
cause once-suppressed errors to trigger again. Similar to the rules in
<a class="reference internal" href="CPPModernization.html#cppmodernization"><span class="std std-ref">C++ Code Modernization Guidelines</span></a>, these issues should be fixed as part of the same unit
of work that revealed them.</p>
</section>
<section id="suppressing-false-positives">
<h3><a class="toc-backref" href="#id19" role="doc-backlink">Suppressing False Positives</a><a class="headerlink" href="#suppressing-false-positives" title="Link to this heading"></a></h3>
<p>Occasionally Cppcheck will incorrectly identify problems that cannot or should
not be fixed.</p>
<p>In order to allow the suppressions file to function as a to-do list of fixes and
to reduce developer time spent looking for solutions that have already been
considered, false positives should be suppressed inline.</p>
<p>Inline suppressions must be accompanied by a comment explaining why the problem
was suppressed rather than fixed. This comment also allows future developers to
determine if the suppressions can be removed when the code around them changes.</p>
<p>Reviewers and gatekeepers should give these comments additional attention.</p>
<div class="admonition attention">
<p class="admonition-title">Attention</p>
<p>Inline suppressions are a last resort. You should be sure that a suppression
cannot be fixed by modifying the code before suppressing it using the
techniques below.</p>
</div>
<p><strong>Suppressing a single line of code:</strong></p>
<div class="highlight-c++ notranslate"><div class="highlight"><pre><span></span><span class="c1">// cppcheck-suppress arrayIndexOutOfBounds</span>
<span class="n">sizeFourArray</span><span class="p">[</span><span class="mi">5</span><span class="p">]</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">0</span><span class="p">;</span>
</pre></div>
</div>
<p><strong>Suppressing multiple errors on a single line:</strong></p>
<div class="highlight-c++ notranslate"><div class="highlight"><pre><span></span><span class="c1">// cppcheck-suppress [arrayIndexOutOfBounds,zeroDiv]</span>
<span class="n">sizeFourArray</span><span class="p">[</span><span class="mi">5</span><span class="p">]</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">1</span><span class="w"> </span><span class="o">/</span><span class="w"> </span><span class="mi">0</span><span class="p">;</span>
</pre></div>
</div>
<p><strong>Suppressing multiple lines:</strong></p>
<div class="highlight-c++ notranslate"><div class="highlight"><pre><span></span><span class="c1">// cppcheck-suppress-begin arrayIndexOutOfBounds</span>
<span class="n">sizeFourArray</span><span class="p">[</span><span class="mi">5</span><span class="p">]</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">0</span><span class="p">;</span>
<span class="n">sizeFiveArray</span><span class="p">[</span><span class="mi">5</span><span class="p">]</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">1</span><span class="p">;</span>
<span class="c1">// cppcheck-suppress-end arrayIndexOutOfBounds</span>
</pre></div>
</div>
</section>
</section>
</section>


Expand Down
4 changes: 2 additions & 2 deletions Testing/Inelastic/CorrectionsTests.html
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ <h2><a class="toc-backref" href="#id2" role="doc-backlink">Calculate Monte Carlo
<ol class="arabic simple">
<li><p>Go to <code class="docutils literal notranslate"><span class="pre">Interfaces</span></code> &gt; <code class="docutils literal notranslate"><span class="pre">Inelastic</span></code> &gt; <code class="docutils literal notranslate"><span class="pre">Corrections</span></code></p></li>
<li><p>Go to the <code class="docutils literal notranslate"><span class="pre">Calculate</span> <span class="pre">Monte</span> <span class="pre">Carlo</span> <span class="pre">Absorption</span></code> tab</p></li>
<li><p>With the Sample combo box set to <code class="docutils literal notranslate"><span class="pre">File</span></code> click browse and select the file <code class="docutils literal notranslate"><span class="pre">irs26176_graphite002_red</span></code> from the Sample Data folder</p></li>
<li><p>With the Input Workspace set to <code class="docutils literal notranslate"><span class="pre">File</span></code> click browse and select the file <code class="docutils literal notranslate"><span class="pre">irs26176_graphite002_red</span></code> from the Sample Data folder</p></li>
<li><p>Choose the Sample Shape to be <code class="docutils literal notranslate"><span class="pre">Flat</span> <span class="pre">Plate</span></code></p></li>
<li><p>Sample Height &amp; Width should be <code class="docutils literal notranslate"><span class="pre">1.0</span></code></p></li>
<li><p>Sample and Container Thickness should be <code class="docutils literal notranslate"><span class="pre">0.1</span></code></p></li>
<li><p>Sample Thickness, Container Front Thickness and Container Back Thickness should be <code class="docutils literal notranslate"><span class="pre">0.1</span></code></p></li>
<li><p>Sample mass density should be <code class="docutils literal notranslate"><span class="pre">1.0</span></code>. The Sample formula should be <code class="docutils literal notranslate"><span class="pre">H2-O</span></code></p></li>
<li><p>Container mass density should be <code class="docutils literal notranslate"><span class="pre">6.0</span></code>. The Container formula should be <code class="docutils literal notranslate"><span class="pre">V</span></code></p></li>
<li><p>Click <code class="docutils literal notranslate"><span class="pre">Run</span></code> and wait.</p></li>
Expand Down
2 changes: 1 addition & 1 deletion Testing/Inelastic/QENSFittingTests.html
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ <h2><a class="toc-backref" href="#id3" role="doc-backlink">I(Q, T) tab</a><a cla
<li><p>Click <code class="docutils literal notranslate"><span class="pre">Run</span></code>; the plot should update and new workspaces are created in the main Mantid GUI</p></li>
<li><p>Try the various <code class="docutils literal notranslate"><span class="pre">Plot</span></code> options in the interface</p>
<ol class="loweralpha simple">
<li><p><code class="docutils literal notranslate"><span class="pre">Output</span></code> drop-down set to All and click <code class="docutils literal notranslate"><span class="pre">Plot</span></code> - should give 5 separate plots</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">Output</span></code> drop-down set to All and click <code class="docutils literal notranslate"><span class="pre">Plot</span></code> - should give 5 separate plots per input spectra</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">Plot</span> <span class="pre">Current</span> <span class="pre">Preview</span></code> - should result in a plot with three datasets</p></li>
<li><p>Enable the <code class="docutils literal notranslate"><span class="pre">Plot</span> <span class="pre">Guess</span></code> checkbox - should not change anything, but should not break anything either!</p></li>
</ol>
Expand Down
Binary file modified objects.inv
Binary file not shown.
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

0 comments on commit e81c689

Please sign in to comment.