<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ro">
	<id>http://wiki.dcae.pub.ro/index.php?action=history&amp;feed=atom&amp;title=SDPT_Lab_7</id>
	<title>SDPT Lab 7 - Revizia istoricului</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.dcae.pub.ro/index.php?action=history&amp;feed=atom&amp;title=SDPT_Lab_7"/>
	<link rel="alternate" type="text/html" href="http://wiki.dcae.pub.ro/index.php?title=SDPT_Lab_7&amp;action=history"/>
	<updated>2026-05-06T03:50:48Z</updated>
	<subtitle>Istoricul versiunilor pentru această pagină din wiki</subtitle>
	<generator>MediaWiki 1.35.14</generator>
	<entry>
		<id>http://wiki.dcae.pub.ro/index.php?title=SDPT_Lab_7&amp;diff=8339&amp;oldid=prev</id>
		<title>Rhobincu: /* Tasks */</title>
		<link rel="alternate" type="text/html" href="http://wiki.dcae.pub.ro/index.php?title=SDPT_Lab_7&amp;diff=8339&amp;oldid=prev"/>
		<updated>2026-04-27T00:11:16Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Tasks&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ro&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Versiunea anterioară&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Versiunea de la data 27 aprilie 2026 00:11&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l24&quot; &gt;Linia 24:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Linia 24:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# &amp;#039;&amp;#039;&amp;#039;Extend the build environment.&amp;#039;&amp;#039;&amp;#039; Update your &amp;lt;code&amp;gt;Dockerfile&amp;lt;/code&amp;gt; so the image installs both &amp;lt;code&amp;gt;cppcheck&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;clang-tidy&amp;lt;/code&amp;gt;. Rebuild the image and verify both binaries respond to &amp;lt;code&amp;gt;--version&amp;lt;/code&amp;gt; from inside a container. If your runner pulls the image from a registry, push the new tag.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# &amp;#039;&amp;#039;&amp;#039;Extend the build environment.&amp;#039;&amp;#039;&amp;#039; Update your &amp;lt;code&amp;gt;Dockerfile&amp;lt;/code&amp;gt; so the image installs both &amp;lt;code&amp;gt;cppcheck&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;clang-tidy&amp;lt;/code&amp;gt;. Rebuild the image and verify both binaries respond to &amp;lt;code&amp;gt;--version&amp;lt;/code&amp;gt; from inside a container. If your runner pulls the image from a registry, push the new tag.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# &amp;#039;&amp;#039;&amp;#039;Configure clang-tidy.&amp;#039;&amp;#039;&amp;#039; Create &amp;lt;code&amp;gt;.clang-tidy&amp;lt;/code&amp;gt; at the repository root. You must enable, at a minimum, the entire &amp;lt;code&amp;gt;bugprone-*&amp;lt;/code&amp;gt; family and at least two specific checks from &amp;lt;code&amp;gt;cppcoreguidelines-*&amp;lt;/code&amp;gt;. You must explicitly disable any check from those families that fires noisily on your existing code (e.g. some &amp;lt;code&amp;gt;readability-identifier-length&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;cppcoreguidelines-pro-bounds-*&amp;lt;/code&amp;gt; checks are commonly muted in embedded code). Set &amp;lt;code&amp;gt;WarningsAsErrors&amp;lt;/code&amp;gt; so any reported issue fails the build. Add a comment block at the top of the file explaining the rationale for your check selection --- this is part of the deliverable.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# &amp;#039;&amp;#039;&amp;#039;Configure clang-tidy.&amp;#039;&amp;#039;&amp;#039; Create &amp;lt;code&amp;gt;.clang-tidy&amp;lt;/code&amp;gt; at the repository root. You must enable, at a minimum, the entire &amp;lt;code&amp;gt;bugprone-*&amp;lt;/code&amp;gt; family and at least two specific checks from &amp;lt;code&amp;gt;cppcoreguidelines-*&amp;lt;/code&amp;gt;. You must explicitly disable any check from those families that fires noisily on your existing code (e.g. some &amp;lt;code&amp;gt;readability-identifier-length&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;cppcoreguidelines-pro-bounds-*&amp;lt;/code&amp;gt; checks are commonly muted in embedded code). Set &amp;lt;code&amp;gt;WarningsAsErrors&amp;lt;/code&amp;gt; so any reported issue fails the build. Add a comment block at the top of the file explaining the rationale for your check selection --- this is part of the deliverable.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# &amp;#039;&amp;#039;&amp;#039;Wire clang-tidy into CMake.&amp;#039;&amp;#039;&amp;#039; Modify &amp;lt;code&amp;gt;CMakeLists.txt&amp;lt;/code&amp;gt; so that compile commands are exported and clang-tidy runs automatically on every C++ compile. Make sure the build still works for team members who do not have clang-tidy installed locally (hint: &amp;lt;code&amp;gt;find_program&amp;lt;/code&amp;gt; can return a NOTFOUND value, and you can branch on that).&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# &amp;#039;&amp;#039;&amp;#039;Wire clang-tidy into CMake.&amp;#039;&amp;#039;&amp;#039; Modify &amp;lt;code&amp;gt;CMakeLists.txt&amp;lt;/code&amp;gt; so that compile commands are exported and clang-tidy runs automatically on every C++ compile. Make sure the build still works for team members who do not have clang-tidy installed locally (hint: &amp;lt;code&amp;gt;find_program&amp;lt;/code&amp;gt; can return a NOTFOUND value, and you can branch on that).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# &amp;#039;&amp;#039;&amp;#039;Add a cppcheck custom target.&amp;#039;&amp;#039;&amp;#039; Define a CMake custom target named &amp;lt;code&amp;gt;cppcheck&amp;lt;/code&amp;gt; that runs the tool on your source tree. Required flags: at minimum &amp;lt;code&amp;gt;--enable=warning,style,performance,portability&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--error-exitcode=1&amp;lt;/code&amp;gt; (so it propagates failures), &amp;lt;code&amp;gt;--inline-suppr&amp;lt;/code&amp;gt; (so your inline suppressions are honored), and &amp;lt;code&amp;gt;--std=c++17&amp;lt;/code&amp;gt; (or whatever your project uses). Decide for yourself whether to scan or skip the build directory, the test directory, and any third-party code.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# &amp;#039;&amp;#039;&amp;#039;Add a cppcheck custom target.&amp;#039;&amp;#039;&amp;#039; Define a CMake custom target named &amp;lt;code&amp;gt;cppcheck&amp;lt;/code&amp;gt; that runs the tool on your source tree. Required flags: at minimum &amp;lt;code&amp;gt;--enable=warning,style,performance,portability&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--error-exitcode=1&amp;lt;/code&amp;gt; (so it propagates failures), &amp;lt;code&amp;gt;--inline-suppr&amp;lt;/code&amp;gt; (so your inline suppressions are honored), and &amp;lt;code&amp;gt;--std=c++17&amp;lt;/code&amp;gt; (or whatever your project uses). Decide for yourself whether to scan or skip the build directory, the test directory, and any third-party code.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# &amp;#039;&amp;#039;&amp;#039;Add the lint stage to GitLab CI.&amp;#039;&amp;#039;&amp;#039; Edit &amp;lt;code&amp;gt;.gitlab-ci.yml&amp;lt;/code&amp;gt; to add a new &amp;lt;code&amp;gt;lint&amp;lt;/code&amp;gt; stage as the first stage. Add a job that runs cppcheck inside your updated Docker image. The job must fail the pipeline on any cppcheck finding. clang-tidy itself does &amp;#039;&amp;#039;&amp;#039;not&amp;#039;&amp;#039;&amp;#039; need a separate CI job, since wiring it into &amp;lt;code&amp;gt;CMAKE_CXX_CLANG_TIDY&amp;lt;/code&amp;gt; means it already runs during your existing build job.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# &amp;#039;&amp;#039;&amp;#039;Add the lint stage to GitLab CI.&amp;#039;&amp;#039;&amp;#039; Edit &amp;lt;code&amp;gt;.gitlab-ci.yml&amp;lt;/code&amp;gt; to add a new &amp;lt;code&amp;gt;lint&amp;lt;/code&amp;gt; stage as the first stage. Add a job that runs cppcheck inside your updated Docker image. The job must fail the pipeline on any cppcheck finding. clang-tidy itself does &amp;#039;&amp;#039;&amp;#039;not&amp;#039;&amp;#039;&amp;#039; need a separate CI job, since wiring it into &amp;lt;code&amp;gt;CMAKE_CXX_CLANG_TIDY&amp;lt;/code&amp;gt; means it already runs during your existing build job.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# &amp;#039;&amp;#039;&amp;#039;Clean up your existing code.&amp;#039;&amp;#039;&amp;#039; Push your branch and let the pipeline run. If clang-tidy or cppcheck flags real issues in the Oven Controller, fix them properly. If you genuinely believe a finding is a false positive, suppress it inline with a justification comment --- but no more than two suppressions for this lab. Three or more suppressions almost always means you should fix the underlying problem instead.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# &amp;#039;&amp;#039;&amp;#039;Clean up your existing code.&amp;#039;&amp;#039;&amp;#039; Push your branch and let the pipeline run. If clang-tidy or cppcheck flags real issues in the Oven Controller, fix them properly. If you genuinely believe a finding is a false positive, suppress it inline with a justification comment --- but no more than two suppressions for this lab. Three or more suppressions almost always means you should fix the underlying problem instead.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# &amp;#039;&amp;#039;&amp;#039;Verify the gate fires.&amp;#039;&amp;#039;&amp;#039; Once the pipeline is fully green, introduce a deliberate bug on your branch. Pick something the tools should catch: a memory leak, a null pointer dereference, an uninitialized read, a forgotten &amp;lt;code&amp;gt;delete[]&amp;lt;/code&amp;gt;, a use-after-move, a buffer overflow. Push the bug, confirm the &amp;lt;code&amp;gt;lint&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;build&amp;lt;/code&amp;gt; stage fails, then preserve a copy of the relevant tool output (a job-log permalink in the MR description is sufficient). Revert the deliberate bug; your final pipeline must be green.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# &amp;#039;&amp;#039;&amp;#039;Verify the gate fires.&amp;#039;&amp;#039;&amp;#039; Once the pipeline is fully green, introduce a deliberate bug on your branch. Pick something the tools should catch: a memory leak, a null pointer dereference, an uninitialized read, a forgotten &amp;lt;code&amp;gt;delete[]&amp;lt;/code&amp;gt;, a use-after-move, a buffer overflow. Push the bug, confirm the &amp;lt;code&amp;gt;lint&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;build&amp;lt;/code&amp;gt; stage fails, then preserve a copy of the relevant tool output (a job-log permalink in the MR description is sufficient). Revert the deliberate bug; your final pipeline must be green.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# &amp;#039;&amp;#039;&amp;#039;Measure the cost.&amp;#039;&amp;#039;&amp;#039; Compare the wall-clock time of your full pipeline before and after this lab. Record both numbers and the percentage increase in the MR description, along with one sentence on whether the trade-off is worth it for this codebase. Be honest --- &amp;quot;the lint stage adds 4 minutes and we caught zero real bugs today&amp;quot; is a valid finding.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# &amp;#039;&amp;#039;&amp;#039;Measure the cost.&amp;#039;&amp;#039;&amp;#039; Compare the wall-clock time of your full pipeline before and after this lab. Record both numbers and the percentage increase in the MR description, along with one sentence on whether the trade-off is worth it for this codebase. Be honest --- &amp;quot;the lint stage adds 4 minutes and we caught zero real bugs today&amp;quot; is a valid finding.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# &amp;#039;&amp;#039;&amp;#039;Review and merge.&amp;#039;&amp;#039;&amp;#039; Open the MR and have a teammate review it. The reviewer should specifically check: the rationale comment in &amp;lt;code&amp;gt;.clang-tidy&amp;lt;/code&amp;gt;, that any suppression has a justification, the visibility of the deliberate-bug pipeline run, and the cost measurement. Merge when approved.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# &amp;#039;&amp;#039;&amp;#039;Review and merge.&amp;#039;&amp;#039;&amp;#039; Open the MR and have a teammate review it. The reviewer should specifically check: the rationale comment in &amp;lt;code&amp;gt;.clang-tidy&amp;lt;/code&amp;gt;, that any suppression has a justification, the visibility of the deliberate-bug pipeline run, and the cost measurement. Merge when approved.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Rhobincu</name></author>
	</entry>
	<entry>
		<id>http://wiki.dcae.pub.ro/index.php?title=SDPT_Lab_7&amp;diff=8338&amp;oldid=prev</id>
		<title>Rhobincu la 27 aprilie 2026 00:10</title>
		<link rel="alternate" type="text/html" href="http://wiki.dcae.pub.ro/index.php?title=SDPT_Lab_7&amp;diff=8338&amp;oldid=prev"/>
		<updated>2026-04-27T00:10:17Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;a href=&quot;http://wiki.dcae.pub.ro/index.php?title=SDPT_Lab_7&amp;amp;diff=8338&amp;amp;oldid=8337&quot;&gt;Afișare diferențe&lt;/a&gt;</summary>
		<author><name>Rhobincu</name></author>
	</entry>
	<entry>
		<id>http://wiki.dcae.pub.ro/index.php?title=SDPT_Lab_7&amp;diff=8337&amp;oldid=prev</id>
		<title>Rhobincu: Pagină nouă: = Week 7 Lab Activity: Adding a Static Analysis Quality Gate =  == Introduction ==  In Week 6, you built a CI pipeline that automatically compiles and tests your Oven Controller co...</title>
		<link rel="alternate" type="text/html" href="http://wiki.dcae.pub.ro/index.php?title=SDPT_Lab_7&amp;diff=8337&amp;oldid=prev"/>
		<updated>2026-04-26T23:58:09Z</updated>

		<summary type="html">&lt;p&gt;Pagină nouă: = Week 7 Lab Activity: Adding a Static Analysis Quality Gate =  == Introduction ==  In Week 6, you built a CI pipeline that automatically compiles and tests your Oven Controller co...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Pagină nouă&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Week 7 Lab Activity: Adding a Static Analysis Quality Gate =&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
In Week 6, you built a CI pipeline that automatically compiles and tests your Oven Controller code on every push. Today you will add a new stage that runs &amp;#039;&amp;#039;&amp;#039;before&amp;#039;&amp;#039;&amp;#039; the build: a &amp;lt;code&amp;gt;lint&amp;lt;/code&amp;gt; stage that uses static analysis to catch entire classes of bugs that the compiler and the unit tests cannot.&lt;br /&gt;
&lt;br /&gt;
By the end of this lab, you will have:&lt;br /&gt;
&lt;br /&gt;
# Extended your Docker build environment to include &amp;lt;code&amp;gt;cppcheck&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;clang-tidy&amp;lt;/code&amp;gt;.&lt;br /&gt;
# Created a &amp;lt;code&amp;gt;.clang-tidy&amp;lt;/code&amp;gt; configuration file at the root of your project.&lt;br /&gt;
# Hooked clang-tidy into every CMake compile via &amp;lt;code&amp;gt;CMAKE_CXX_CLANG_TIDY&amp;lt;/code&amp;gt;.&lt;br /&gt;
# Added a new &amp;lt;code&amp;gt;lint&amp;lt;/code&amp;gt; stage to your &amp;lt;code&amp;gt;.gitlab-ci.yml&amp;lt;/code&amp;gt; that runs cppcheck.&lt;br /&gt;
# Verified that introducing a deliberate bug causes the pipeline to fail and block a Merge Request.&lt;br /&gt;
# Fixed the deliberate bug and watched the pipeline turn green again.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
You should be starting from your finished Week 6 project, which has:&lt;br /&gt;
&lt;br /&gt;
* A working &amp;lt;code&amp;gt;CMakeLists.txt&amp;lt;/code&amp;gt; for the Oven Controller.&lt;br /&gt;
* A passing Google Test suite.&lt;br /&gt;
* A &amp;lt;code&amp;gt;Dockerfile&amp;lt;/code&amp;gt; producing a multi-arch build environment.&lt;br /&gt;
* A &amp;lt;code&amp;gt;.gitlab-ci.yml&amp;lt;/code&amp;gt; with at least &amp;lt;code&amp;gt;build&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;test&amp;lt;/code&amp;gt; stages running on a custom GitLab Runner.&lt;br /&gt;
&lt;br /&gt;
If any of those is missing or broken, fix it before continuing. Static analysis added on top of a broken pipeline does not help anyone.&lt;br /&gt;
&lt;br /&gt;
== Step 1: Create a Feature Branch ==&lt;br /&gt;
&lt;br /&gt;
As always, do &amp;#039;&amp;#039;&amp;#039;not&amp;#039;&amp;#039;&amp;#039; work on &amp;lt;code&amp;gt;main&amp;lt;/code&amp;gt;. Open an Issue first (&amp;quot;Add static analysis quality gate&amp;quot;) and then create a feature branch:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git checkout main&lt;br /&gt;
git pull&lt;br /&gt;
git checkout -b feature/static-analysis&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This branch will contain everything you do in this lab. At the end you will open a Merge Request just like in Week 2.&lt;br /&gt;
&lt;br /&gt;
== Step 2: Update the Dockerfile ==&lt;br /&gt;
&lt;br /&gt;
Open your &amp;lt;code&amp;gt;Dockerfile&amp;lt;/code&amp;gt; and add &amp;lt;code&amp;gt;cppcheck&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;clang-tidy&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;apt-get install&amp;lt;/code&amp;gt; line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUN apt-get update &amp;amp;&amp;amp; apt-get install -y \&lt;br /&gt;
    build-essential \&lt;br /&gt;
    cmake \&lt;br /&gt;
    g++-aarch64-linux-gnu \&lt;br /&gt;
    qemu-user-static \&lt;br /&gt;
    libgtest-dev \&lt;br /&gt;
    cppcheck \&lt;br /&gt;
    clang-tidy \&lt;br /&gt;
 &amp;amp;&amp;amp; rm -rf /var/lib/apt/lists/*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rebuild the image locally to make sure it still works:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
docker build -t oven-build:lint-test .&lt;br /&gt;
docker run --rm oven-build:lint-test cppcheck --version&lt;br /&gt;
docker run --rm oven-build:lint-test clang-tidy --version&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see version strings for both tools. If either command is &amp;quot;not found,&amp;quot; double-check the package names for your base image (Debian/Ubuntu use &amp;lt;code&amp;gt;cppcheck&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;clang-tidy&amp;lt;/code&amp;gt;; on minimal images you may need &amp;lt;code&amp;gt;clang-tools&amp;lt;/code&amp;gt; instead of &amp;lt;code&amp;gt;clang-tidy&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
== Step 3: Create the .clang-tidy Configuration File ==&lt;br /&gt;
&lt;br /&gt;
In the root of your repository (next to &amp;lt;code&amp;gt;CMakeLists.txt&amp;lt;/code&amp;gt;), create a new file named exactly &amp;lt;code&amp;gt;.clang-tidy&amp;lt;/code&amp;gt; (note the leading dot). Paste the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
---&lt;br /&gt;
Checks: &amp;gt;&lt;br /&gt;
  -*,&lt;br /&gt;
  bugprone-*,&lt;br /&gt;
  cert-*,&lt;br /&gt;
  clang-analyzer-*,&lt;br /&gt;
  cppcoreguidelines-pro-*,&lt;br /&gt;
  cppcoreguidelines-slicing,&lt;br /&gt;
  misc-unused-*,&lt;br /&gt;
  modernize-use-nullptr,&lt;br /&gt;
  modernize-use-override,&lt;br /&gt;
  modernize-use-nodiscard,&lt;br /&gt;
  performance-*,&lt;br /&gt;
  portability-*,&lt;br /&gt;
  readability-braces-around-statements,&lt;br /&gt;
  readability-misleading-indentation,&lt;br /&gt;
  readability-redundant-*,&lt;br /&gt;
  -bugprone-easily-swappable-parameters,&lt;br /&gt;
  -cppcoreguidelines-pro-bounds-pointer-arithmetic&lt;br /&gt;
&lt;br /&gt;
WarningsAsErrors: &amp;#039;*&amp;#039;&lt;br /&gt;
HeaderFilterRegex: &amp;#039;.*&amp;#039;&lt;br /&gt;
FormatStyle: &amp;#039;file&amp;#039;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A few notes on what this configuration does:&lt;br /&gt;
&lt;br /&gt;
* The first line &amp;lt;code&amp;gt;-*&amp;lt;/code&amp;gt; &amp;#039;&amp;#039;&amp;#039;disables&amp;#039;&amp;#039;&amp;#039; every check, then we re-enable specific families. This is the safer approach because clang-tidy ships hundreds of checks and many are too noisy.&lt;br /&gt;
* &amp;lt;code&amp;gt;WarningsAsErrors: &amp;#039;*&amp;#039;&amp;lt;/code&amp;gt; turns every remaining warning into an error. The pipeline will fail if any check fires.&lt;br /&gt;
* &amp;lt;code&amp;gt;HeaderFilterRegex: &amp;#039;.*&amp;#039;&amp;lt;/code&amp;gt; tells clang-tidy to also analyze the project&amp;#039;s headers (otherwise it skips them).&lt;br /&gt;
* The two trailing &amp;lt;code&amp;gt;-...&amp;lt;/code&amp;gt; entries &amp;#039;&amp;#039;&amp;#039;suppress&amp;#039;&amp;#039;&amp;#039; specific checks that produce too many false positives in embedded code.&lt;br /&gt;
&lt;br /&gt;
Commit this file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git add .clang-tidy&lt;br /&gt;
git commit -m &amp;quot;Add .clang-tidy configuration&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Step 4: Hook clang-tidy into CMake ==&lt;br /&gt;
&lt;br /&gt;
Open &amp;lt;code&amp;gt;CMakeLists.txt&amp;lt;/code&amp;gt; and add the following near the top, &amp;#039;&amp;#039;&amp;#039;after&amp;#039;&amp;#039;&amp;#039; the &amp;lt;code&amp;gt;project(...)&amp;lt;/code&amp;gt; line but &amp;#039;&amp;#039;&amp;#039;before&amp;#039;&amp;#039;&amp;#039; any &amp;lt;code&amp;gt;add_executable&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;add_library&amp;lt;/code&amp;gt; calls:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Generate compile_commands.json for tooling&lt;br /&gt;
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)&lt;br /&gt;
&lt;br /&gt;
# Enable clang-tidy on every compile&lt;br /&gt;
find_program(CLANG_TIDY_EXE NAMES clang-tidy)&lt;br /&gt;
if(CLANG_TIDY_EXE)&lt;br /&gt;
    set(CMAKE_CXX_CLANG_TIDY&lt;br /&gt;
        ${CLANG_TIDY_EXE}&lt;br /&gt;
        --config-file=${CMAKE_SOURCE_DIR}/.clang-tidy)&lt;br /&gt;
    message(STATUS &amp;quot;clang-tidy enabled: ${CLANG_TIDY_EXE}&amp;quot;)&lt;br /&gt;
else()&lt;br /&gt;
    message(WARNING &amp;quot;clang-tidy not found; lint disabled&amp;quot;)&lt;br /&gt;
endif()&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reason we wrap it in &amp;lt;code&amp;gt;if(CLANG_TIDY_EXE)&amp;lt;/code&amp;gt; is so that team members who do not have clang-tidy installed locally can still build. The CI environment &amp;#039;&amp;#039;&amp;#039;does&amp;#039;&amp;#039;&amp;#039; have it, so the pipeline will still enforce it.&lt;br /&gt;
&lt;br /&gt;
Test it locally:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm -rf build&lt;br /&gt;
docker run --rm -v $PWD:/work -w /work oven-build:lint-test \&lt;br /&gt;
    bash -c &amp;quot;cmake -B build &amp;amp;&amp;amp; cmake --build build&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see &amp;lt;code&amp;gt;-- clang-tidy enabled: /usr/bin/clang-tidy&amp;lt;/code&amp;gt; in the configure step, and during the build clang-tidy runs alongside the compiler. If your code is clean, the build still succeeds. If clang-tidy finds something, the build fails with a clang-tidy error message.&lt;br /&gt;
&lt;br /&gt;
== Step 5: Add a Cppcheck Custom Target ==&lt;br /&gt;
&lt;br /&gt;
cppcheck does not need CMake to drive it (it parses source directly), but adding a CMake target makes it convenient to run locally. Append this to &amp;lt;code&amp;gt;CMakeLists.txt&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Cppcheck target (optional locally, mandatory in CI)&lt;br /&gt;
find_program(CPPCHECK_EXE NAMES cppcheck)&lt;br /&gt;
if(CPPCHECK_EXE)&lt;br /&gt;
    add_custom_target(cppcheck&lt;br /&gt;
        COMMAND ${CPPCHECK_EXE}&lt;br /&gt;
            --enable=warning,style,performance,portability&lt;br /&gt;
            --inline-suppr&lt;br /&gt;
            --error-exitcode=1&lt;br /&gt;
            --suppress=missingIncludeSystem&lt;br /&gt;
            --std=c++17&lt;br /&gt;
            -I ${CMAKE_SOURCE_DIR}/include&lt;br /&gt;
            ${CMAKE_SOURCE_DIR}/src&lt;br /&gt;
        WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}&lt;br /&gt;
        COMMENT &amp;quot;Running cppcheck on src/&amp;quot;)&lt;br /&gt;
endif()&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adjust the &amp;lt;code&amp;gt;-I&amp;lt;/code&amp;gt; include path and the source path to match your project layout if it differs.&lt;br /&gt;
&lt;br /&gt;
You can now run cppcheck locally with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cmake --build build --target cppcheck&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If your code is clean, the command prints nothing and exits with status 0.&lt;br /&gt;
&lt;br /&gt;
Commit your CMake changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git add CMakeLists.txt Dockerfile&lt;br /&gt;
git commit -m &amp;quot;Wire clang-tidy and cppcheck into the build&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Step 6: Add the lint Stage to GitLab CI ==&lt;br /&gt;
&lt;br /&gt;
Open &amp;lt;code&amp;gt;.gitlab-ci.yml&amp;lt;/code&amp;gt;. Add &amp;lt;code&amp;gt;lint&amp;lt;/code&amp;gt; as the &amp;#039;&amp;#039;&amp;#039;first&amp;#039;&amp;#039;&amp;#039; stage in your &amp;lt;code&amp;gt;stages:&amp;lt;/code&amp;gt; list:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
stages:&lt;br /&gt;
  - lint&lt;br /&gt;
  - build&lt;br /&gt;
  - test&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then add a new job that runs cppcheck. Place it above your existing &amp;lt;code&amp;gt;build&amp;lt;/code&amp;gt; job:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cppcheck:&lt;br /&gt;
  stage: lint&lt;br /&gt;
  image: $CI_REGISTRY_IMAGE/oven-build:latest&lt;br /&gt;
  script:&lt;br /&gt;
    - cppcheck&lt;br /&gt;
        --enable=warning,style,performance,portability&lt;br /&gt;
        --inline-suppr&lt;br /&gt;
        --error-exitcode=1&lt;br /&gt;
        --suppress=missingIncludeSystem&lt;br /&gt;
        --std=c++17&lt;br /&gt;
        -I include&lt;br /&gt;
        src&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: clang-tidy is &amp;#039;&amp;#039;&amp;#039;not&amp;#039;&amp;#039;&amp;#039; a separate CI job. Because we wired it into &amp;lt;code&amp;gt;CMAKE_CXX_CLANG_TIDY&amp;lt;/code&amp;gt;, it runs during the existing &amp;lt;code&amp;gt;build&amp;lt;/code&amp;gt; job, on every translation unit. If clang-tidy reports an error, the build job fails just as if the compiler had failed. This is exactly the behavior we want: one pipeline run, multiple gates.&lt;br /&gt;
&lt;br /&gt;
Commit and push your branch:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git add .gitlab-ci.yml&lt;br /&gt;
git commit -m &amp;quot;Add lint stage running cppcheck&amp;quot;&lt;br /&gt;
git push -u origin feature/static-analysis&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open a Merge Request from &amp;lt;code&amp;gt;feature/static-analysis&amp;lt;/code&amp;gt; into &amp;lt;code&amp;gt;main&amp;lt;/code&amp;gt;. The pipeline should run, the new &amp;lt;code&amp;gt;lint&amp;lt;/code&amp;gt; stage should appear, and (assuming your code is clean) all stages should pass.&lt;br /&gt;
&lt;br /&gt;
== Step 7: Trigger a Failure on Purpose ==&lt;br /&gt;
&lt;br /&gt;
Quality gates are only useful if they actually catch things. Let us prove ours does.&lt;br /&gt;
&lt;br /&gt;
Pick any &amp;lt;code&amp;gt;.cpp&amp;lt;/code&amp;gt; file in your project --- for example &amp;lt;code&amp;gt;src/OvenController.cpp&amp;lt;/code&amp;gt;. Add the following intentionally broken function near the top of the file, &amp;#039;&amp;#039;&amp;#039;but inside the same namespace and class&amp;#039;&amp;#039;&amp;#039; so it actually compiles:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Intentional bug for Week 7 lab. Remove before merge.&lt;br /&gt;
void OvenController::leakyDiagnostic() {&lt;br /&gt;
    int* readings = new int[100];&lt;br /&gt;
    if (sensors_.empty()) {&lt;br /&gt;
        return;   // &amp;lt;-- LEAK: never delete[] readings&lt;br /&gt;
    }&lt;br /&gt;
    for (int i = 0; i &amp;lt; 100; ++i) {&lt;br /&gt;
        readings[i] = i;&lt;br /&gt;
    }&lt;br /&gt;
    delete[] readings;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also declare it in the corresponding header. Commit and push:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git add src/OvenController.cpp include/OvenController.hpp&lt;br /&gt;
git commit -m &amp;quot;Add deliberate leak (lab demo, will revert)&amp;quot;&lt;br /&gt;
git push&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now watch your Merge Request. The new pipeline run should:&lt;br /&gt;
&lt;br /&gt;
# Start the &amp;lt;code&amp;gt;lint&amp;lt;/code&amp;gt; stage.&lt;br /&gt;
# cppcheck reports the leak and exits non-zero.&lt;br /&gt;
# The &amp;lt;code&amp;gt;lint&amp;lt;/code&amp;gt; job turns red.&lt;br /&gt;
# The &amp;lt;code&amp;gt;build&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;test&amp;lt;/code&amp;gt; jobs are skipped (because &amp;lt;code&amp;gt;lint&amp;lt;/code&amp;gt; failed).&lt;br /&gt;
# The Merge Request is automatically blocked from merging.&lt;br /&gt;
&lt;br /&gt;
Click into the failed job and read the cppcheck output. You should see something close to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
src/OvenController.cpp:42:5: error: Memory leak: readings [memleak]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is exactly what should happen. The pipeline did its job.&lt;br /&gt;
&lt;br /&gt;
== Step 8: Fix and Merge ==&lt;br /&gt;
&lt;br /&gt;
Revert the deliberate bug:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git revert HEAD&lt;br /&gt;
git push&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(Or remove the function manually and commit. Either is fine.)&lt;br /&gt;
&lt;br /&gt;
The new pipeline should pass all stages: &amp;lt;code&amp;gt;lint&amp;lt;/code&amp;gt; green, &amp;lt;code&amp;gt;build&amp;lt;/code&amp;gt; green (with clang-tidy clean), &amp;lt;code&amp;gt;test&amp;lt;/code&amp;gt; green. Merge the MR via GitLab.&lt;br /&gt;
&lt;br /&gt;
You now have a working, multi-stage CI pipeline that enforces both unit tests &amp;#039;&amp;#039;&amp;#039;and&amp;#039;&amp;#039;&amp;#039; static analysis on every change to the codebase.&lt;br /&gt;
&lt;br /&gt;
== Deliverables ==&lt;br /&gt;
&lt;br /&gt;
To be marked as complete, your &amp;lt;code&amp;gt;main&amp;lt;/code&amp;gt; branch must contain:&lt;br /&gt;
&lt;br /&gt;
# An updated &amp;lt;code&amp;gt;Dockerfile&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;cppcheck&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;clang-tidy&amp;lt;/code&amp;gt; installed.&lt;br /&gt;
# A &amp;lt;code&amp;gt;.clang-tidy&amp;lt;/code&amp;gt; configuration file at the repo root.&lt;br /&gt;
# A &amp;lt;code&amp;gt;CMakeLists.txt&amp;lt;/code&amp;gt; that exports &amp;lt;code&amp;gt;compile_commands.json&amp;lt;/code&amp;gt;, sets &amp;lt;code&amp;gt;CMAKE_CXX_CLANG_TIDY&amp;lt;/code&amp;gt;, and defines a &amp;lt;code&amp;gt;cppcheck&amp;lt;/code&amp;gt; custom target.&lt;br /&gt;
# A &amp;lt;code&amp;gt;.gitlab-ci.yml&amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;lint&amp;lt;/code&amp;gt; stage running cppcheck &amp;#039;&amp;#039;&amp;#039;before&amp;#039;&amp;#039;&amp;#039; the &amp;lt;code&amp;gt;build&amp;lt;/code&amp;gt; stage.&lt;br /&gt;
# A merged Merge Request whose pipeline shows &amp;#039;&amp;#039;&amp;#039;four&amp;#039;&amp;#039;&amp;#039; green jobs (lint, build, test, plus any others you already had).&lt;br /&gt;
# Evidence in the MR&amp;#039;s pipeline history of &amp;#039;&amp;#039;&amp;#039;at least one failed pipeline&amp;#039;&amp;#039;&amp;#039; caused by the deliberate bug, followed by the fix.&lt;br /&gt;
&lt;br /&gt;
== Common Issues ==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;clang-tidy reports many warnings on third-party headers (Google Test, system includes).&amp;#039;&amp;#039;&lt;br /&gt;
* Make sure &amp;lt;code&amp;gt;HeaderFilterRegex&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;.clang-tidy&amp;lt;/code&amp;gt; only matches your own headers, e.g. &amp;lt;code&amp;gt;&amp;#039;^src/|^include/&amp;#039;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;cppcheck complains about missing system headers.&amp;#039;&amp;#039;&lt;br /&gt;
* That is what &amp;lt;code&amp;gt;--suppress=missingIncludeSystem&amp;lt;/code&amp;gt; is for. Make sure you kept that flag.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;clang-tidy fails because it cannot find compile flags.&amp;#039;&amp;#039;&lt;br /&gt;
* Confirm that &amp;lt;code&amp;gt;set(CMAKE_EXPORT_COMPILE_COMMANDS ON)&amp;lt;/code&amp;gt; is in &amp;lt;code&amp;gt;CMakeLists.txt&amp;lt;/code&amp;gt;, that &amp;lt;code&amp;gt;build/compile_commands.json&amp;lt;/code&amp;gt; exists after configure, and that you ran CMake before clang-tidy.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;The pipeline runs forever, then times out.&amp;#039;&amp;#039;&lt;br /&gt;
* clang-tidy is significantly slower than the compiler. If a full build now takes more than 10 minutes, consider narrowing your &amp;lt;code&amp;gt;Checks:&amp;lt;/code&amp;gt; list. Start tight, loosen as you learn which checks pull their weight.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;My capstone project codebase already has dozens of warnings.&amp;#039;&amp;#039;&lt;br /&gt;
* That is normal for an existing codebase. Two strategies: (1) fix them all in one MR, or (2) configure clang-tidy to warn-but-not-fail until you have cleaned things up. Option (1) is cleaner. Option (2) is realistic when you inherit legacy code.&lt;br /&gt;
&lt;br /&gt;
== Looking Ahead ==&lt;br /&gt;
&lt;br /&gt;
Next week we leave the CI pipeline alone and turn to the &amp;#039;&amp;#039;&amp;#039;system architecture&amp;#039;&amp;#039;&amp;#039; of your capstone: how does your Raspberry Pi actually talk to the VM server? Sockets, REST, MQTT, and the design trade-offs between them.&lt;/div&gt;</summary>
		<author><name>Rhobincu</name></author>
	</entry>
</feed>