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

How to check/"stat" text file within BIDS validator? #1279

Closed
sappelhoff opened this issue May 7, 2021 · 2 comments · Fixed by #1281
Closed

How to check/"stat" text file within BIDS validator? #1279

sappelhoff opened this issue May 7, 2021 · 2 comments · Fixed by #1281

Comments

@sappelhoff
Copy link
Member

I want to add a feature to the bids-validator:

  • if the recommended README file is present:
  • check how "large" it is (either how many lines, or how much content?)
  • raise a warning if it's only very little (threshold to be determined)

I think it could go well after this line as an else:

https://github.com/bids-standard/bids-validator/blob/b40aa16a4250bb4aaacd2c063dad108084f6b83f/bids-validator/validators/bids/checkReadme.js#L10-L12

How would I read the file contents? ... or maybe even a simply stat README (like in bash) and extracting the size would be sufficient for me to either say: "yup, that seems large enough", versus "that's a suspiciously small README. I'll raise a warning to make the user aware that the README is crucial and that they please spend more effort on it"

Related to

@nellh
Copy link
Member

nellh commented May 11, 2021

Post #1244 / #1245 the idea is to consolidate this to FileList and File objects. file.size would be the only way to access the size.

Currently it requires the check to handle file.size for browsers (the above API) and file.stats.size for Node. Example: https://github.com/bids-standard/bids-validator/blob/571767eb23b4b8cae133166d0fcb62a629c8f191/bids-validator/utils/files/validateMisc.js#L5

File contents should also follow the web APIs going forward.

@sappelhoff
Copy link
Member Author

Post #1244 / #1245 the idea is to consolidate this to FileList and File objects. file.size would be the only way to access the size.

that sounds like it would be a great improvement 👍

Thanks for the hint, that allows me to proceed with what we have right now.

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

Successfully merging a pull request may close this issue.

2 participants