Google GenAI SDK Linter
Overview
The Google GenAI SDK Linter is a powerful, deterministic, and pure syntax-based linter for the Google GenAI Python SDK. It is designed to be an essential tool for any developer working with Google's generative AI models, providing real-time feedback, diagnostics, and quick fixes to help you write clean, modern, and future-proof code.
This linter is built on a foundation of static analysis (regex and Abstract Syntax Trees) and is informed by a deep, systematic analysis of the official and legacy SDK documentation. It does not use any AI or machine learning, ensuring that its results are 100% deterministic, repeatable, and reliable.
Features
- Real-time Diagnostics: Get instant, as-you-type feedback on your code, with clear and actionable error messages that guide you toward best practices.
- One-Click Quick Fixes: Correct issues with a single click. The linter provides intelligent quick fixes for every rule, allowing you to refactor your code with confidence.
- Comprehensive Rule Set: The linter's rules are meticulously crafted to cover a wide range of common issues and deprecated patterns, including:
- Deprecated Imports: Automatically detect and correct outdated import statements.
- Deprecated Method Calls: Flag the use of deprecated functions and methods, such as
genai.GenerativeModel() and genai.configure().
- Incorrect Async/Sync Patterns: Ensure that your asynchronous code is correctly implemented and that you are using the most efficient streaming patterns.
- Improper Configuration: Enforce the use of modern, type-safe configuration objects (
types.GenerateContentConfig) over outdated dictionary-based approaches.
- Outdated Model Names: Keep your code up-to-date by flagging the use of older, less capable model names.
- Missing
genai.Client() Instantiation: Ensure that your code is correctly initialized with the modern genai.Client().
Requirements
- Python Interpreter: You must have a Python interpreter installed and configured in your Visual Studio Code settings.
- Visual Studio Code: Version 1.85.0 or higher.
Extension Settings
This extension contributes the following settings:
google-genai-sdk-linter.pythonPath: The path to the Python interpreter that the linter should use. Defaults to python.
Known Issues
There are no known issues at this time.
Release Notes
See the CHANGELOG.md file for a detailed history of changes.
Contributing
This project is open-source and contributions are welcome. Please feel free to open an issue or submit a pull request on our GitHub repository.