Skip to content

Commit

Permalink
code analyser updates
Browse files Browse the repository at this point in the history
  • Loading branch information
HJLebbink committed Sep 22, 2019
1 parent 79e1cec commit c86b599
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 15 deletions.
11 changes: 10 additions & 1 deletion VS/CSHARP/asm-dude-vsix/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dotnet_diagnostic.SA1310.severity = none
dotnet_diagnostic.SA1309.severity = silent

# SA1600: Elements should be documented
dotnet_diagnostic.SA1600.severity = silent
dotnet_diagnostic.SA1600.severity = none

# SA1005: Single line comments should begin with single space
dotnet_diagnostic.SA1005.severity = none
Expand Down Expand Up @@ -128,3 +128,12 @@ dotnet_diagnostic.SA1401.severity = silent

# IDE1006: Naming Styles
dotnet_diagnostic.IDE1006.severity = none

# CA1031: Do not catch general exception types
dotnet_diagnostic.CA1031.severity = silent

# CA1051: Do not declare visible instance fields
dotnet_diagnostic.CA1051.severity = silent

# CA1707: Identifiers should not contain underscores
dotnet_diagnostic.CA1707.severity = none
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public int Compare(Completion x, Completion y)

public sealed class CodeCompletionSource : ICompletionSource
{
private static readonly int MAX_LENGTH_DESCR_TEXT = 120;
private const int MAX_LENGTH_DESCR_TEXT = 120;

private readonly ITextBuffer _buffer;
private readonly LabelGraph _labelGraph;
Expand Down
3 changes: 2 additions & 1 deletion VS/CSHARP/asm-dude-vsix/Resources/examples/data.xyz
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
This is a xyzzy file.

blah
blah
blah

20 changes: 10 additions & 10 deletions VS/CSHARP/asm-dude-vsix/Tools/LabelGraph.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,36 +136,36 @@ public void Reset()
this._delay.Reset();
}

public int Get_Linenumber(uint id)
public static int Get_Linenumber(uint id)
{
return (int)(id & 0x00FFFFFF);
}

public uint Get_File_Id(uint id)
public static uint Get_File_Id(uint id)
{
return id >> 24;
}

public string Get_Filename(uint id)
{
uint fileId = this.Get_File_Id(id);
uint fileId = Get_File_Id(id);
if (this._filenames.TryGetValue(fileId, out string filename))
{
return filename;
}
else
{
AsmDudeToolsStatic.Output_WARNING("LabelGraph:Get_Filename: no filename for id=" + id + " (fileId " + fileId + "; line " + this.Get_Linenumber(id) + ")");
AsmDudeToolsStatic.Output_WARNING("LabelGraph:Get_Filename: no filename for id=" + id + " (fileId " + fileId + "; line " + Get_Linenumber(id) + ")");
return string.Empty;
}
}

public uint Make_Id(int lineNumber, uint fileId)
public static uint Make_Id(int lineNumber, uint fileId)
{
return (fileId << 24) | (uint)lineNumber;
}

public bool Is_From_Main_File(uint id)
public static bool Is_From_Main_File(uint id)
{
return id <= 0xFFFFFF;
}
Expand Down Expand Up @@ -221,7 +221,7 @@ public bool Is_From_Main_File(uint id)
{
if (result.ContainsKey(used_at_id))
{ // this should not happen: somehow the (file-line) used_at_id has multiple occurances on the same line?!
AsmDudeToolsStatic.Output_WARNING("LabelGraph:Get_Undefined_Labels: id=" + used_at_id + " (" + this.Get_Filename(used_at_id) + "; line " + this.Get_Linenumber(used_at_id) + ") with label \"" + full_Qualified_Label + "\" already exists and has key \"" + result[used_at_id] + "\".");
AsmDudeToolsStatic.Output_WARNING("LabelGraph:Get_Undefined_Labels: id=" + used_at_id + " (" + this.Get_Filename(used_at_id) + "; line " + Get_Linenumber(used_at_id) + ") with label \"" + full_Qualified_Label + "\" already exists and has key \"" + result[used_at_id] + "\".");
}
else
{
Expand All @@ -248,10 +248,10 @@ public SortedDictionary<string, string> Label_Descriptions
foreach (KeyValuePair<string, IList<uint>> entry in this._defAt)
{
uint id = entry.Value[0];
int lineNumber = this.Get_Linenumber(id);
int lineNumber = Get_Linenumber(id);
string filename = Path.GetFileName(this.Get_Filename(id));
string lineContent;
if (this.Is_From_Main_File(id))
if (Is_From_Main_File(id))
{
lineContent = " :" + this._buffer.CurrentSnapshot.GetLineFromLineNumber(lineNumber).GetText();
}
Expand Down Expand Up @@ -484,7 +484,7 @@ private void Add_All(ITextBuffer buffer, uint fileId)
{
for (int lineNumber = 0; lineNumber < buffer.CurrentSnapshot.LineCount; ++lineNumber)
{
this.Add_Linenumber(buffer, aggregator, lineNumber, this.Make_Id(lineNumber, fileId));
this.Add_Linenumber(buffer, aggregator, lineNumber, Make_Id(lineNumber, fileId));
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions VS/CSHARP/asm-dude-vsix/asm-dude-vsix.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,11 @@
<PackageReference Include="LoadingIndicators.WPF">
<Version>0.0.1</Version>
</PackageReference>
<PackageReference Include="Microsoft.CodeQuality.Analyzers">
<Version>2.9.4</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.Composition.Analyzers">
<Version>1.2.0-beta2</Version>
</PackageReference>
Expand Down
2 changes: 1 addition & 1 deletion VS/CSHARP/asm-dude-vsix/source.extension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ static class Vsix
public const string Name = "AsmDude";
public const string Description = "Syntax highlighting and code assistance for assembly source code (.asm, .cod, .inc, .s) and the Disassembly Window ";
public const string Language = "en-US";
public const string Version = "1.9.6.8";
public const string Version = "1.9.6.10";
public const string Author = "Henk-Jan Lebbink";
public const string Tags = "Assembly, Assembler, ASM, Syntax Highlighting, Code Completion, Disassembly Window, Code Analysis, x86_64, SSE, AVX, AVX2, AVX512";
}
Expand Down
2 changes: 1 addition & 1 deletion VS/CSHARP/asm-dude-vsix/source.extension.vsixmanifest
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="c729d6b2-f412-49ed-893d-a8f61f25db98" Version="1.9.6.8" Language="en-US" Publisher="Henk-Jan Lebbink" />
<Identity Id="c729d6b2-f412-49ed-893d-a8f61f25db98" Version="1.9.6.10" Language="en-US" Publisher="Henk-Jan Lebbink" />
<DisplayName>AsmDude</DisplayName>
<Description xml:space="preserve">Syntax highlighting and code assistance for assembly source code (.asm, .cod, .inc, .s) and the Disassembly Window </Description>
<MoreInfo>https://github.com/HJLebbink/asm-dude</MoreInfo>
Expand Down

0 comments on commit c86b599

Please sign in to comment.