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

Add an alphabetic check for submissions #1953

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

sjledoux
Copy link

@sjledoux sjledoux commented Apr 1, 2024

This PR attempts to add a check that will assess whether the "business name" of entries in the private domain are in alphabetical order, and that the domains listed under each entry are in the correct order at time of submission.

The check contained here attempts to use a regular expression to identify entries into the private domains list. However, this is not perfect - it seems like there is some inconsistency with the formatting of entries, making it difficult to pick a perfect way of identifying entries in the current list. The current expression identifies the vast majority of entries from what I can tell, but happy to use an alternative method if one exists.

Additionally, while creating this check it became apparent that there are currently many entries in the list that are not sorted correctly according to the existing guidelines. I'm happy to re-sort the list accordingly in this PR or in a preceding PR before this is merged.

@simon-friedberger simon-friedberger mentioned this pull request Apr 3, 2024
10 tasks
@anthonyryan1
Copy link
Contributor

Not a part of this project, but I think it would be valuable to add this to make test as well, which is part of the submission instructions. It'll allow people to evaluate order problems before submitting to GitHub.

It's beneficial to ensure all tests are run as part of make test in my opinion, or people may mistakenly think they've completed all the checks without running this.

@simon-friedberger
Copy link
Contributor

Domains sorted by the ruby script linked from the docs:

cdn77-ssl.net
r.cdn77.net
ssl.origin.cdn77-secure.org
c.cdn77.org
rsc.cdn77.org

Which makes this script complain:

The submission for CDN77.com contains domains in an improper order, which are:
('cdn77-ssl.net', 'r.cdn77.net')
('ssl.origin.cdn77-secure.org', 'c.cdn77.org')

I think the ruby script is wrong. It sorts cdn77-ssl before cdn77 because - < . but that is just an artifact of it concatenating the strings.

You get the same behavior with this Python code:

#!/usr/bin/env python3

import sys
lines = sys.stdin.readlines()
lines = list(map(lambda line: line.strip(), lines))
sorted_lines = sorted(lines, key=lambda x: ".".join(list(reversed(x.split(".")))))
for line in sorted_lines:
    print(line)

while what we want is

sorted_lines = sorted(lines, key=lambda x: list(reversed(x.split("."))))

@simon-friedberger
Copy link
Contributor

@sjledoux Relaying @weppos: Can you please add tests?

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.

None yet

3 participants