Documentation for 497d627ebd

This commit is contained in:
github-actions
2020-07-09 22:17:49 +00:00
parent d970449a19
commit 870ab60d2f
8 changed files with 178 additions and 109 deletions

View File

@@ -125,9 +125,88 @@ Code</h3>
<li>Strictly use snake_case (underscore_separated) in filenames.</li>
<li>If you have added or modified code, please make sure the code compiles before submitting.</li>
<li>Our automated testing runs <a href="https://github.com/cpplint/cpplint"><b>cpplint</b></a> on all pull requests so please be sure that your code passes before submitting.</li>
<li>Please conform to <a href="https://www.doxygen.nl/manual/docblocks.html">doxygen</a> standard and document the code as much as possible. This not only facilitates the readers but also generates the correct info on website.</li>
<li><b>Be consistent in use of these guidelines.</b></li>
</ul>
<h3><a class="anchor" id="autotoc_md6"></a>
Documentation</h3>
<ul>
<li>Make sure you put useful comments in your code. Do not comment things that are obvious.</li>
<li>Please avoid creating new directories if at all possible. Try to fit your work into the existing directory structure. If you want to create a new directory, then please check if a similar category has been recently suggested or created by other pull requests.</li>
<li>If you have modified/added documentation, please ensure that your language is concise and contains no grammar errors.</li>
<li>Do not update README.md along with other changes, first create an issue and then link to that issue in your pull request to suggest specific changes required to README.md</li>
<li>The repository follows <a href="https://www.doxygen.nl/manual/docblocks.html">Doxygen</a> standards and auto-generates the <a href="https://thealgorithms.github.io/C-Plus-Plus">repo website</a>. Please ensure the code is documented in this structure. Sample implementation is given below.</li>
</ul>
<h3><a class="anchor" id="autotoc_md7"></a>
Test</h3>
<ul>
<li>Make sure to add examples and test cases in your <a class="el" href="../../d7/db9/hill__cipher_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main()</a> function.</li>
<li>If you find any algorithm or document without tests, please feel free to create a pull request or issue describing suggested changes.</li>
<li>Please try to add one or more <code><a class="el" href="../../d4/d5d/math_2armstrong__number_8cpp.html#ae1a3968e7947464bee7714f6d43b7002">test()</a></code> functions that will invoke the algorithm implementation on random test data with expected output. Use <code>assert()</code> function to confirm that the tests will pass.</li>
</ul>
<h3><a class="anchor" id="autotoc_md8"></a>
Typical structure of a program:</h3>
<div class="fragment"><div class="line"><span class="comment">/**</span></div>
<div class="line"><span class="comment"> * @file </span></div>
<div class="line"><span class="comment"> * @brief Add one line description here</span></div>
<div class="line"><span class="comment"> * @details </span></div>
<div class="line"><span class="comment"> * This is a multi line</span></div>
<div class="line"><span class="comment"> * description containing links, references,</span></div>
<div class="line"><span class="comment"> * math equations, etc</span></div>
<div class="line"><span class="comment"> * @author [Name](https://github.com/handle)</span></div>
<div class="line"><span class="comment"> * @see related_file.cpp, another_file.cpp</span></div>
<div class="line"><span class="comment"> */</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#include </span></div>
<div class="line"><span class="comment"></span> </div>
<div class="line"><span class="comment">/** </span></div>
<div class="line"><span class="comment"> * @namespace &lt;check from other files in this repo&gt;</span></div>
<div class="line"><span class="comment"> */</span></div>
<div class="line"><span class="keyword">namespace </span>name {</div>
<div class="line"><span class="comment"></span> </div>
<div class="line"><span class="comment">/**</span></div>
<div class="line"><span class="comment"> * Class documentation</span></div>
<div class="line"><span class="comment"> */</span></div>
<div class="line"><span class="keyword">class </span>cls_name{</div>
<div class="line"> <span class="keyword">private</span>:</div>
<div class="line"> <span class="keywordtype">int</span> var1; <span class="comment">///&lt; short info of this variable</span></div>
<div class="line"><span class="comment"></span> <span class="keywordtype">char</span> *msg; <span class="comment">///&lt; short info</span></div>
<div class="line"><span class="comment"></span> </div>
<div class="line"> <span class="keyword">public</span>:</div>
<div class="line"> <span class="comment">// other members also documented as below</span></div>
<div class="line">}</div>
<div class="line"><span class="comment"></span> </div>
<div class="line"><span class="comment">/**</span></div>
<div class="line"><span class="comment"> * Function documentation </span></div>
<div class="line"><span class="comment"> * @tparam T this is a one-line info about T</span></div>
<div class="line"><span class="comment"> * @param param1 on-line info about param1</span></div>
<div class="line"><span class="comment"> * @param param2 on-line info about param2</span></div>
<div class="line"><span class="comment"> * @returns `true` if ...</span></div>
<div class="line"><span class="comment"> * @returns `false` if ... </span></div>
<div class="line"><span class="comment"> */</span></div>
<div class="line"><span class="keyword">template</span>&lt;<span class="keyword">class</span> T&gt;</div>
<div class="line"><span class="keywordtype">bool</span> func(<span class="keywordtype">int</span> param1, T param2) {</div>
<div class="line"> <span class="comment">// function statements here </span></div>
<div class="line"> <span class="keywordflow">if</span>(<span class="comment">/*something bad*/</span>)</div>
<div class="line"> <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"> </div>
<div class="line"> <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line">}</div>
<div class="line"><span class="comment"></span> </div>
<div class="line"><span class="comment">/** Test function */</span></div>
<div class="line"><span class="keywordtype">void</span> <a class="code" href="../../d4/d5d/math_2armstrong__number_8cpp.html#ae1a3968e7947464bee7714f6d43b7002">test</a>() {</div>
<div class="line"> <span class="comment">/* some statements */</span></div>
<div class="line"> assert(func(...) == ...); <span class="comment">// this ensures that the algorithm works as expected </span></div>
<div class="line"> </div>
<div class="line"> <span class="comment">// can have multiple checks</span></div>
<div class="line">}</div>
<div class="line"><span class="comment"></span> </div>
<div class="line"><span class="comment">/** Main function */</span></div>
<div class="line"><span class="keywordtype">int</span> <a class="code" href="../../d7/db9/hill__cipher_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a>(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> *argv[]) {</div>
<div class="line"> <span class="comment">// code here</span></div>
<div class="line"> <span class="keywordflow">return</span> 0;</div>
<div class="line">}</div>
</div><!-- fragment --><h3><a class="anchor" id="autotoc_md9"></a>
New File Name guidelines</h3>
<ul>
<li>Use lowercase words with <code>"_"</code> as separator</li>
@@ -137,7 +216,7 @@ New File Name guidelines</h3>
<li>It will be used to dynamically create a directory of files and implementation.</li>
<li>File name validation will run on docker to ensure the validity.</li>
</ul>
<h3><a class="anchor" id="autotoc_md7"></a>
<h3><a class="anchor" id="autotoc_md10"></a>
New Directory guidelines</h3>
<ul>
<li>We recommend adding files to existing directories as much as possible.</li>
@@ -148,7 +227,7 @@ New Directory guidelines</h3>
<li>Filepaths will be used to dynamically create a directory of our algorithms.</li>
<li>Filepath validation will run on GitHub Actions to ensure compliance.</li>
</ul>
<h3><a class="anchor" id="autotoc_md8"></a>
<h3><a class="anchor" id="autotoc_md11"></a>
Commit Guidelines</h3>
<ul>
<li>It is recommended to keep your changes grouped logically within individual commits. Maintainers find it easier to understand changes that are logically spilt across multiple commits. Try to modify just one or two files in the same directory. Pull requests that span multiple directories are often rejected. <div class="fragment"><div class="line">git add file_xyz.cpp</div>
@@ -165,26 +244,12 @@ Commit Guidelines</h3>
<li>docs: Documentation changes</li>
<li>test: Correct existing tests or add new ones</li>
</ul>
<h3><a class="anchor" id="autotoc_md9"></a>
Documentation</h3>
<ul>
<li>Make sure you put useful comments in your code. Do not comment things that are obvious.</li>
<li>Please avoid creating new directories if at all possible. Try to fit your work into the existing directory structure. If you want to create a new directory, then please check if a similar category has been recently suggested or created by other pull requests.</li>
<li>If you have modified/added documentation, please ensure that your language is concise and contains no grammar errors.</li>
<li>Do not update README.md along with other changes, first create an issue and then link to that issue in your pull request to suggest specific changes required to README.md</li>
</ul>
<h3><a class="anchor" id="autotoc_md10"></a>
Test</h3>
<ul>
<li>Make sure to add examples and test cases in your <a class="el" href="../../d7/db9/hill__cipher_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main()</a> function.</li>
<li>If you find any algorithm or document without tests, please feel free to create a pull request or issue describing suggested changes.</li>
</ul>
<h2><a class="anchor" id="autotoc_md11"></a>
<h2><a class="anchor" id="autotoc_md12"></a>
Pull Requests</h2>
<ul>
<li>Checkout our <a href="https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/.github/pull_request_template.md">pull request template</a></li>
</ul>
<h3><a class="anchor" id="autotoc_md12"></a>
<h3><a class="anchor" id="autotoc_md13"></a>
cpplint</h3>
<p>To see if <a href="https://github.com/cpplint/cpplint"><b>cpplint</b></a> is already installed, do:</p><ul>
<li><code>cpplint --version</code> # currently returns "cpplint 1.4.4" If cpplint is ___not___ installed then do:</li>
@@ -203,6 +268,8 @@ cpplint</h3>
</div></div><!-- contents -->
</div><!-- PageDoc -->
</div><!-- doc-content -->
<div class="ttc" id="ahill__cipher_8cpp_html_ae66f6b31b5ad750f1fe042a706a4e3d4"><div class="ttname"><a href="../../d7/db9/hill__cipher_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a></div><div class="ttdeci">int main()</div><div class="ttdef"><b>Definition:</b> hill_cipher.cpp:532</div></div>
<div class="ttc" id="amath_2armstrong__number_8cpp_html_ae1a3968e7947464bee7714f6d43b7002"><div class="ttname"><a href="../../d4/d5d/math_2armstrong__number_8cpp.html#ae1a3968e7947464bee7714f6d43b7002">test</a></div><div class="ttdeci">void test()</div><div class="ttdef"><b>Definition:</b> armstrong_number.cpp:59</div></div>
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>