BHoM / BHoM/RDF_Prototypes

Filepath discovery from Type fails when filepath does not contain any portion of the Namespace

Open
#5 0 comments 0 reactions 1 assignee Claimed by @alelom View on GitHub
type:bug
Dominant language
C#
Stars
10
Forks
5
PR merge metrics
No merged PRs in 30d

Description

#### Description:

Currently, the Filepath discovery from Type works so that we match a certain type with a certain repository `.cs` file by taking the filepath of a `.cs` file in the Github folder:
- whose FileName matches the Type.Name
- whose Directory has a subfolder that matches what we call "namespace group". The "namespace group" of the Type is the portion of the namespace that gives the "disciplinary category", e.g. `Geometry`, `Structure`. This is easily extracted from the Type.Namespace e.g. `BH.oM.`**`Geometry`**`.Something` `BH.oM.`**`Structure`**`.Something`. We need this second condition because to avoid matching Types with the same name to the wrong `.cs` files (e.g. a `BH.oM.Geometry.Face` risks matching with a 3DRepo_Toolkit `Face.cs` file).

This second condition however does not always work. For example, StructuralEngineering_Toolkit defines certain types under the namespace `BH.oM.Structure`. We cannot find any file in the StructuralEngineering_Toolkit whose filepath includes the name "structure", however.

A solution could to actually _read_ the content of the files and get the actual namespace associated to the file itself by reading the raw text (find the text `namespace ___someText___ {` with a regex).

#### Steps to reproduce:

#### Expected behaviour:

#### Test file(s):

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.