Coverage for lintro / utils / unified_config.py: 100%

8 statements  

« prev     ^ index     » next       coverage.py v7.13.0, created at 2026-04-03 18:53 +0000

1"""Unified configuration manager for Lintro. 

2 

3This module provides a centralized configuration system that: 

41. Reads global settings from [tool.lintro] 

52. Reads native tool configs (for comparison/validation) 

63. Reads tool-specific overrides from [tool.lintro.<tool>] 

74. Computes effective config per tool with clear priority rules 

85. Warns about inconsistencies between configs 

96. Manages tool execution order (priority-based or alphabetical) 

10 

11Priority order (highest to lowest): 

121. CLI --tool-options (always wins) 

132. [tool.lintro.<tool>] in pyproject.toml 

143. [tool.lintro] global settings in pyproject.toml 

154. Native tool config (e.g., [tool.ruff]) 

165. Tool defaults 

17 

18This module re-exports from split submodules for backwards compatibility. 

19""" 

20 

21from __future__ import annotations 

22 

23# Re-export from config module 

24from lintro.utils.config import ( 

25 get_tool_order_config, 

26 load_lintro_global_config, 

27 load_lintro_tool_config, 

28) 

29 

30# Re-export from config_constants module 

31from lintro.utils.config_constants import ( 

32 DEFAULT_TOOL_PRIORITIES, 

33 GLOBAL_SETTINGS, 

34 ToolConfigInfo, 

35 ToolOrderStrategy, 

36) 

37 

38# Re-export from config_priority module 

39from lintro.utils.config_priority import ( 

40 _get_nested_value, 

41 get_effective_line_length, 

42 get_ordered_tools, 

43 get_tool_priority, 

44) 

45 

46# Re-export from config_validation module 

47from lintro.utils.config_validation import ( 

48 get_tool_config_summary, 

49 is_tool_injectable, 

50 validate_config_consistency, 

51) 

52 

53# Re-export from native_parsers module 

54from lintro.utils.native_parsers import _load_native_tool_config 

55 

56# Re-export from unified_config_manager module 

57from lintro.utils.unified_config_manager import UnifiedConfigManager 

58 

59__all__ = [ 

60 # From config module 

61 "get_tool_order_config", 

62 "load_lintro_global_config", 

63 "load_lintro_tool_config", 

64 # From config_constants module 

65 "DEFAULT_TOOL_PRIORITIES", 

66 "GLOBAL_SETTINGS", 

67 "ToolConfigInfo", 

68 "ToolOrderStrategy", 

69 # From config_priority module 

70 "_get_nested_value", 

71 "get_effective_line_length", 

72 "get_ordered_tools", 

73 "get_tool_priority", 

74 # From config_validation module 

75 "get_tool_config_summary", 

76 "is_tool_injectable", 

77 "validate_config_consistency", 

78 # From native_parsers module 

79 "_load_native_tool_config", 

80 # From unified_config_manager module 

81 "UnifiedConfigManager", 

82]