Skip to content

Commit f849212

Browse files
authored
Dup tags arg html (#186)
* Improves rethrow exceptions from throw e; to just throw; to avoid loss of stack data info and removes unused lines of code for cleanliness identified by LGTM/Semmle. Fixes loss of confidence data in some cases from serialization where not specified. Fixes one hardcoded output filename for tagtest and prevents msg for console winding up in log. * Fix #183
1 parent 9283917 commit f849212

File tree

5 files changed

+19
-1
lines changed

5 files changed

+19
-1
lines changed

AppInspector.CLI/html/resources/js/appinspector.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,12 @@ class TemplateInsertion {
153153
if (match.ruleId === ruleid || match.ruleName === ruleid) {
154154
let $li = $('<li>');
155155
let $a = $('<a>');
156+
let $l = match.startLocationLine-3;
157+
if ($l < 0) $l = 1; //fix #183
156158
$a.addClass('content-link')
157159
.attr('href', '#')
158160
.data('excerpt', excerpt)
159-
.data('startLocationLine', match.startLocationLine - 3)
161+
.data('startLocationLine', $l)
160162
.text(removePrefix(match.fileName));
161163
$li.append($a);
162164
$('#file_listing_modal ul').append($li);

AppInspector/Commands/AnalyzeCommand.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,9 @@ void ConfigFileOutput()
166166
if (!string.IsNullOrEmpty(_arg_outputFile))
167167
WriteOnce.Info("output file ignored for html format");
168168
_outputWriter.TextWriter = Console.Out;
169+
170+
if (!_arg_outputUniqueTagsOnly) //fix #183
171+
throw new Exception(ErrMsg.GetString(ErrMsg.ID.ANALYZE_NODUPLICATES_HTML_FORMAT));
169172
}
170173
else if (!string.IsNullOrEmpty(_arg_outputFile))
171174
{

AppInspector/ErrorMessage.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public enum ID
2929
ANALYZE_FILE_TYPE_OPEN,
3030
ANALYZE_OUTPUT_FILE,
3131
ANALYZE_REPORTSIZE_WARN,
32+
ANALYZE_NODUPLICATES_HTML_FORMAT,
3233
CMD_PREPARING_REPORT,
3334
CMD_COMPLETED,
3435
CMD_CRITICAL_FILE_ERR,

AppInspector/Properties/Resources.Designer.cs

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

AppInspector/Properties/Resources.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@
144144
<data name="ANALYZE_LANGUAGE_NOTFOUND" xml:space="preserve">
145145
<value>File skipped: Language not found for file {0}</value>
146146
</data>
147+
<data name="ANALYZE_NODUPLICATES_HTML_FORMAT" xml:space="preserve">
148+
<value>Allow duplicate matches argument not supported for html output format. Select a different output format (text/json) or remove the argument.</value>
149+
</data>
147150
<data name="ANALYZE_NOPATTERNS" xml:space="preserve">
148151
<value>No pattern matches were detected for files in source path</value>
149152
</data>

0 commit comments

Comments
 (0)