9 个仓库
Tools for maintaining consistent code style and syntax.
Explore 9 awesome GitHub repositories matching part of an awesome list · Code Formatters. Refine with filters or upvote what's useful.
Ruff is a high-performance static analysis and code formatting tool designed for Python. Built in Rust, it functions as a comprehensive engine that scans source code to detect programming errors, security vulnerabilities, and deviations from established coding standards. By parsing source code into a structured tree representation, it provides both automated linting and style enforcement across entire projects. The tool distinguishes itself through its speed and deep integration into the development lifecycle. It utilizes parallelized file processing to maximize throughput on large codebases
Extremely fast Python linter and formatter.
该项目是一个不妥协的、确定性的 Python 代码格式化程序。它的工作原理是将源代码解析为抽象语法树,并根据一套严格的、主观的样式规则重新生成它。通过自动化格式化过程,它消除了手动样式争论和配置开销,确保代码在整个项目中保持一致,无论原始输入如何。 该工具通过专注于速度和与开发工作流的无缝集成而脱颖而出。它利用基于内容的文件缓存和并行处理来在大型代码库上保持高性能,同时支持版本控制钩子,以在代码提交前强制执行样式一致性。为了保留项目历史,它提供了在版本控制追溯中忽略特定提交的机制,确保自动化的样式更改不会掩盖原始作者身份。 除了标准源文件外,该格式化程序还将其功能扩展到 Jupyter 笔记本、类型存根以及文档中的嵌入式代码示例。它通过主流文本编辑器和集成开发环境的插件,以及对语言服务器协议的支持,提供了广泛的兼容性。配置通过在目录层次结构中自动发现的项目级文件进行管理,从而允许在不同的开发环境中保持一致的行为。
Uncompromising and opinionated automatic code formatter.
YAPF 是一个 Python 代码格式化程序和样式合规工具。它作为一个基于 AST 的重格式化程序运行,使用具体语法树来确保源文件之间的结构一致性和统一的视觉呈现。 该引擎利用基于惩罚的布局优化器,通过计算不同格式化选择的数值成本来确定最佳换行符。它采用多进程代码处理器将多个文件的格式化分布到多个 CPU 核心上。 该工具涵盖了通过就地文件修改、差异分析和处理部分代码片段进行的源代码重格式化。它包括一个用于管理样式预设、布局规则和项目级设置的基于规则的配置系统。 集成能力包括用于持续集成流水线的样式合规验证、Git 钩子自动化以及基于编辑器的保存时格式化功能。
Configurable formatter that reformats code to follow best practices.
isort is a Python import sorter and code formatter that organizes import statements into alphabetical groups and sections. It functions as both a utility to automatically rearrange imports for a consistent layout and as a linting tool to verify if code follows specific ordering rules. The project provides configurable layout settings for indentation, wrapping modes, and section ordering to ensure compliance with project style guides and PEP 8. It allows for the exclusion of specific lines or files through inline comments and docstrings. The tool integrates into development workflows via IDE
Utility for automatically sorting and organizing import statements.
rustfmt is a Rust code formatter that operates as a Cargo subcommand, applying consistent formatting to Rust source files according to official style guidelines. It parses source code into a syntax tree, applies formatting rules to tree nodes, and pretty-prints the result back to text, with support for TOML-driven configuration that allows per-project style customization. The formatter is edition-aware, automatically selecting formatting rules based on the Rust edition specified in the project, and supports a style edition override that decouples formatting rules from the Rust edition used fo
Official Rust code formatter.
autopep8 是一个 Python 静态代码样式器和格式化程序,旨在自动重写源代码以符合 PEP 8 样式指南。它作为一个递归代码清理器,识别并修复整个项目中的缩进、空格和语法不规范之处。 该工具使用抽象语法树(AST)转换执行结构化重构,以执行非空格更改,例如缩短长行和改进身份测试。它包括用于复杂样式违规的激进重构模式,并支持通过内联标记进行选择性格式化,以禁用特定代码块的更改。 功能包括用于定位或忽略特定错误代码的基于规则的修复过滤、行范围格式化,以及生成样式差异报告。该系统可以通过具有递归目录遍历和原地文件修改的命令行界面处理文件,也可以通过 API 以编程方式集成。 格式化偏好和规则集可以通过全局或本地配置文件进行管理。
Automatically adjusts code to conform to PEP 8 standards.
dprint is a multi-language code formatter that applies consistent styling across various programming languages using a pluggable architecture. It functions as a unified project style management tool, a command-line interface for continuous integration style enforcement, and a Language Server Protocol implementation for real-time formatting in editors. The project is distinguished by a WebAssembly-based plugin system that loads sandboxed formatting logic from URLs or file paths. It further extends its capabilities through a process-based tool integration that wraps external command-line interf
Pluggable and configurable code formatting platform.
docformatter
Formats docstrings to adhere to PEP 257 guidelines.
Prettier Rust is an opinionated code formatter that autocorrects bad syntax.
Prettier plugin for formatting Rust code.