vscode-radon-linterDescriptionThis is a Visual Studio Code extension for linting Python code using the Radon library. Once installed, the extension automatically checks Python files for potential issues and displays them in the Problems tab. This helps developers identify and fix issues such as code complexity, maintainability, and other potential problems that could lead to bugs or make the code harder to read and maintain. The extension is capable of processing individual files, all Python files in the workspace, and all workspace folders, making it easy to analyze multiple Python files at once. This is particularly useful in larger projects where manually checking each file would be time-consuming. The extension uses Radon to analyze Python code and produces output that includes the cyclomatic complexity of blocks of code, the type of the block (e.g., "function", "method", "class"), the name of the block, and the line number where the block starts. This detailed output helps developers understand the structure and complexity of their code at a glance. The extension uses a configuration setting to determine the Radon executable to use, and it has a debug mode that can be enabled to log the Radon runs. This makes the extension highly customizable and adaptable to different development environments and workflows. The extension is easy to use and integrates seamlessly with Visual Studio Code, making it a valuable tool for Python developers who want to ensure their code is clean, efficient, and follows best practices. Table of Contents
Features
ExampleOnce the extension is installed and active, it will automatically lint your Python code using Radon and display potential issues in the Problems tab of Visual Studio Code. Here is an example of what you might see: In this example, the Problems tab shows the issues detected by the vscode-radon-linter extension. Each issue includes the type of the block (e.g., "function", "method", "class"), the name of the block, the cyclomatic complexity of the block, and the line number where the block starts. You can click on an issue to navigate directly to the corresponding line in your code. Requirements
InstallationFollow these steps to install the extension in Visual Studio Code:
Here is an image to help you understand the process: After the installation is complete, you may need to reload Visual Studio Code for the changes to take effect. About RadonRadon is a Python library that computes various metrics from the source code. Radon can compute:
For more information about Radon, including how to use it and how it calculates cyclomatic complexity, refer to the Radon documentation. The source code for Radon is available on GitHub. Installing RadonRadon is a Python library and can be installed using pip, the Python package installer. If you have Python and pip installed, you can install Radon by running the following command in your terminal:
If you're using a specific Python environment or if you want to install Radon as a project dependency, you might need to use a different command. Refer to the pip documentation and your environment's documentation for more information. Usage
Extension SettingsThis extension contributes the following settings:
To access these settings, follow these steps:
Here is an image to help you understand the process: CommandsThis extension contributes the following command:
Known IssuesPlease report any issues on the GitHub repository. Release Notes1.0.0Initial release of vscode-radon-linter Building and TestingThis project uses webpack for building and vscode-test for testing. The following npm scripts are available:
AuthorVadim Nareyko For any questions or concerns, please contact vadim@nareyko.com LicenseThis project is licensed under the MIT License. See the LICENSE.txt file in the project root for more information. |