-
Notifications
You must be signed in to change notification settings - Fork 0
/
CppCodeAnalyzer.html
305 lines (289 loc) · 10.6 KB
/
CppCodeAnalyzer.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
<!DOCTYPE html>
<html>
<!--
CppCodeAnalyzer.html
-->
<head>
<title>CppCodeAnalyzer Repo</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="css/StylesPageFrameDefaults.css" />
<link rel="stylesheet" href="css/StylesPageFrameStructure.css" />
<link rel="stylesheet" href="css/StylesPageFrameMenus.css" />
<link rel="stylesheet" href="css/StylesPageFrameThemeBlue.css" />
<link rel="stylesheet" href="css/StylesWebComponents.css" />
<script src="js/ScriptsWebComponents.js"></script>
<script src="js/ScriptsPageFrameCppRepos.js"></script>
<script src="js/ScriptsPageFramePagesCppRepos.js"></script>
<script src="js/ScriptsPageFrameKeyboard.js"></script>
<style>
summary {
padding: 3px 0px 5px 0px;
}
.container {
display: grid;
grid-template-columns: 0em 0.6fr 1.5fr 0.6fr 1fr 0em;
/*link to pg, descrip, link to repo, status grid-column-gap: 0em;*/
padding: 0.0em;
margin: 0em 0.25em 1em 0.25em;
border: 1px solid var(--dark);
}
.item1 {
grid-column: 2;
padding: 0.2em 1em;
border: 2px solid var(--dark);
}
.item2 {
grid-column: 3;
padding: 0.2em 1em;
border: 2px solid var(--dark);
}
.item3 {
grid-column: 4;
padding: 0.2em 1em;
border: 2px solid var(--dark);
}
.item4 {
grid-column: 5;
padding: 0.2em 1em;
border: 2px solid var(--dark);
}
.gray {
background-color: #ddd;
}
.spread {
margin: 1em;
}
.tightSpread {
margin: 0.5em;
}
#github #pagetitle {
background-color:var(--dark);
color: var(--light);
}
#github #title {
background-color: var(--dark);
color: var(--light);
}
#github #subtitle {
background-color: var(--dark);
color: var(--light);
}
#github a.repoLink {
background-color: var(--dark);
color: var(--light);
}
#github h3 {
margin-top: 1.0em;
margin-bottom: 0.75em;
}
#github h4 {
margin-top: 0.75em;
margin-bottom: 0.75em;
}
#github indent-block {
padding:0.5em 0em;
}
</style>
</head>
<body id="github" onload="initialize()">
<a id="Next" href="CppCommWithFileXfer.html">N</a>
<a id="Prev" href="CppParser.html">P</a>
<page-frame>
<frame-header>
<nav id="navbar"></nav>
</frame-header>
<main>
<div id="about">about</div>
<div id="modified">12/03/2022</div>
<div id="page">CppCodeAnalyzer Repo</div>
<div id="hlp"></div>
<a id="top"></a>
<content>
<header>
<a class="repoLink" href="https://github.com/JimFawcett/CppCodeAnalyzer">CppCodeAnalyzer code</a>
<hgroup id="pagetitle">
<h1 id="title">CppCodeAnalyzer Repository</h1>
<h3 id="subtitle" class="indent">Uses rule-based parser to build AST holding data for display</h3>
</hgroup>
<div style="padding-right:25px; position:absolute; top:2em; right:0em;">
<details>
<summary class="darkItem quickStatus" style="border:1px solid var(--light);">Quick Status</summary>
<status-grid style="padding:5px 10px;" class="lightItem border">
<status-itemLeft>
Code functions correctly
</status-itemLeft>
<status-itemRight>
no known defects
</status-itemRight>
<status-itemLeft>
Demonstration code
</status-itemLeft>
<status-itemRight>
yes
</status-itemRight>
<status-itemLeft>
Documentation
</status-itemLeft>
<status-itemRight>
yes - needs much more
</status-itemRight>
<status-itemLeft>
Test cases
</status-itemLeft>
<status-itemRight>
no, but planned
</status-itemRight>
<status-itemLeft>
Static library
</status-itemLeft>
<status-itemRight>
no, but planned
</status-itemRight>
<status-itemLeft>
Build requires
</status-itemLeft>
<status-itemRight>
C++17 option
</status-itemRight>
<status-itemLeft>
Planned design changes
</status-itemLeft>
<status-itemRight>
Add more demonstration code
</status-itemRight>
</status-grid>
</details>
</div>
</header>
<indent-blocks>
<div class="right">
<photosizer-block src="Pictures/CodeAnalyzerPackages.JPG" width="300" class="photoSizerBlock" style="margin-top:0;">
<span style="
display: inline-block;
font-weight: bold;
font-family: 'Comic Sans MS', Tahoma;
background-color: #ddd;
width: 100%;
padding: 5px 0px;
">
Fig 1. CodeAnalyzer Packages
</span>
</photosizer-block>
</div>
<div class="right clear">
<photosizer-block src="Pictures/CodeAnalyzerActivities.JPG" width="300" class="photoSizerBlock" style="margin-top:0;">
<span style="
display: inline-block;
font-weight: bold;
font-family: 'Comic Sans MS', Tahoma;
background-color: #ddd;
width: 100%;
padding: 5px 0px;
">
Fig 2. CodeAnalyzer Activities
</span>
</photosizer-block>
</div>
<div class="right clear">
<photosizer-block src="Pictures/CodeAnalyzerOutput.JPG" width="300" class="photoSizerBlock" style="margin-top:0;">
<span style="
display: inline-block;
font-weight: bold;
font-family: 'Comic Sans MS', Tahoma;
background-color: #ddd;
width: 100%;
padding: 5px 0px;
">
Fig 3. CodeAnalyzer Output
</span>
</photosizer-block>
</div>
<h3 id="concept">1.0 Concept</h3>
<t-b>
CppCodeAnalyzer executes static type-based code analysis on specified files in a specified
directory tree. It evaluates metrics and provides an Abstract Syntax Tree representation for
the analysis results.
</t-b>
<t-b>
Note that each of the figures on the right expand when the image body is clicked. They contract
when their title bars are clicked, or when the page is refreshed.
</t-b>
<h3 id="design">2.0 Design</h3>
<t-b>
The CodeAnalyzer package static structure is shown in Figure 1. The <c-s>Window</c-s>, <c-s>Executive</c-s>,
<c-s>ConfigParser</c-s>, <c-s>FileMgr</c-s>, and <c-s>FileSystem</c-s> are responsible for configuring
the analyzer and feeding it input data. The <c-s>Display</c-s> and <c-s>Logger</c-s> are tasked with
sending information to the user. All other packages are part of a rule-based
<a href="CppParser.html"><c-s>CppParser</c-s></a>
</t-b>
<t-b>
Fig 2. shows the CodeAnalyzer activities as they evolve in time. The Window subsystem collects user input,
configures the parser by constructing its command line, and creates the CodeAnalyzer process. Then, the
CodeAnalyzer extracts configuration information from its command line and starts a directory navigation process that
continually feeds file references for analysis.
</t-b>
<t-b>
Each code file is parsed using <a href="CppParser.html">CppParser</a>, which contributes to the contents
of a simplified Abstract Syntax Tree. As the tree is built, analysis of complexity and other metrics
runs, providing information displayed to the user as analysis of each file completes.
</t-b>
<t-b>
This activity pipeline provides continous information to the user as computation progresses.
A typical output is shown in Fig 3.
</t-b>
<h3 id="build">3.0 Build</h3>
<t-b>
CppCodeAnalyzer was built with Visual Studio Community Edition - 2019 and tested on
Windows 10.
</t-b>
<h3 id="status">4.0 Status</h3>
<t-b>
My teaching assistants and I used this code analyzer for years grading code projects for my graduate
software design courses at
<a href="https://ecs.syr.edu/faculty/fawcett/handouts/Webpages/fawcettHome.htm">Syracuse University</a>.
I built the original prototype version for a
<a href="Resources/SoftwareStructureResearch.pdf">research project</a> in 2004, excellent work by
Dr. Murat Gungor. I had the pleasure of working with and advising Murat on his dissertation, of which
this research was a part.
</t-b>
<t-b>
The CodeAnalyzer has evolved through several iterations, adding functionality, fixing aggravating flaws,
and simplifying.
</t-b>
</indent-blocks>
<!--<img class="strip-photo" src="Pictures/CampusAtNight.jpg" alt="campus at night" />-->
<script>createSizer("Pictures/CodeAnalyzer.jpg", "CodeAnalyzer Output", 500, "fig1")</script>
<div style="height:10em;"></div>
</content>
<a id="bottom"></a>
<page-TOC id="pages" style="display:none;">
</page-TOC>
<page-sections id="sections" style="display:none;">
<sec-elem style="width:0.0em"> </sec-elem>
<menu-elem class="secElem"><a href="#bottom">bottom</a></menu-elem>
<menu-elem class="secElem"><a href="#status">status</a></menu-elem>
<menu-elem class="secElem"><a href="#build">build</a></menu-elem>
<!--<menu-elem class="secElem"><a href="#res">res</a></menu-elem>-->
<!--<menu-elem class="secElem"><a href="#impl">impl</a></menu-elem>-->
<menu-elem class="secElem"><a href="#design">design</a></menu-elem>
<!--<menu-elem class="secElem"><a href="#oper">oper</a></menu-elem>-->
<menu-elem class="secElem"><a href="#concept">concept</a></menu-elem>
<menu-elem class="secElem"><a href="#top">top</a></menu-elem>
</page-sections>
</main>
<frame-footer>
<menu-item style="width:1.0em;"> </menu-item>
<menu-elem id="nextLink2" onclick="bottomMenu.next()">Next</menu-elem>
<menu-elem id="prevLink2" onclick="bottomMenu.prev()">Prev</menu-elem>
<menu-elem id="pgbtn" onclick="bottomMenu.pages()">Pages</menu-elem>
<menu-elem onclick="bottomMenu.sections()">Sections</menu-elem>
<menu-elem onclick="bottomMenu.about()">About</menu-elem>
<menu-elem id="kysbtn" onclick="storyHlpMenu.keys()">Keys</menu-elem>
<!--<menu-item style="width:1.0em;"> </menu-item>
<menu-elem style="font-size:0.75em;" onclick="storyHlpMenu.decrZoomScreen()">Zout</menu-elem>
<menu-elem style="font-size:0.75em;" onclick="storyHlpMenu.normZoomScreen()">Zdef</menu-elem>
<menu-elem style="font-size:0.75em;" onclick="storyHlpMenu.incrZoomScreen()">Zin</menu-elem>-->
</frame-footer>
</page-frame>
</body>
</html>