Skip to content
This repository has been archived by the owner on Mar 10, 2022. It is now read-only.

When a path contains '.' or '..' the violation does not show properly in Xcode #35

Closed
acecilia opened this issue Aug 28, 2019 · 0 comments · Fixed by #33
Closed

When a path contains '.' or '..' the violation does not show properly in Xcode #35

acecilia opened this issue Aug 28, 2019 · 0 comments · Fixed by #33

Comments

@acecilia
Copy link
Contributor

  • For showing the errors on Xcode, the printed paths should be absolute and not contain . or .. paths.

  • The directory parameter in the violations(in directory: URL) is not being used in most cases. The reason for such thing is that the URL(fileURLWithPath: relativePath) function is used to convert a String to a URL. Such initializer, when the path is relative, automatically (and silently) sets the base directory to currentDirectoryPath, leading to an absolute path equal to:

    URL(fileURLWithPath: relativePath) = currentDirectoryPath + relativePath
    

    Seems that this is wrong: the path should be relative to the directory parameter. Thus, function URL(fileURLWithPath: relativePath, relativeTo: directory) should be used (only available from .macOS(.v10_11)).

    The reason this problem has not been detected in the tests is because the path property in the Resource object was always returning an absolute path.
    The reason this problem has not been detected in production is because the currentDirectoryPath is the directory where the .projlint.yml lives, as there is no possibility to specify a custom path for it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant