Coverage for .tox/py313/lib/python3.13/site-packages/pylint_sort_functions/messages.py: 100%
1 statements
« prev ^ index » next coverage.py v7.10.2, created at 2025-08-07 04:45 +0200
« prev ^ index » next coverage.py v7.10.2, created at 2025-08-07 04:45 +0200
1"""Message definitions for the pylint-sort-functions plugin.
3The MESSAGES dict defines all warning/error codes that this PyLint plugin can report.
4Each entry creates a new PyLint message that users will see when running PyLint.
6Message Structure:
7 Key: Message ID (e.g., "W9001")
8 - First letter: Severity (W=Warning, E=Error, C=Convention, R=Refactor)
9 - Digits: Plugin's unique range (9001-9999 for custom plugins)
11 Value: Tuple of (template, symbol, description)
12 - Template: Actual message shown to users (supports %s formatting)
13 - Symbol: Human-readable name for disabling (e.g., unsorted-functions)
14 - Description: Longer explanation for documentation/help
16Usage Examples:
17 In checker: self.add_message("unsorted-functions", node=node, args=("module",))
18 PyLint output: W9001: Functions are not sorted alphabetically in module scope
19 (unsorted-functions)
20 User disabling: # pylint: disable=unsorted-functions
21"""
23# Message format: (message_template, message_symbol, message_description)
24MESSAGES: dict[str, tuple[str, str, str]] = {
25 "W9001": (
26 "Functions are not sorted alphabetically in %s scope",
27 "unsorted-functions",
28 "Functions should be organized alphabetically within their scope "
29 "(public functions first, then private functions with underscore prefix)",
30 ),
31 "W9002": (
32 "Methods are not sorted alphabetically in class %s",
33 "unsorted-methods",
34 "Class methods should be organized alphabetically within their "
35 "visibility scope (public methods first, then private methods "
36 "with underscore prefix)",
37 ),
38 "W9003": (
39 "Public and private functions are not properly separated in %s",
40 "mixed-function-visibility",
41 "Public functions (no underscore prefix) should come before private functions "
42 "(underscore prefix) with clear separation",
43 ),
44 "W9004": (
45 "Function '%s' should be private (prefix with underscore)",
46 "function-should-be-private",
47 "Functions that are only used within their defining module should be marked "
48 "as private by prefixing their name with an underscore. This rule detects "
49 "functions with helper/utility naming patterns (get_, validate_, process_, "
50 "helper, etc.) that are called only within the same module. Note: Cannot "
51 "detect cross-module usage, so functions used by other modules won't be "
52 "flagged (which reduces false positives).",
53 ),
54}