-
Notifications
You must be signed in to change notification settings - Fork 668
Code smells Part II #10668
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code smells Part II #10668
Conversation
| } | ||
|
|
||
| public static ShaderDescription VertexShaderDynamoMeshDescription = new ShaderDescription(nameof(VertexShaderDynamoMeshDescription), ShaderStage.Vertex, | ||
| public static readonly ShaderDescription VertexShaderDynamoMeshDescription = new ShaderDescription(nameof(VertexShaderDynamoMeshDescription), ShaderStage.Vertex, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API breaking, but team agreed on Helix related work
| } | ||
|
|
||
| public static ShaderDescription PixelShaderDynamoMeshDescription = new ShaderDescription(nameof(PixelShaderDynamoMeshDescription), ShaderStage.Pixel, | ||
| public static readonly ShaderDescription PixelShaderDynamoMeshDescription = new ShaderDescription(nameof(PixelShaderDynamoMeshDescription), ShaderStage.Pixel, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
| { | ||
| geometryModels = Element3DDictionary | ||
| .Where(x => x.Key.Contains(node.AstIdentifierGuid) && x.Value as Element3D != null).ToArray(); | ||
| .Where(x => x.Key.Contains(node.AstIdentifierGuid) && x.Value is Element3D).ToArray(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SQ has been back and forth about this, which made me think we may not need this type check at all
| if (!pkgResponse.success) | ||
| { | ||
| throw new Exception(pkgResponse.message); | ||
| throw new ApplicationException(pkgResponse.message); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, no more System Exception thrown by user code :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@QilongTang I know this has been merged already, but as a future reference, ApplicationException is not recommended to be used anymore. From https://docs.microsoft.com/en-us/dotnet/api/system.applicationexception?view=netcore-3.1:
You should derive custom exceptions from the Exception class rather than the ApplicationException class. You should not throw an ApplicationException exception in your code, and you should not catch an ApplicationException exception unless you intend to re-throw the original exception.
I think in this particular case, the most appropriate fix would be to throw a PackageManagerException which derives from Exception.
| /// <returns> true if the element was found </returns> | ||
| public static bool GetFirstNonArrayStackValue(StackValue svArray, ref StackValue sv, RuntimeCore runtimeCore) | ||
| { | ||
| RuntimeMemory rmem = runtimeCore.RuntimeMemory; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused local var
| protected PythonNodeBase(IEnumerable<PortModel> inPorts, IEnumerable<PortModel> outPorts) : base(inPorts, outPorts) | ||
| { | ||
| ArgumentLacing = LacingStrategy.Disabled; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Constructors should be grouped near
| public void GettingNodeNameDoesNotTriggerPropertyChangeCycle() | ||
| { | ||
| //add a node | ||
| var numNode = new CoreNodeModels.Input.DoubleInput { X = 100, Y = 100 }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ModeBase.X is obsolete, seems here we do not really need positions to be set
| /// </summary> | ||
| /// <param name="packageDownloadHandle">package download handle</param> | ||
| /// <param name="downloadPath">package download path</param> | ||
| internal void InstallStateCheck(PackageDownloadHandle packageDownloadHandle, string downloadPath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor thing: As we are assigning the package state in this method, may be we can call it something like SetPackageState.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@reddyashish Make sense. Let me update!
|
Looks good to me @QilongTang. |
|
@reddyashish Addressed your comments. Merging. |
Please Note:
DynamoRevitrepo will need to be cherry-picked into all the DynamoRevit Release branches that Dynamo supports. Contributors will be responsible for cherry-picking their reviewed commits to the other branches after aLGTMlabel is added to the PR.Purpose
Fix some new code smells brought in last week..
Declarations
Check these if you believe they are true
*.resxfilesReviewers
@DynamoDS/dynamo
FYIs
(FILL ME IN, Optional) Names of anyone else you wish to be notified of