-
Notifications
You must be signed in to change notification settings - Fork 100
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
Fix: Code style #858
Fix: Code style #858
Conversation
KNoCompression = 0x0, | ||
KSnappyCompression = 0x1 |
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.
We can remove the K
src/ApplicationLogs/LogReader.cs
Outdated
@@ -56,16 +56,16 @@ protected override void OnSystemLoaded(NeoSystem system) | |||
} | |||
|
|||
[RpcMethod] | |||
public JToken GetApplicationLog(JArray _params) | |||
public JToken GetApplicationLog(JArray @params) |
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.
parameters, value?
src/StateService/StatePlugin.cs
Outdated
@@ -176,36 +176,36 @@ private void OnVerifyProof(UInt256 root_hash, string proof) | |||
} | |||
|
|||
[RpcMethod] | |||
public JToken GetStateRoot(JArray _params) | |||
public JToken GetStateRoot(JArray @params) |
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 and in the rest of them, I don't like the @
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.
Using @ for reserved words to use them as a variable is a C# standard. But I'll update it. And please, we are working on the core, not some personal project, please avoid using "like" or "not like", it sounds like you are using your personal feelings (though i know you are not) instead of professional judgements.
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.
Using @ for reserved words to use them as a variable is a C# standard. But I'll update it. And please, we are working on the core, not some personal project, please avoid using "like" or "not like", it sounds like you are using your personal feelings (though i know you are not) instead of professional judgements.
Could you show me where said that use a reserved word is a good practice?
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.
I am not saying using reserved word is a good practice, cause if i were the one who wrote the code, i will not use params
as the parameter. But it is params and is used as _params, which is definately not a good practice. You said we should have a good code style, yet you allow someone to use _params
as the name of the parameter, this pr trys to fix the bad practice
.
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.
@Liaojinghui, you're trying to change some established code. _params
was there since like forever, so for good or bad, but everyone just got used to it being this way. If all methods consistently use this name, no one can really object adding another one using the same style, that's just consistency. Is it a bad name? Sure it is. But just making it @params
is not an improvement to me, at least not worth the trouble.
parameters
is a different story, nice to have it instead and have it used consistently for every method as well. 👍
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.
You know you can use the analyzers in Visual Studio to do this all for you automatically. Also we should be using the .editorconfig
so this doesn't happen again. See #826
@@ -34,7 +34,7 @@ public DBFTPlugin() | |||
|
|||
public DBFTPlugin(Settings settings) : this() | |||
{ | |||
this.settings = settings; | |||
this._settings = settings; |
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.
You should remove this
. Dotnet coding standards, 99% of professional c# developers dont use that method anymore.
@@ -44,55 +44,55 @@ public override void Dispose() | |||
|
|||
protected override void Configure() | |||
{ | |||
settings ??= new Settings(GetConfiguration()); | |||
_settings ??= new Settings(GetConfiguration()); |
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.
should remove the class. so it would be
_settings ??= new(GetConfiguration());
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.
This does not matter. Many places keep it, many remove it.
@cschuchardt88 Only if someone does it. Anything in neo core can take years. |
close as not planed, may work with editorconfig |
Since discussed that the code style is a thing for the core, this pr fixs some of the code style issues that has being there for years.