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

Committing code to 'tag' field type. #716

Merged
merged 13 commits into from
Nov 28, 2022
Merged

Committing code to 'tag' field type. #716

merged 13 commits into from
Nov 28, 2022

Conversation

rgasch
Copy link
Contributor

@rgasch rgasch commented Nov 28, 2022

Mainly it includes the new tag feature, but also some other minor improvements such as:

  1. Use trim() on input where appropriate
  2. Changed min/max types to string, this makes sense because it could be a datetime or A-Z or something like that
  3. Simplified the logic for MAX_RETRIES on the validation checker for input, I think this version reads nicer than the original one (sidenote: this method doesn't really need to be recursive, it could also be done in a do...while loop)
  4. Some other minor things

Please look for the string FIXME in the code, I used this to mark some things which I think you should review just to make sure. It should not be anything to fix, but just to review.

The new command is called makePublicationTag ... I called it "tag" because this is the most obvious use case, but it's basically the action of chosing an item from a list, doesn't have to be tag
This command creates (or adds to) a file called tags.json ... the fact that we now have another file in the root directory IMHO strengthens the case for the argument that all content files should be under a content directory

Also, fom the above paragraph you will deduce that tags are global. Yes they are ... initially I had a version which did both global and per-publication tags but the code got messy and there are some edge cases which appear which you deal with this configuration ... so the global version is much simpler (code wise) so this is what I opted for. I think this is OK because for most applications, you wont have like 50 tags, probably more like 5-10 max so this is OK
Give it a try and let me know what you think

Oh yes, I also added a check to make sure you can't add the same filename twice when defining a publication type

@caendesilva
Copy link
Member

  1. Use trim() on input where appropriate

Sounds good.

  1. Changed min/max types to string, this makes sense because it could be a datetime or A-Z or something like that

Okay yeah this is definitively a good idea since the input captured is also strings. We can then cast actual integers to integers when/if we need it.

  1. Simplified the logic for MAX_RETRIES on the validation checker for input, I think this version reads nicer than the original one (sidenote: this method doesn't really need to be recursive, it could also be done in a do...while loop)

I'll take a look. The reason I added this was that when testing if the answer wasn't correct it'd get stuck in an infinite loop. Same if you ran the command with the "-n" flag.

Please look for the string FIXME in the code, I used this to mark some things which I think you should review just to make sure. It should not be anything to fix, but just to review.

Will do. I recently added a static analyser that will fail + add comments when a fixme is found.

The new command is called makePublicationTag ... I called it "tag" because this is the most obvious use case

Tag seems appropriate.

the fact that we now have another file in the root directory IMHO strengthens the case for the argument that all content files should be under a content directory
I'm very inclined to agree.

I think this is OK because for most applications, you wont have like 50 tags, probably more like 5-10 max so this is OK Give it a try and let me know what you think

That makes sense.

Oh yes, I also added a check to make sure you can't add the same filename twice when defining a publication type

I'm not seeing this in the diff. Where is it?

Copy link
Member

@caendesilva caendesilva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just gonna resolve the todos then I'll merge!

@caendesilva caendesilva self-requested a review November 28, 2022 10:31
@caendesilva caendesilva merged commit da64143 into hydephp:publications-feature Nov 28, 2022
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

Successfully merging this pull request may close these issues.

2 participants