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

Open
#5 0 comments 0 reactions 1 assignee View on GitHub

@alelom is already working on this.

Since Feb 14, 2022.

Assessment

This issue has not been assessed yet.

Description

type:bug
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):
Dominant language
C#
Stars
10
Forks
5
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from BHoM/RDF_Prototypes

All issues in BHoM/RDF_Prototypes

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.