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

Support docstring for swift #949

Open
codelion opened this issue Oct 12, 2024 · 1 comment
Open

Support docstring for swift #949

codelion opened this issue Oct 12, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@codelion
Copy link
Member

No description provided.

@codelion codelion added the enhancement New feature or request label Oct 12, 2024
Copy link

patched-codes bot commented Nov 16, 2024

Title: Support docstring for Swift

Technical Specifications and Requirements:

  1. Language Support: Extend the existing docstring generation functionality to support Swift programming language.
  2. Integration: Integrate Swift support into the current GenerateDocstring patchflow and related components.
  3. Syntax Compatibility: Ensure compatibility with Swift's syntax and documentation conventions.
  4. File Recognition: Update file extension recognition to include .swift files.
  5. Context Strategy: Implement a SwiftStrategy similar to existing language strategies (e.g., JavaStrategy, PythonStrategy).

Current Situation:
The current codebase supports docstring generation for multiple languages, including Python, Java, JavaScript, C++, and Kotlin. However, Swift support is missing, which limits the tool's usefulness for iOS and macOS developers.

Potential Impact:
Adding Swift support will:

  1. Expand the tool's user base to include iOS and macOS developers.
  2. Improve code documentation practices in Swift projects.
  3. Enhance the overall value proposition of our product.

Proposed Solution:

  1. Create a new SwiftStrategy class in the context_strategy module:

    • Implement methods for parsing Swift code structure (classes, methods, properties).
    • Define Swift-specific docstring format and conventions.
  2. Update the GenerateDocstring patchflow:

    • Add Swift language detection.
    • Integrate the new SwiftStrategy into the docstring generation process.
  3. Modify relevant utility functions:

    • Update file extension recognition to include .swift files.
    • Adjust any language-specific processing to accommodate Swift syntax.
  4. Implement Swift-specific docstring templates:

    • Create templates that follow Swift documentation best practices.
    • Ensure compatibility with tools like Xcode's Quick Help and jazzy documentation generator.
  5. Add test cases:

    • Create Swift code samples for testing.
    • Implement unit tests for SwiftStrategy and Swift docstring generation.

Action Items:

  1. Create a new SwiftStrategy class in patchwork/common/context_strategy/swift.py
  2. Update GenerateDocstring.py to include Swift language support
  3. Modify utility functions in relevant files (e.g., filter_paths.py) to recognize .swift files
  4. Create Swift docstring templates
  5. Add test cases in the tests/cicd/generate_docstring/ directory
  6. Update documentation to include information about Swift support
  7. Perform thorough testing with various Swift code samples
  8. Update the README.md to mention Swift support in the list of supported languages

Additional Considerations:

  • Research Swift documentation conventions and best practices to ensure generated docstrings are idiomatic.
  • Consider reaching out to Swift developers in the community for feedback on the implementation.
  • Plan for potential future updates to accommodate new Swift language features or documentation practices.

By implementing Swift support, we will significantly enhance our tool's capabilities and appeal to a broader range of developers, particularly those working in the Apple ecosystem.

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

No branches or pull requests

1 participant