Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Migrate Java IO to Java NIO APIs where applicable #34

Open
davidburstrom opened this issue Oct 31, 2020 · 4 comments
Open

Comments

@davidburstrom
Copy link

TL;DR

Use java.nio.file.Path and java.nio.file.Files operations instead of java.io.File wherever possible.

Benefits

  • Easier to integrate in other tools, as the reliance on the real file system goes away.
  • Tests can run faster as one can use https://github.com/google/jimfs to do file operations, instead of hitting the real file system.

My particular reason for this suggestion is that the ValidRelativeLinksRule is trying to resolve files outside of the analysed file. If (for particular reasons) only the analysed file is available on the real file system, the rule will raise a warning. In my case, the referenced file is available in a virtual file system, which is not readable through Java IO.

Cannot be migrated

The APIs provided by Gradle are currently centered around using Files. That is OK, since MarkdownLintPlugin simply has to call projectDir.toPath to convert into the Java NIO realm, given that everything else is migrated.

References:

@davidburstromspotify
Copy link
Contributor

@mattmook Hi Matt! If you're interested in a PR for this, just let me know.

davidburstromspotify added a commit to davidburstromspotify/markdown-lint that referenced this issue Dec 14, 2020
davidburstromspotify added a commit to davidburstromspotify/markdown-lint that referenced this issue Dec 15, 2020
mattmook pushed a commit that referenced this issue Dec 16, 2020
@davidburstromspotify
Copy link
Contributor

@mattmook You can close this FR now :)

@mattmook
Copy link
Member

Will publish this next week and close then. Planning to split out #32 at the same time

@davidburstromspotify
Copy link
Contributor

Thanks! I guess Christmas got rightfully in the way :)

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

No branches or pull requests

3 participants