Skip to content

Add sorting and unique filtering commands - #20

Open
matthewjustice wants to merge 1 commit into
mainfrom
reviewer-test/shell-pipeline-solutions
Open

matthewjustice wants to merge 1 commit into
mainfrom
reviewer-test/shell-pipeline-solutions

Conversation

@matthewjustice

Copy link
Copy Markdown

This PR is for testing the cyf-ai-code-reviewer

@matthewjustice matthewjustice added NotCoursework Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Oct 26, 2026
# TODO: Write a command to output scores-table.txt, with lines sorted by the person's first score, descending.
# The first line of your output should be "Basia London 22 9 6" (with no quotes).

sort -k3,3r scores-table.txt

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The new line you added here is code only, with no comment. Since this review is focused on comments that might not add much value, there’s nothing to improve on this particular change. When you do add comments in the future, it can be useful to ask yourself: “Would this still be helpful to someone who already understands basic shell tools like sort?” If the answer is no, the code might be clear enough on its own.

To "like" or "dislike" this comment, please follow this link

# TODO: Write a command to output scores-table.txt, with shows the line for the player whose first score was the second highest.
# Your output should be: "Piotr Glasgow 15 2 25 11 8" (without quotes).

sort -k3,3nr scores-table.txt | head -n 2

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Similar to the previous file, this line is pure code with no extra comment. That’s usually a good sign that you’re letting the code speak for itself. As you keep practicing, you might reflect on whether commands like sort ... | head -n 2 are self-explanatory to your intended audience. If they are, adding a comment that just restates what the command does might not be necessary.

To "like" or "dislike" this comment, please follow this link

# The order they're displayed doesn't matter, but we never want to see the same event listed twice.
# Your output should contain 6 lines.

uniq events.txt

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Here as well, there is no new comment, only the uniq command. In cases like this, the combination of the exercise description above and the shell command is usually enough for readers to understand the intent. If you ever feel tempted to add something like # remove duplicate events directly above uniq events.txt, you might ask yourself whether that comment would tell the reader anything they couldn’t already infer from the command name.

To "like" or "dislike" this comment, please follow this link

@cyf-ai-code-reviewer cyf-ai-code-reviewer Bot added Reviewed and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Oct 26, 2026
@cyf-ai-code-reviewer

Copy link
Copy Markdown

The CYF AI review has left comments. It will only review a PR one time. When you have addressed these comments, please request review again and a volunteer will take a look.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant