-
Notifications
You must be signed in to change notification settings - Fork 4
Autograder #20
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
base: main
Are you sure you want to change the base?
Autograder #20
Conversation
📝 WalkthroughWalkthroughIntroduces a Makefile to set up and run a local autograding harness and adds a C++ implementation of a sort function that returns a sorted copy of an input vector. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Dev as Developer
participant MK as Makefile
participant SH as Shell
participant AF as autograder_folder
participant CC as Compiler
participant EX as exec (tests)
Dev->>MK: make all
MK->>SH: extract autograde.tar
SH->>AF: create/populate folder
MK->>AF: copy sort.cpp
MK->>CC: compile sort.cpp + test.cpp -> exec
CC-->>MK: build result (exec)
MK->>EX: run exec
EX-->>Dev: test output
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
Cpp-sortlab/sort.cpp (1)
5-8
: Avoid the extra copy for better performance.You already receive the vector by value (a copy). Sort it in place and return it to eliminate the second copy.
Apply this diff:
-std::vector<int> sort(std::vector<int> input) { - std::vector<int> copy = input; - std::sort(copy.begin(), copy.end()); - return copy; -} +std::vector<int> sort(std::vector<int> input) { + std::sort(input.begin(), input.end()); + return input; +}Cpp-sortlab/autograde-Makefile (2)
3-8
: Make paths and build flags robust; support running from repo root.Use the Makefile’s directory to reference files and add standard C++ flags.
Apply this diff to the recipe:
-copy: - tar -xvf autograde.tar - cp sort.cpp autograder_folder - cd autograder_folder && \ - g++ sort.cpp test.cpp -o exec && \ - ./exec +copy: + tar -xvf $(SRCDIR)/autograde.tar + cp $(SRCDIR)/sort.cpp autograder_folder + cd autograder_folder && \ + $(CXX) $(CXXFLAGS) sort.cpp test.cpp -o exec && \ + ./execAdd these definitions at the top of the file:
.PHONY: all copy clean SRCDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) CXX ?= g++ CXXFLAGS ?= -std=c++17 -O2 -Wall -Wextra -Wpedantic
10-11
: Harden clean target.Use -rf to avoid errors if the folder doesn’t exist.
Apply this diff:
-clean: - rm -r autograder_folder +clean: + rm -rf autograder_folder
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (1)
Cpp-sortlab/autograde.tar
is excluded by!**/*.tar
,!**/*.tar
📒 Files selected for processing (2)
Cpp-sortlab/autograde-Makefile
(1 hunks)Cpp-sortlab/sort.cpp
(1 hunks)
🔇 Additional comments (3)
Cpp-sortlab/sort.cpp (2)
5-9
: Behavior is correct and non-mutating.Returns a sorted copy without altering the caller’s input. Good use of std::sort.
1-1
: Confirm header availability in the build dir.The Makefile copies only sort.cpp into autograder_folder. Please verify autograde.tar provides sort.hpp in that folder at compile time.
Cpp-sortlab/autograde-Makefile (1)
3-5
: Verify tarball layout before copy.Ensure autograde.tar actually creates autograder_folder; otherwise insert a mkdir -p autograder_folder before cp.
No description provided.