Skip to content

Conversation

@dfayd0
Copy link
Member

@dfayd0 dfayd0 commented Jun 18, 2025

This pull request introduces significant enhancements to the codebase, focusing on modularization, functionality improvements, and code cleanup. Key changes include the addition of a CodeSignature module for parsing and resolving code signatures, integration of a TestGenerator module for generating tests dynamically, and refactoring of the LeetcodeApiRunner to streamline problem setup and testing workflows.

New Modules and Features:

  • src/code_signature.rs: Added a CodeSignature module to parse function and class signatures for Python and Rust code. This module also handles declaration resolution for test data.
  • src/test_generator.rs: Introduced a TestGenerator module to dynamically generate test cases based on starter code and parsed test data. Supports Python and Rust test generation.

Refactoring and Improvements in LeetcodeApiRunner:

  • Refactored problem setup: Simplified the start_problem method to use the new TestGenerator and CodeSignature modules for generating starter code and tests. Improved error handling and modularity. [1] [2]
  • Improved language detection: Replaced utils::extension_programming_language with get_language_from_extension for better clarity and maintainability. [1] [2]
  • Enhanced Rust project initialization: Updated the cargo init command to include --bin for creating binary projects.

Utility Enhancements:

  • src/utils.rs: Added write_readme as a utility function for creating README files. Refactored get_file_name to dynamically generate file names based on language extensions. [1] [2]

Miscellaneous Changes:

  • Modularization: Added new modules (code_signature, test_generator) to src/lib.rs for better organization.
  • Default language handling: Improved error handling for unset default programming languages in the CLI.

@dfayd0 dfayd0 requested a review from guilhem-sante June 18, 2025 19:46
@dfayd0 dfayd0 self-assigned this Jun 18, 2025
@dfayd0 dfayd0 added the enhancement New feature or request label Jun 18, 2025
@dfayd0 dfayd0 linked an issue Jun 18, 2025 that may be closed by this pull request
@dfayd0 dfayd0 marked this pull request as draft June 18, 2025 19:48
@dfayd0
Copy link
Member Author

dfayd0 commented Jun 18, 2025

Quelques notes:

Bon déja, la CI a passé bien sur :) btw j'ai fait une issue pour update sur chaque commit -> #18.
je sais qu'il y a un bug avec to_string() sur plusieurs args en string sur la test gen rust.
y'a que rust qui est support, dans un code pur glass canon et très peu testé.

@guilhem-sante
Copy link
Member

Quelques notes:

Bon déja, la CI a passé bien sur :) btw j'ai fait une issue pour update sur chaque commit -> #18. je sais qu'il y a un bug avec to_string() sur plusieurs args en string sur la test gen rust. y'a que rust qui est support, dans un code pur glass canon et très peu testé.

force

@guilhem-sante
Copy link
Member

deso mec je te fais ça ce wk.

Copy link
Member

@guilhem-sante guilhem-sante left a comment

Choose a reason for hiding this comment

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

Nice les tests en plus. Je sais pas si tes checks de signatures sont 100% fonctionnels mais ça fait bien le taf.

src/main.rs Outdated
Comment on lines 18 to 17
Commands::Info {
id,
} => {
println!("{}", api_runner.get_problem_info(*id).await?);
},
Commands::Start {
id,
language,
} => {
let default = &rcs.config.default_language.unwrap();
Commands::Info { id } => api_runner.get_problem_info(*id).await?,
Commands::Start { id, language } => {
let lang = match language {
Some(lang) => utils::parse_programming_language(lang)?,
None => utils::parse_programming_language(default)?,
None => utils::parse_programming_language(
&rcs.config
Copy link
Member

Choose a reason for hiding this comment

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

Tu peux regarder pour la version derived de clap avec la feature associé. Je trouve ça plus limpide moi. Aussi tu peux créer le runtime après avoir gérer la CLI, ça peut t'éviter de gérer l'async quand c'est pas encore nécessaire.

Copy link
Member Author

Choose a reason for hiding this comment

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

Tu peux regarder pour la version derived de clap avec la feature associé.

ca fait quoi?

Copy link
Member

Choose a reason for hiding this comment

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

globalement tu décris la CLI comme une structure plutot que impérativement, je ne sais pas si c'est forcément mieux mais ça a l'avantage d'être assez lisible.

Copy link
Member Author

Choose a reason for hiding this comment

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

Je regarde ça asap

@dfayd0 dfayd0 force-pushed the 10-automatically-add-example-from-problem-summary-as-native-unit-tests branch from c85889d to 6327d4c Compare July 14, 2025 11:03
@dfayd0 dfayd0 marked this pull request as ready for review August 3, 2025 17:56
@dfayd0 dfayd0 merged commit e5e53a8 into main Aug 3, 2025
3 checks passed
@dfayd0 dfayd0 deleted the 10-automatically-add-example-from-problem-summary-as-native-unit-tests branch August 3, 2025 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Automatically add example from problem summary as native unit tests

3 participants