Skip to content

Commit

Permalink
fix(ALL): CNX-7448 Fixes all IDE0005 warnings across the entire mono-…
Browse files Browse the repository at this point in the history
…repo (specklesystems#3070)

* ci: Show all warnings on CI builds

* fix(all): Do not allow IDE0005 on CI

* fix(sdk): IDE0005 Redundant Using statements in SDK projects (specklesystems#3071)

* fix(core): IDE0005 Redundant Using statements

* fix(ci): GenerateDocumentationFile is required for IDE0005 to run on CI

* fix(ci): Allow warnings on all CI jobs

* fix(rhino/grasshopper): Fix IDE0005 Redundant Using Statements  (specklesystems#3072)

* fix(gh): IDE0005 for Grasshopper connector

* fix(rhino): IDE0005 for Rhino connector

* fix(rh/gh): IDE0005 for Rhino/Grasshopper shared converter

* Revit: IDE0005 fix (specklesystems#3073)

* remove connector usings

* remove converter usings

* remove revit shared resources usings

* dxfConverter

* remove more usings

* remove unused statement

* is this all of them?

---------

Co-authored-by: Connor Ivy <[email protected]>

* fix(dyn): IDE0005 Redundant Using Statements (specklesystems#3074)

* fix(dyn): IDE005 first run

* fix(dyn): Fix dangling warning

* fix(CNX-8300): IDE0005 Redundant using statements (specklesystems#3076)

* fix(tekla): IDE0005 Redundant using statements

* fix(structuralUtils): IDE0005 Redundant Using statements

* fix(CNX-8301): IDE0005 Redundant using statements in CSI (specklesystems#3079)

* fix for csi

* fix(csi): Wrapped pending using statement in pre-processor directive

---------

Co-authored-by: Connor Ivy <[email protected]>
Co-authored-by: Alan Rynne <[email protected]>

* fix (navisworks): CNX-8305 - IDE0005 (specklesystems#3077)

* Refactor NavisworksOptions Manager.cs

- Remove unused using statements
- Clean up namespace declaration

* Update Ribbon.xaml.cs for rogue using

---------

Co-authored-by: Alan Rynne <[email protected]>

* fix(acadcivil): resolves IDE0005 warnings (specklesystems#3080)

* Fixes IDE0005 for acadcivil connector and converter

* other warn cleanups

* fixes civil warn

* Update Directory.Build.props

---------

Co-authored-by: Alan Rynne <[email protected]>

---------

Co-authored-by: connorivy <[email protected]>
Co-authored-by: Connor Ivy <[email protected]>
Co-authored-by: Jonathon Broughton <[email protected]>
Co-authored-by: Claire Kuang <[email protected]>
  • Loading branch information
5 people authored Nov 30, 2023
1 parent bac754c commit 54ecc18
Show file tree
Hide file tree
Showing 242 changed files with 402 additions and 1,175 deletions.
14 changes: 7 additions & 7 deletions .circleci/scripts/config-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ commands:
SEMVER=$(echo "$NOPREFIX" | sed -e 's/\/[a-zA-Z-]*//')
VER=$(echo "$SEMVER" | sed -e 's/-.*//')
VERSION=$(echo $VER.$WORKFLOW_NUM)
$HOME/.dotnet/dotnet pack All.sln -p:Version=$SEMVER -p:FileVersion=$VERSION -c Release -p:WarningLevel=0 -p:IsDesktopBuild=false
$HOME/.dotnet/dotnet pack All.sln -p:Version=$SEMVER -p:FileVersion=$VERSION -c Release -p:IsDesktopBuild=false
environment:
WORKFLOW_NUM: << pipeline.number >>
- run:
Expand Down Expand Up @@ -107,7 +107,7 @@ jobs: # Each project will have individual jobs for each specific task it has to
SEMVER=$(echo "$NOPREFIX" | sed -e 's/\/[a-zA-Z-]*//')
VER=$(echo "$SEMVER" | sed -e 's/-.*//')
VERSION=$(echo $VER.$WORKFLOW_NUM)
$HOME/.dotnet/dotnet build SDK.slnf -c Release -p:WarningLevel=0 -p:IsDesktopBuild=false -p:Version=$SEMVER -p:FileVersion=$VERSION
$HOME/.dotnet/dotnet build SDK.slnf -c Release -p:IsDesktopBuild=false -p:Version=$SEMVER -p:FileVersion=$VERSION
environment:
WORKFLOW_NUM: << pipeline.number >>
- run-tests:
Expand Down Expand Up @@ -180,7 +180,7 @@ jobs: # Each project will have individual jobs for each specific task it has to
$semver = if($tag.Contains('/')) {$tag.Split("/")[0] } else { $tag }
$ver = if($semver.Contains('-')) {$semver.Split("-")[0] } else { $semver }
$version = "$($ver).$($env:WORKFLOW_NUM)"
msbuild << parameters.slnname >>/<< parameters.slnname >>.sln /p:Configuration=Release /p:WarningLevel=0 /p:IsDesktopBuild=false /p:Version=$semver /p:FileVersion=$version
msbuild << parameters.slnname >>/<< parameters.slnname >>.sln /p:Configuration=Release /p:IsDesktopBuild=false /p:Version=$semver /p:FileVersion=$version
environment:
WORKFLOW_NUM: << pipeline.number >>
- unless:
Expand All @@ -193,7 +193,7 @@ jobs: # Each project will have individual jobs for each specific task it has to
$semver = if($tag.Contains('/')) {$tag.Split("/")[0] } else { $tag }
$ver = if($semver.Contains('-')) {$semver.Split("-")[0] } else { $semver }
$version = "$($ver).$($env:WORKFLOW_NUM)"
dotnet publish << parameters.slnname >>/<< parameters.slnname >>/<< parameters.projname >>.csproj -c Release -r win-x64 --self-contained /p:WarningLevel=0 /p:Version=$semver /p:FileVersion=$version
dotnet publish << parameters.slnname >>/<< parameters.slnname >>/<< parameters.projname >>.csproj -c Release -r win-x64 --self-contained /p:Version=$semver /p:FileVersion=$version
environment:
WORKFLOW_NUM: << pipeline.number >>
- run:
Expand Down Expand Up @@ -312,7 +312,7 @@ jobs: # Each project will have individual jobs for each specific task it has to
SEMVER=$(echo "$TAG" | sed -e 's/\/[a-zA-Z-]*//')
VER=$(echo "$SEMVER" | sed -e 's/-.*//')
VERSION=$(echo $VER.$WORKFLOW_NUM)
msbuild << parameters.slnname >>/<< parameters.slnname >>.sln /r /p:Configuration='<< parameters.build-config >>' /p:WarningLevel=0 /p:IsDesktopBuild=false /p:Version=$SEMVER /p:FileVersion=$VERSION
msbuild << parameters.slnname >>/<< parameters.slnname >>.sln /r /p:Configuration='<< parameters.build-config >>' /p:IsDesktopBuild=false /p:Version=$SEMVER /p:FileVersion=$VERSION
environment:
WORKFLOW_NUM: << pipeline.number >>
# Compress build files
Expand Down Expand Up @@ -342,7 +342,7 @@ jobs: # Each project will have individual jobs for each specific task it has to
SEMVER=$(echo "$TAG" | sed -e 's/\/[a-zA-Z-]*//')
VER=$(echo "$SEMVER" | sed -e 's/-.*//')
VERSION=$(echo $VER.$WORKFLOW_NUM)
$HOME/.dotnet/dotnet publish << parameters.slnname >>/<< parameters.projname >>/<< parameters.projname >>.csproj -c Release -r osx-x64 --self-contained /p:WarningLevel=0 /p:Version=$SEMVER /p:FileVersion=$VERSION
$HOME/.dotnet/dotnet publish << parameters.slnname >>/<< parameters.projname >>/<< parameters.projname >>.csproj -c Release -r osx-x64 --self-contained /p:Version=$SEMVER /p:FileVersion=$VERSION
environment:
WORKFLOW_NUM: << pipeline.number >>
- run:
Expand Down Expand Up @@ -424,7 +424,7 @@ jobs: # Each project will have individual jobs for each specific task it has to
SEMVER=$(echo "$TAG" | sed -e 's/\/[a-zA-Z-]*//')
VER=$(echo "$SEMVER" | sed -e 's/-.*//')
VERSION=$(echo $VER.$WORKFLOW_NUM)
dotnet build << parameters.slnname >>/<< parameters.slnname >>.slnf -c "<< parameters.build-config >>" -p:WarningLevel=0 -p:Version=$SEMVER -p:FileVersion=$VERSION -p:IsDesktopBuild=false
dotnet build << parameters.slnname >>/<< parameters.slnname >>.slnf -c "<< parameters.build-config >>" -p:Version=$SEMVER -p:FileVersion=$VERSION -p:IsDesktopBuild=false
environment:
WORKFLOW_NUM: << pipeline.number >>
- run:
Expand Down
1 change: 0 additions & 1 deletion Automate/Speckle.Automate.Sdk/AutomationContext.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# nullable enable
using System.Diagnostics;
using GraphQL;
using Serilog.Debugging;
using Speckle.Automate.Sdk.Schema;
using Speckle.Core.Api;
using Speckle.Core.Credentials;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using Autodesk.AutoCAD.ApplicationServices;
using Document = Autodesk.AutoCAD.ApplicationServices.Document;

Expand Down
73 changes: 39 additions & 34 deletions ConnectorAutocadCivil/ConnectorAutocadCivil/Entry/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,17 @@ public void Create()
RibbonButton oneClickSendButton = CreateButton("Send", "SpeckleSend", panel, null, oneClickTip, "send");

// help and resources buttons
RibbonSplitButton helpButton = new();
helpButton.Text = "Help & Resources";
helpButton.Image = LoadPngImgSource("help16.png");
helpButton.LargeImage = LoadPngImgSource("help32.png");
helpButton.ShowImage = true;
helpButton.ShowText = true;
helpButton.Size = RibbonItemSize.Large;
helpButton.Orientation = Orientation.Vertical;
RibbonSplitButton helpButton =
new()
{
Text = "Help & Resources",
Image = LoadPngImgSource("help16.png"),
LargeImage = LoadPngImgSource("help32.png"),
ShowImage = true,
ShowText = true,
Size = RibbonItemSize.Large,
Orientation = Orientation.Vertical
};
panel.Items.Add(helpButton);

RibbonToolTip communityTip = CreateToolTip(
Expand All @@ -162,14 +165,12 @@ public void Terminate() { }
private RibbonTab FindOrMakeTab(string name)
{
// check to see if tab exists
RibbonTab tab = ribbon.Tabs.Where(o => o.Title.Equals(name)).FirstOrDefault();
RibbonTab tab = ribbon.Tabs.FirstOrDefault(o => o.Title.Equals(name));

// if not, create a new one
if (tab == null)
{
tab = new RibbonTab();
tab.Title = name;
tab.Id = name;
tab = new RibbonTab { Title = name, Id = name };
ribbon.Tabs.Add(tab);
}

Expand All @@ -189,12 +190,14 @@ private RibbonPanelSource CreateButtonPanel(string name, RibbonTab tab)

private RibbonToolTip CreateToolTip(string title, string content)
{
RibbonToolTip toolTip = new();

//toolTip.Command = "";
toolTip.Title = title;
toolTip.Content = content;
toolTip.IsHelpEnabled = true; // Without this "Press F1 for help" does not appear in the tooltip
RibbonToolTip toolTip =
new()
{
//toolTip.Command = "";
Title = title,
Content = content,
IsHelpEnabled = true // Without this "Press F1 for help" does not appear in the tooltip
};

return toolTip;
}
Expand All @@ -208,18 +211,19 @@ private RibbonButton CreateButton(
string imageName = ""
)
{
var button = new RibbonButton();

// ribbon panel source info assignment
button.Text = name;
button.Id = name;
button.ShowImage = true;
button.ShowText = true;
button.ToolTip = tooltip;
button.HelpSource = new System.Uri("https://speckle.guide/user/autocadcivil.html");
button.Size = RibbonItemSize.Large;
button.Image = LoadPngImgSource(imageName + "16.png");
button.LargeImage = LoadPngImgSource(imageName + "32.png");
var button = new RibbonButton
{
// ribbon panel source info assignment
Text = name,
Id = name,
ShowImage = true,
ShowText = true,
ToolTip = tooltip,
HelpSource = new System.Uri("https://speckle.guide/user/autocadcivil.html"),
Size = RibbonItemSize.Large,
Image = LoadPngImgSource(imageName + "16.png"),
LargeImage = LoadPngImgSource(imageName + "32.png")
};

// add ribbon button pannel to the ribbon panel source
if (sourcePanel != null)
Expand All @@ -243,8 +247,8 @@ private ImageSource LoadPngImgSource(string sourceName)
{
try
{
string resource = this.GetType()
.Assembly.GetManifestResourceNames()
string resource = GetType().Assembly
.GetManifestResourceNames()
.Where(o => o.EndsWith(sourceName))
.FirstOrDefault();
Assembly assembly = Assembly.GetExecutingAssembly();
Expand Down Expand Up @@ -272,8 +276,7 @@ public ButtonCommandHandler(string commandParameter)

public void Execute(object parameter)
{
RibbonButton btn = parameter as RibbonButton;
if (btn != null)
if (parameter is RibbonButton)
{
switch (commandParameter)
{
Expand All @@ -289,6 +292,8 @@ public void Execute(object parameter)
case "SpeckleDocs":
SpeckleAutocadCommand.SpeckleDocs();
break;
default:
break;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
using System.Runtime.InteropServices;
using System.Threading;

using Autodesk.AutoCAD.ApplicationServices;

#if ADVANCESTEEL
using Autodesk.AdvanceSteel.Runtime;
#else
Expand All @@ -18,7 +16,6 @@
using Avalonia.Controls;
using Avalonia.ReactiveUI;

using DesktopUI2;
using DesktopUI2.ViewModels;
using DesktopUI2.Views;
using Speckle.ConnectorAutocadCivil.UI;
Expand Down Expand Up @@ -150,35 +147,3 @@ public static void SpeckleDocs()
catch { }
}
}

/*
[CommandMethod("SpeckleSchema", CommandFlags.UsePickSet | CommandFlags.Transparent)]
public static void SetSchema()
{
var ids = new List<ObjectId>();
PromptSelectionResult selection = Doc.Editor.GetSelection();
if (selection.Status == PromptStatus.OK)
ids = selection.Value.GetObjectIds().ToList();
foreach (var id in ids)
{
// decide schema here, assumption or user input.
string schema = "";
switch (id.ObjectClass.DxfName)
{
case "LINE":
schema = "Column";
break;
}
// add schema to object XData
using (Transaction tr = Doc.TransactionManager.StartTransaction())
{
DBObject obj = tr.GetObject(id, OpenMode.ForWrite);
if (obj.XData == null)
obj.XData = new ResultBuffer(new TypedValue(Convert.ToInt32(DxfCode.Text), schema));
else
obj.XData.Add(new TypedValue(Convert.ToInt32(DxfCode.Text), schema));
}
}
}
*/
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
Expand All @@ -23,8 +22,8 @@ namespace Speckle.ConnectorAutocadCivil.Storage;
/// </remarks>
public static class SpeckleStreamManager
{
readonly static string SpeckleExtensionDictionary = "Speckle";
readonly static string SpeckleStreamStates = "StreamStates";
static readonly string SpeckleExtensionDictionary = "Speckle";
static readonly string SpeckleStreamStates = "StreamStates";

/// <summary>
/// Returns all the speckle stream states present in the current document.
Expand Down Expand Up @@ -105,8 +104,8 @@ public static void WriteStreamStateList(Document doc, List<StreamState> streamSt
NOD.SetAt(SpeckleExtensionDictionary, speckleDict);
tr.AddNewlyCreatedDBObject(speckleDict, true);
}
var xRec = new Xrecord();
var value = JsonConvert.SerializeObject(streamStates) as string;
Xrecord xRec = new();
string value = JsonConvert.SerializeObject(streamStates);
xRec.Data = CreateResultBuffer(value);
speckleDict.SetAt(SpeckleStreamStates, xRec);
tr.AddNewlyCreatedDBObject(xRec, true);
Expand Down Expand Up @@ -145,14 +144,14 @@ private static string GetXrecordData(Xrecord pXrecord)

private static string Base64Encode(string plainText)
{
var plainTextBytes = System.Text.Encoding.UTF8.GetBytes(plainText);
return System.Convert.ToBase64String(plainTextBytes);
var plainTextBytes = Encoding.UTF8.GetBytes(plainText);
return Convert.ToBase64String(plainTextBytes);
}

private static string Base64Decode(string base64EncodedData)
{
var base64EncodedBytes = System.Convert.FromBase64String(base64EncodedData);
return System.Text.Encoding.UTF8.GetString(base64EncodedBytes);
var base64EncodedBytes = Convert.FromBase64String(base64EncodedData);
return Encoding.UTF8.GetString(base64EncodedBytes);
}

private static IEnumerable<string> SplitString(string text, int chunkSize)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ public void RegisterAppEvents()

public void Application_LayerChanged(object sender, EventArgs e)
{
if (UpdateSelectedStream != null)
{
UpdateSelectedStream();
}
UpdateSelectedStream?.Invoke();
}

//checks whether to refresh the stream list in case the user changes active view and selects a different document
Expand Down Expand Up @@ -55,10 +52,7 @@ private void Application_DocumentActivated(object sender, DocumentCollectionEven
// Triggered when a document window is activated. This will happen automatically if a document is newly created or opened.
if (e.Document == null)
{
if (SpeckleAutocadCommand.MainWindow != null)
{
SpeckleAutocadCommand.MainWindow.Hide();
}
SpeckleAutocadCommand.MainWindow?.Hide();

MainViewModel.GoHome();
return;
Expand All @@ -70,10 +64,7 @@ private void Application_DocumentActivated(object sender, DocumentCollectionEven
SpeckleAutocadCommand.CreateOrFocusSpeckle();
}

if (UpdateSavedStreams != null)
{
UpdateSavedStreams(streams);
}
UpdateSavedStreams?.Invoke(streams);

MainViewModel.GoHome();
}
Expand Down
Loading

0 comments on commit 54ecc18

Please sign in to comment.