-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feat [Golang] Context Signal + Excellent Improvement 🤪 #18
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- [+] feat(session.go): add context parameter to ConvertSessionsToCSV function - [+] feat(main.go): add context and signal handling to cancel operations on SIGINT or SIGTERM - [+] fix(main.go): exit with code 0 after repairing data - [+] fix(main.go): remove unused code and comments - [+] fix(main.go): handle context cancellation in processCSVOption function - [+] test(main_test.go): add context and cancel function to test ProcessCSVOption function
CodeQL analysis is complete for PR #18 |
recent average $ gocyclo -avg exporter
17 exporter ConvertSessionsToCSV exporter\session.go:206:1
7 exporter CreateSeparateCSVFiles exporter\session.go:354:1
4 exporter WriteMessageData exporter\session.go:301:1
4 exporter ReadJSONFromFile exporter\session.go:163:1
3 exporter closeCSVWriter exporter\session.go:333:1
3 exporter initializeCSVFile exporter\session.go:316:1
3 exporter WriteSessionData exporter\session.go:288:1
3 exporter (*StringOrInt).UnmarshalJSON exporter\session.go:90:1
2 exporter ExtractToDataset exporter\session.go:397:1
2 exporter WriteHeaders exporter\session.go:280:1
Average: 4.8 $ gocyclo -avg repairdata
7 repairdata RepairSessionData repairdata\repairdata.go:134:1
3 repairdata (*StringOrInt).UnmarshalJSON repairdata\repairdata.go:20:1
1 repairdata millisToTime repairdata\repairdata.go:166:1
Average: 3.67 |
- [+] fix(main.go): add comment to clarify the purpose of the code block - [+] refactor(main.go): rename variable 'store' to 'dataStore' for clarity - [+] feat(main.go): update package description and add support for repairing and exporting chat session data
- [+] fix(main.go): handle EOF error when reading input in promptForInput function
avg $ gocyclo -avg main.go
10 main createSeparateCSVFiles main.go:290:1
7 main main main.go:24:1
6 main executeCSVConversion main.go:259:1
6 main saveToFile main.go:199:1
5 main repairJSONData main.go:228:1
5 main processCSVOption main.go:153:1
5 main promptForInput main.go:111:1
4 main writeContentToFile main.go:351:1
4 main processDatasetOption main.go:181:1
3 main convertToSingleCSV main.go:336:1
3 main processOutputOption main.go:137:1
3 main handleInputError main.go:80:1
1 main setupSignalHandling main.go:96:1
Average: 4.77 |
- [+] refactor(main.go): change promptForInput function signature to include context parameter - [+] feat(main.go): add support for handling EOF and other errors in promptForInput function - [+] feat(main.go): add support for exiting the program on EOF and other errors in promptForInput function - [+] feat(main.go): add support for exiting the program after cancellation in setupSignalHandling function - [+] feat(main.go): add support for exiting the program on other errors in promptForInput function - [+] feat(main.go): add support for exiting the program on invalid format option in processCSVOption function - [+] feat(main.go): add support for exiting the program on failed extraction to dataset in processDatasetOption function - [+] feat(main.go): add support for exiting the program on invalid save output option in saveToFile function - [+] feat(main.go): add support for exiting the program on invalid format option in executeCSVConversion function - [+] feat(main.go): add support for exiting the program on failed creation of
- [+] test(main_test.go): add support for capturing and asserting stdout output in TestProcessCSVOption - [+] test(main_test.go): add support for canceling context in TestPromptForInput
- [+] chore(session.go): add support for context-aware operations - [+] feat(session.go): add support for context cancellation in ConvertSessionsToCSV function - [+] test(main_test.go): add test for promptForInput function
- [+] refactor(main.go): add context support for cancellation in main function - [+] feat(main.go): add signal handling for graceful termination in setupSignalHandling function - [+] feat(main.go): add context support for cancellation in promptForInput function - [+] feat(main.go): add context support for cancellation in processOutputOption function - [+] feat(main.go): add context support for cancellation in processDatasetOption function - [+] feat(main.go): add context support for cancellation in saveToFile function - [+] refactor(main.go): remove context support from repairJSONData function - [+] feat(main.go): add context support for cancellation in executeCSVConversion function - [+] feat(main.go): add context support for cancellation in createSeparateCSVFiles function - [+] feat(main.go): add context support for cancellation in convertToSingleCSV function - [+] feat(main.go): add context support for cancellation in writeContentToFile function
- [+] refactor(main.go): improve comments and signal handling in setupSignalHandling function
- [+] test(main_test.go): add error handling to promptForInput function in TestPromptForInput test
- [+] feat(main.go): add support for context cancellation during user input prompts - [+] fix(main.go): handle errors during user input prompts and exit program accordingly
- [+] fix(main.go): handle interrupt signal error when prompting for input
- [+] fix(session.go): handle errors from closing CSV writers and files - [+] fix(session.go): handle errors from initializing CSV files - [+] fix(session.go): handle errors from writing session data - [+] fix(session.go): handle errors from writing message data - [+] fix(main.go): handle errors from promptForInput function - [+] fix(main.go): handle errors from repairJSONData function - [+] fix(main.go): handle errors from exporter.ReadJSONFromFile function - [+] fix(main.go): handle errors from exporter.ExtractToDataset function - [+] fix(main.go): handle errors from saveToFile function - [+] fix(main.go): handle errors from executeCSVConversion function - [+] fix(main.go): handle errors from createSeparateCSVFiles function - [+] fix(main.go): handle errors from exporter.CreateSeparateCSVFiles function - [+] fix(main.go): handle errors from convertToSingleCSV function - [+] fix(main.go): handle errors from writeContentToFile function
- [+] fix(main.go): pass context to repairJSONData function - [+] refactor(main.go): remove duplicated error handling code in repairJSONData function - [+] refactor(main.go): remove unnecessary comments in repairJSONData function - [+] feat(main.go): simulate a context-aware operation in repairJSONData function
H0llyW00dzZ
changed the title
Feat [Golang] Context Signal
Feat [Golang] Context Signal + Excellent Improvement 🤪
Dec 8, 2023
- [+] test(main_test.go): update package comment to provide a comprehensive description of the tests - [+] test(main_test.go): add TestProcessCSVOption to verify the functionality of processCSVOption - [+] test(main_test.go): add TestPromptForInput to verify the capturing and returning of user input - [+] test(main_test.go): add TestPromptForInputCancellation to check if promptForInput respects context cancellation - [+] test(main_test.go): add TestLoadTestSessionsInvalidPath to verify that loadTestSessions returns an error for non-existent files - [+] test(main_test.go): add TestLoadIncorrectJson to check loadTestSessions' behavior when provided with incorrect JSON format - [+] test(main_test.go): add TestRepairJSONDataFromFile to verify the repairJSONData function with both valid and invalid file paths - [+] test(main_test.go): add TestWriteContentToFile to verify that writeContentToFile function writes the expected content to a file
- [+] refactor(file_system.go): rename package from "main" to "filesystem" and move file to "filesystem" directory - [+] refactor(file_system_mock.go): rename package from "main" to "filesystem" and move file to "filesystem" directory Note: This is a better approach because not everything is contained within the "main" package.
- [+] feat(filesystem): add package-level documentation for the filesystem package - [+] fix(filesystem): fix comments and formatting in file_system.go - [+] feat(filesystem): add RealFileSystem implementation of the FileSystem interface - [+] fix(filesystem): fix comments and formatting in file_system_mock.go - [+] feat(filesystem): add MockFileSystem implementation of the FileSystem interface
- [+] chore(GopherCI.yml): add GopherCI workflow for unit testing - [+] feat(GopherCI.yml): add workflow to run Gopher unit tests on push and pull request events
- [+] docs(README.md): add Gopher Unit Testing badge to README
- [+] chore(GopherCI.yml): update Gopher Unit Testing job configuration - Change job name to "Run Gopher Unit Testing on ${{ matrix.os }}" - Update "runs-on" to use ${{ matrix.os }} variable - Add "strategy" section to define matrix for "os" and "go-version" - Update "go-version" to use ${{ matrix.go-version }} variable - Use "actions/setup-go@v3" to set up Go with the specified version - Use "actions/checkout@v3" to check out code into the Go module directory
LMAO windows |
- [+] chore(GopherCI.yml): temporarily remove `windows-latest` from the matrix due to issues with Windows
- [+] feat(filesystem): add mock implementation of the FileSystem interface for testing purposes - [+] feat(filesystem): add mock implementation of the exporter.Exporter interface for testing purposes - [+] fix(filesystem): update package comment to include purpose of the mock implementation - [+] fix(filesystem): update MockFileSystem to use map instead of slice to track created files - [+] fix(filesystem): update Create method to create a new buffer in the FilesCreated map - [+] fix(filesystem): update Stat method to return mock file information if file exists in the mock file system - [+] fix(filesystem): update ReadFile method to read content of a file from the FilesCreated map - [+] fix(filesystem): update WriteFile method to write data to a file in the FilesCreated map - [+] feat(filesystem): add dummy implementation of mockFileInfo for testing purposes
- [+] test(main_test.go): add unit test for writeContentToFile function
- [+] chore(file_system.go): update FileSystem interface to include WriteFile method - [+] feat(file_system.go): add WriteFile method to RealFileSystem implementation
- [+] fix(main.go): fix writeContentToFile function to use provided FileSystem interface and handle errors properly - [+] feat(main.go): add support for filesystem package and use RealFileSystem implementation in writeContentToFile function
- [+] chore(GopherCI.yml): add workflow_dispatch event to trigger manual workflow runs with branch input
- [+] chore(file_system_mock.go): add comments to MockExporter and ConvertSessionsToCSV functions
- [+] ci(GopherCI.yml): add build job to build the application on different operating systems
- [+] chore(GopherCI.yml): update GopherCI workflow configuration - Update author information - Add CI/CD note - Add todo for integrating AI for summarization tasks - Rename "Build" step to "Test Build"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Note
This just a draft and still wip,
will released in next years.