scipp / sciline

Build scientific pipelines for your data
https://scipp.github.io/sciline/
BSD 3-Clause "New" or "Revised" License
10 stars 2 forks source link

Detect duplicate types #138

Open jl-wynen opened 7 months ago

jl-wynen commented 7 months ago

https://github.com/scipp/esssans/pull/102 had a duplicate type. This can break pipelines. Can we detect them automatically somehow? Maybe we can use a heuristic to search for them in source code or hook into a linter to list all type definitions. This could be hooked into pre-commit.

SimonHeybrock commented 6 months ago

Can you clarify what is duplicate and what broke? Having types with identical names in different modules sounds like a valid thing?

jl-wynen commented 6 months ago

See the linked PR. There were two identically named types and some providers used one, other used the other. This meant that those providers did not connect into a pipeline as expected.

SimonHeybrock commented 6 months ago

Yes, but can you clarify what Sciline could/should do about this? Isn't it a valid application to have types of the same naming in different packages or modules?

jl-wynen commented 6 months ago

Valid but confusing. But note that this issue is about types within a single project. I suggested check using an external tool, not in Sciline. This would prevent using the same name in different modules in the same package which is almost definitely a mistake.

SimonHeybrock commented 6 months ago

Makes sense. Do you want to transfer the issue to another project then?