Skip to content

Commit

Permalink
fixed warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
HJLebbink committed Oct 7, 2019
1 parent 064a924 commit 391bec9
Show file tree
Hide file tree
Showing 28 changed files with 302 additions and 178 deletions.
3 changes: 3 additions & 0 deletions VS/CSHARP/asm-dude-vsix/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,6 @@ dotnet_diagnostic.CA1707.severity = none

# SA1642: Constructor summary documentation should begin with standard text
dotnet_diagnostic.SA1642.severity = silent

# CA1714: Flags enums should have plural names
dotnet_diagnostic.CA1714.severity = silent
2 changes: 2 additions & 0 deletions VS/CSHARP/asm-dude-vsix/AsmDoc/AsmDocMouseHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
namespace AsmDude.AsmDoc
{
using System;
using System.Diagnostics.Contracts;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
Expand Down Expand Up @@ -444,6 +445,7 @@ private static void Evaluate(EnvDTE.Window windowReference, Action<System.Window

public static Uri GetWebBrowserWindowUrl(EnvDTE.Window windowReference)
{
Contract.Requires(windowReference != null);
ThreadHelper.ThrowIfNotOnUIThread();

Uri browserUrl = new Uri(string.Empty, UriKind.RelativeOrAbsolute);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

namespace AsmDude.ClearMefCache
{
using System.Diagnostics.Contracts;
using System.Threading.Tasks;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
Expand All @@ -30,6 +31,8 @@ public static class ComponentModelExtensions
{
public static async Task<string> GetFolderPathAsync(this IVsComponentModelHost componentModelHost)
{
Contract.Requires(componentModelHost != null);

if (!ThreadHelper.CheckAccess())
{
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ namespace AsmDude
{
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.IO;
using System.Linq;
using System.Windows.Media;
Expand All @@ -37,6 +38,8 @@ public sealed class CompletionComparer : IComparer<Completion>
{
public int Compare(Completion x, Completion y)
{
Contract.Requires(x != null);
Contract.Requires(y != null);
return x.InsertionText.CompareTo(y.InsertionText);
}
}
Expand All @@ -63,6 +66,9 @@ public CodeCompletionSource(ITextBuffer buffer, LabelGraph labelGraph, AsmSimula

public void AugmentCompletionSession(ICompletionSession session, IList<CompletionSet> completionSets)
{
Contract.Requires(session != null);
Contract.Requires(completionSets != null);

try
{
//AsmDudeToolsStatic.Output_INFO(string.Format("{0}:AugmentCompletionSession", this.ToString()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
namespace AsmDude
{
using System.ComponentModel.Composition;
using System.Diagnostics.Contracts;
using AsmDude.Tools;
using Microsoft.VisualStudio.Language.Intellisense;
using Microsoft.VisualStudio.Text;
Expand All @@ -47,6 +48,7 @@ public sealed class CodeCompletionSourceProvider : ICompletionSourceProvider

public ICompletionSource TryCreateCompletionSource(ITextBuffer buffer)
{
Contract.Requires(buffer != null);
CodeCompletionSource sc()
{
LabelGraph labelGraph = AsmDudeToolsStatic.GetOrCreate_Label_Graph(buffer, this._aggregatorFactory, this._docFactory, this._contentService);
Expand Down
14 changes: 7 additions & 7 deletions VS/CSHARP/asm-dude-vsix/CodeFolding/CodeFoldingTagger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,10 @@ private TextBlock Get_Hover_Text_TextBlock(int beginLineNumber, int endLineNumbe
/// <summary>
/// Return start positions of the provided line content. tup has: 1) start of the folding position; 2) start of the description position.
/// </summary>
private (int StartPosFolding, int StartPosDescription) Is_Start_Keyword(string lineContent, int lineNumber)
private (int startPosFolding, int startPosDescription) Is_Start_Keyword(string lineContent, int lineNumber)
{
(int StartPos, int StartPosDescription) tup = this.Is_Start_Directive_Keyword(lineContent);
if (tup.StartPos != -1)
(int startPos, int startPosDescription) tup = this.Is_Start_Directive_Keyword(lineContent);
if (tup.startPos != -1)
{
return tup;
}
Expand All @@ -254,7 +254,7 @@ private TextBlock Get_Hover_Text_TextBlock(int beginLineNumber, int endLineNumbe
/// <summary>
/// Return start positions of the provided line content. tup has: 1) start of the folding position; 2) start of the description position.
/// </summary>
private (int StartPos, int StartPosDescription) Is_Start_Directive_Keyword(string lineContent)
private (int startPos, int startPosDescription) Is_Start_Directive_Keyword(string lineContent)
{
int i1 = lineContent.IndexOf(this.startRegionTag, StringComparison.OrdinalIgnoreCase);
if (i1 == -1)
Expand All @@ -270,7 +270,7 @@ private TextBlock Get_Hover_Text_TextBlock(int beginLineNumber, int endLineNumbe
/// <summary>
/// Return start positions of the provided line content. tup has: 1) start of the folding position; 2) start of the description position.
/// </summary>
private (int StartPosFolding, int StartPosDescription) Is_Start_Masm_Keyword(string lineContent, int lineNumber)
private (int startPosFolding, int startPosDescription) Is_Start_Masm_Keyword(string lineContent, int lineNumber)
{
try
{
Expand Down Expand Up @@ -311,7 +311,7 @@ private TextBlock Get_Hover_Text_TextBlock(int beginLineNumber, int endLineNumbe
/// <summary>
/// Return start positions of the provided line content. tup has: 1) start of the folding position; 2) start of the description position.
/// </summary>
private (int StartPos, int StartPosDescription) Is_Start_Nasm_Keyword(string lineContent, int lineNumber)
private (int startPos, int startPosDescription) Is_Start_Nasm_Keyword(string lineContent, int lineNumber)
{
foreach (IMappingTagSpan<AsmTokenTag> asmTokenSpan in AsmDudeToolsStatic.GetAsmTokenTags(this._aggregator, lineNumber))
{
Expand Down Expand Up @@ -474,7 +474,7 @@ private void Parse()
line = enumerator.Current;
string lineContent3 = line.GetText();
if (AsmSourceTools.IsRemarkOnly(lineContent3) &&
(this.Is_Start_Directive_Keyword(lineContent3).StartPos == -1) &&
(this.Is_Start_Directive_Keyword(lineContent3).startPos == -1) &&
(this.Is_End_Directive_Keyword(lineContent3) == -1))
{
lineNumber2 = line.LineNumber;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
namespace AsmDude.HighlightWord
{
using System.ComponentModel.Composition;
using System.Diagnostics.Contracts;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Text.Operations;
Expand Down Expand Up @@ -50,6 +51,8 @@ public class HighlightWordTaggerProvider : IViewTaggerProvider
/// <returns> Returns a HighlightWordTagger instance</returns>
public ITagger<T> CreateTagger<T>(ITextView textView, ITextBuffer buffer) where T : ITag
{
Contract.Requires(buffer != null);

if (textView == null)
{
return null;
Expand Down
Loading

0 comments on commit 391bec9

Please sign in to comment.