Configuration File
Refactron uses a.refactron.yaml file to configure analyzers, refactorers, and thresholds.
Initialize Configuration
Generate a default configuration file:.refactron.yaml in your project root.
Configuration Options
Basic Configuration
.refactron.yaml
Pattern Learning
Enable pattern learning to improve suggestions over time:.refactron.yaml
Learn more about pattern learning in the Pattern Learning Guide
Available Analyzers
security
security
Detects security vulnerabilities like SQL injection, code injection, hardcoded secrets, and SSRF
performance
performance
Detects runtime performance antipatterns: N+1 queries, inefficient list operations, unnecessary iterations, inefficient string concatenation, and redundant
list() callscode_smell
code_smell
Identifies magic numbers, long functions, excessive parameters, and deep nesting
complexity
complexity
Measures cyclomatic complexity, maintainability index, and nested loops
type_hint
type_hint
Checks for missing or incomplete type annotations
dead_code
dead_code
Finds unused functions and unreachable code
dependency
dependency
Analyzes circular imports and wildcard imports
Available Refactorers
extract_method
extract_method
Extract long or logically distinct code blocks from complex functions into separate named functions
extract_constant
extract_constant
Extract magic numbers into named constants
add_docstring
add_docstring
Add missing docstrings to functions and classes
simplify_conditionals
simplify_conditionals
Simplify complex conditional statements
reduce_parameters
reduce_parameters
Reduce function parameter count using dataclasses or dictionaries
Threshold Configuration
Adjust thresholds to match your project’s standards:.refactron.yaml
Exclude Patterns
Exclude files or directories from analysis:.refactron.yaml
Environment Variables
Configure Refactron using environment variables:Per-File Ignores
Ignore specific issues in code using comments:Next Steps
Authentication
Set up authentication for cloud features
Code Analysis Guide
Learn about analysis capabilities
