Page MenuHomePhabricator

C#: .cs file naming with PascalCase
Open, WishlistPublic

Description

  1. .cs file naming with PascalCase
    • Now : efl_ui_widget.eo.cs
    • Suggested : Efl.Ui/Widget.eo.cs (Efl.Ui is a directory and Widget.cs without eo)
lauromoura triaged this task as High priority.

We may encounter some difficulty generating the files in sub folders as a meson issue [1] limits the output of custom_target command to be placed in the same folder as it is called.

While we could actually generate the files inside a folder, this could lead to meson losing track of generated files, causing everyone to be re-generated when running meson.

What if we replace efl_ui_widget.eo.cs with Efl.Ui.Widget.cs directly?

PS: T8168 should be done soon to use dotnet build to build the C# bindings directly instead of using that patched meson.

[1] https://github.com/mesonbuild/meson/issues/2320

What's the issue with the current approach? it's not clear from the task description.

@segfaultxavi
The main issues of this task are as follows.

  1. All C# source files (.cs) should be located in the directory named fully-qualified namespace.
    • e.g. cs file for class Efl.A.cs should be located in directory Efl. This means that Efl/A.cs
  1. All C# source files (.cs) should be represented in PascalCase.
    • e.g. layout_base.eo.cs -> LayoutBase.eo.cs
  1. All C# source files (.cs) should not contain unnecessary suffix in the file name (i.e. .eo)
    • e.g. A.eo.cs -> A.cs

If the above things are applied to efl_ui_layout_base.eo.cs, then it should be as follows.

  • efl_ui_layout_base.eo.cs -> Efl.Ui/LayoutBase.cs

@segfaultxavi
The main issues of this task are as follows.

  1. All C# source files (.cs) should be located in the directory named fully-qualified namespace.
    • e.g. cs file for class Efl.A.cs should be located in directory Efl. This means that Efl/A.cs

This may be hard with meson. See my first comment on its limitations.

@Jaehyun_Cho, what would be the reason for these requirements? (We're not questioning them, just trying to understand the issue better. :) )

Some C# standard? Helping building c# with dotnet on tizen (Would D9717 help?)?

  1. All C# source files (.cs) should be represented in PascalCase.
    • e.g. layout_base.eo.cs -> LayoutBase.eo.cs

Doable.

  1. All C# source files (.cs) should not contain unnecessary suffix in the file name (i.e. .eo)
    • e.g. A.eo.cs -> A.cs

Doable.

If the above things are applied to efl_ui_layout_base.eo.cs, then it should be as follows.

  • efl_ui_layout_base.eo.cs -> Efl.Ui/LayoutBase.cs

@lauromoura

This may be hard with meson. See my first comment on its limitations.

I totally understand. If it is hard on upstream with meson, then I consider that I run some script manually to generate directories and change the cs names only for Tizen.

@Jaehyun_Cho, what would be the reason for these requirements? (We're not questioning them, just trying to understand the issue better. :) )

The main reason is to make class name and cs file name same :)
As you know, efl_ui_layout.eo.cs contains class Layout in the namespace Efl and Ui.
Therefore, it was suggested that efl_ui_layout.eo.cs should be renamed to Layout.cs which is the same name with class Layout. And Layout.cs should be moved to Efl.Ui namespace directory to avoid duplicate cs file names.

Some C# standard? Helping building c# with dotnet on tizen (Would D9717 help?)?

I don't know well about it. I will look into D9717.

@Jaehyun_Cho, what would be the reason for these requirements? (We're not questioning them, just trying to understand the issue better. :) )

The main reason is to make class name and cs file name same :)
As you know, efl_ui_layout.eo.cs contains class Layout in the namespace Efl and Ui.
Therefore, it was suggested that efl_ui_layout.eo.cs should be renamed to Layout.cs which is the same name with class Layout. And Layout.cs should be moved to Efl.Ui namespace directory to avoid duplicate cs file names.

Would this be related to SA1402 - File May Contain A Single Type rule?

If so, could could be problematic with Eo as eo files may contain multiple types in the same file (specially the eot files). It seems to be a common pattern in C# world to disable this rule for generated files.

If actually needed, we could disable this rule for generated code and keep it only for the manual code.

@lauromoura
I will ask the reporter who raised this issue in detail and I will let you know.

@lauromoura
It is confirmed that SA1402 is not mandatory but it is recommended.

Since SA1402 is problematic with eo and SA1402 requires additional effort, I think it would be better we do not apply SA1402 for now.

We focus on other mandatory rules and major issues and then we may consider SA1402 later when we are able to do it.

lauromoura lowered the priority of this task from High to Wishlist.Mon, Sep 9, 2:05 PM

@lauromoura
It is confirmed that SA1402 is not mandatory but it is recommended.

Since SA1402 is problematic with eo and SA1402 requires additional effort, I think it would be better we do not apply SA1402 for now.

We focus on other mandatory rules and major issues and then we may consider SA1402 later when we are able to do it.

Ok. Lowering the priority of this one.