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

Sort alphabetically entries in project.json file #19

Closed
apupier opened this issue Mar 23, 2018 · 12 comments
Closed

Sort alphabetically entries in project.json file #19

apupier opened this issue Mar 23, 2018 · 12 comments

Comments

@apupier
Copy link
Contributor

apupier commented Mar 23, 2018

it will be easier when having the file opened to check for projects if they exist or not

@castastrophe
Copy link
Contributor

It's loosely sorted alphabetically but since it is manually updated, it's not that easy to keep it perfect. The listing should be alphabetical though on the front-end and you're welcome to start there. We're also asking new entries be added as close to alphabetical as possible.

@greg-hellings
Copy link
Contributor

Once the PRs settle down it should be easy to hack a script that will truly alphabetize it once, then you can enforce it permanently after that. Or break out each entry into its own file, as a later PR suggests would be a much easier maintenance headache.

@iranzo
Copy link
Contributor

iranzo commented Mar 23, 2018

Yes. invidual entries will also reduce problems with commits conflicting

@iranzo
Copy link
Contributor

iranzo commented Mar 23, 2018

#!/usr/bin/env python
import json
data=json.loads(open('projects.json','r').read())
def getKey(item):
    return item['projectName']

newdata=sorted(data,key=getKey)
filename='sorted.json'
with open(filename, 'w') as fd:
    json.dump(newdata, fd, indent=2)

@iranzo
Copy link
Contributor

iranzo commented Mar 23, 2018

Covered in #100

@castastrophe
Copy link
Contributor

Thanks! I added a question in the PR.

@Fryguy
Copy link
Member

Fryguy commented Apr 25, 2018

Since the PR was closed, I'm commenting here. Another possibility is to use a CI system like travis, create a test that verifies the sorting in the json file, and then fail the PR if it's not alphabetical.

@iranzo
Copy link
Contributor

iranzo commented Apr 25, 2018 via email

@Fryguy
Copy link
Member

Fryguy commented Apr 27, 2018

I would do a second update if it's not sorted to do that automatically and save time of submitter

My only reason against that idea is commit-history churn...It will read like "add-a-project, move-a-project, add-a-project, move-a-project"

@iranzo
Copy link
Contributor

iranzo commented Apr 28, 2018

We'll that's not the best approach, but asking users to keep order in a big file that can be editted in parallel from several other users isn't either... probably file-per-project would have been better and will avoid conficlts and sorting will come from the static site generator (order once per web upload)

@bproffitt
Copy link
Member

If this is something we can add to the CI check, then I am for it. But I would put this as a low-priority need, since the maintainers of this site should be able to alphabetize during the quarterly audits.

@bproffitt
Copy link
Member

#70 is a better approach and would solve this issue. Closing in deference to that approach.

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

No branches or pull requests

6 participants