serokell/xrefcheck

Try to exploit newtypes over FilePath more to better separate semantics

Martoon-00 opened this issue · 1 comments

Clarification and motivation

After #230 we still have some ambiguities around FilePath, e.g. it may be always in Posix format or platform dependent.

I first abandoned this idea, but it starts getting more desired to me just as a measure to make the code more readable. Namely: let's introduce some MarkdownFilePath or PosixFilePath that would be used in markdown links. And leave FilePath for platform-dependent version of path.

This way one can easily understand the expected format at any place in the code just by looking at the type.

We may end up using posix-formatted paths in at least two places after #230 - in FileInfo and in error type, so having a separate type starts to make sense for me.

On implementation notes:

  • We will likely need to start separating local links and remote links in FileInfo, let's probably do so.

Acceptance criteria

  • We try to introduce the mentioned newtype.
  • Looking at the result, we assess how much sense it makes.

@aeqz I'd suggest doing this after #230 but before #239.