-
Notifications
You must be signed in to change notification settings - Fork 5
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
Specification for File Naming Codes and File Repository Structure #48
Comments
Hi @da2ce7 I was thinking about it when I was working on the first version of the filename validation: https://github.com/Nautilus-Cyberneering/chinese-ideographs/blob/main/.github/actions/validate-filenames/src/validation/validate_filenames.py For this first milestone (POC01) I decided to keep it simple but I can share my initial thoughts about this topic. There are at least two obvious implementations and things to discuss: Basic implementations
Requirements (how friendly we want the validation) Regarding filename validation, I think, we first need to define the requirements. This is the simplest format for a basic filename:
And a concrete example is: The simplest error handling could be for example:
But I wanted to have a better error scope like this:
We also need to know how we want to process the input string. I mean, we could validate the string and fail at the first error or we could try to generate a full report with all errors. I think the second one it's more complicated to implement and I do not think we need it. Readability and maintainability Regarding the obvious solution (RegExps) I think we could easily build it and we could try to write it in a way that is understandable but I'm not sure if we can get the exact error for the validation error (I suppose it's possible). On the other hand, I think defining a formal grammar could help to define and maintain the rules. I wanted to have something like this:
I think with that kind of grammar we could create a parser and get the exact syntax error. If we try this kind of solution there are plenty of options out there: https://tomassetti.me/parsing-in-python/ Links
Maybe there is another simplest solution. I stopped at that point in order to discuss which solution we need and in case we consider this a good one, when we should start with the implementation. |
I've seen your PR now. Maybe you only wanted to define the complete specification but "by example" and not in a more formal way. Is that the intention for this issue? or do you think It could also be a good idea to write a formal specification? |
For the moment I have taken "by example" approach. I think that I have included enough examples to illustrate the basic idea and form of the naming scheme proposed. Later, a formal specification, (including some sort of abstract syntax tree template that formally defines the codes), would of course be a very welcome development. It is normal for such a specification to be written after the initial implementation. |
Define a more complete specification for the file naming, and file repository folder structure conventions.
I have opened a draft pull request #49
This pull request has a rework of the current documentation. However it isn't a formal specification.
The text was updated successfully, but these errors were encountered: