@@ -90,10 +90,12 @@ easy analysis in spreadsheet applications or data analysis tools.
9090- ` output/functions_no_hints.csv ` - Functions without any type hints
9191- ` output/functions_incomplete_hints.csv ` - Functions with partial hints
9292- ` output/class_variables_no_hints.csv ` - Class variables without type hints
93- - ` output/instance_variables_no_hints.csv ` - Instance variables without type hints
93+ - ` output/instance_variables_no_hints.csv ` -
94+ Instance variables without type hints
9495- ` output/module_variables_no_hints.csv ` - Module variables without type hints
9596- ` output/type_aliases.csv ` - All type aliases defined in the codebase
96- - ` output/submodule_summary.csv ` - Summary statistics by submodule with mypy errors
97+ - ` output/submodule_summary.csv ` -
98+ Summary statistics by submodule with mypy errors
9799
98100** CSV Schema:**
99101
@@ -155,9 +157,9 @@ cat output/submodule_summary.csv
155157** Example Output:**
156158
157159``` text
158- ================================================================================
160+ ==============================================================================
159161TYPE ANNOTATION COVERAGE ANALYSIS FOR PYTHAINLP
160- ================================================================================
162+ ==============================================================================
161163
162164Repository root: /path/to/pythainlp
163165Output directory: ./output
@@ -181,17 +183,17 @@ Analyzed 426 instance variables
181183Analyzed 508 module variables
182184Analyzed 0 type aliases
183185
184- ================================================================================
186+ ==============================================================================
185187OVERALL STATISTICS - FUNCTIONS/METHODS
186- ================================================================================
188+ ==============================================================================
187189Total functions/methods: 720
188190Complete type hints: 592 (82.22%)
189191Incomplete type hints: 56 ( 7.78%)
190192No type hints: 72 (10.00%)
191193
192- ================================================================================
194+ ==============================================================================
193195OVERALL STATISTICS - VARIABLES
194- ================================================================================
196+ ==============================================================================
195197Total variables: 959
196198 Class variables: 25
197199 Instance variables: 426
@@ -202,19 +204,22 @@ No type hints: 909 (94.79%)
202204
203205### Automated Analysis
204206
205- The repository includes a GitHub Actions workflow that automatically runs the type hint analyzer on every push to the ` dev ` branch:
207+ The repository includes a GitHub Actions workflow that automatically runs
208+ the type hint analyzer on every push to the ` dev ` branch:
206209
207210- ** Workflow** : ` .github/workflows/type-hint-analysis.yml `
208211- ** Trigger** : Push to ` dev ` branch
209212- ** Environment** : ubuntu-latest, Python 3.9
210213- ** Artifacts** : JSON and CSV files (30-day retention)
211214- ** Summary** : Displayed in GitHub Actions UI
212215
213- The workflow provides continuous monitoring of type hint coverage as the codebase evolves.
216+ The workflow provides continuous monitoring of type hint coverage
217+ as the codebase evolves.
214218
215219### Type Completeness Standards
216220
217- This analyzer follows the type completeness guidelines from the Python typing documentation:
221+ This analyzer follows the type completeness guidelines from
222+ the Python typing documentation:
218223< https://typing.python.org/en/latest/guides/libraries.html#type-completeness >
219224
220225The analysis covers:
@@ -241,13 +246,16 @@ a library is considered to have complete type hints when:
241246
242247** Type hint status:**
243248
244- - ** Complete:** All parameters and return value have type hints (for functions), or variable has type annotation (for variables)
245- - ** Incomplete:** Some parameters or return value missing type hints (for functions only)
249+ - ** Complete:** All parameters and return value have type hints
250+ (for functions), or variable has type annotation (for variables)
251+ - ** Incomplete:** Some parameters or return value missing type hints
252+ (for functions only)
246253- ** None:** No type hints at all
247254
248255** Analyzed Elements:**
249256
250- - ** Functions/Methods:** Function signatures including parameters and return types
257+ - ** Functions/Methods:** Function signatures including parameters
258+ and return types
251259 - Excludes ` self ` and ` cls ` parameters from parameter counts
252260 - Considers both parameters and return type for completeness
253261 - Tracks decorator usage (e.g., ` @staticmethod ` , ` @lru_cache ` )
@@ -361,7 +369,8 @@ The analyzer codebase maintains high documentation standards:
361369
362370** Key Design decisions:**
363371
364- 1 . ** AST-based Analysis** : Uses Python's ` ast ` module rather than runtime inspection
372+ 1 . ** AST-based Analysis** : Uses Python's ` ast ` module rather than runtime
373+ inspection
365374 - Pros: No need to import/execute code, faster, safer
366375 - Cons: Cannot detect dynamically generated code
367376
@@ -396,7 +405,8 @@ The analyzer codebase maintains high documentation standards:
3964052 . ** More Accurate Reference Counting**
397406 - Use AST-based import analysis instead of text search
398407 - Track actual usage vs. string mentions
399- - Distinguish between different types of references (call, attribute access, etc.)
408+ - Distinguish between different types of references
409+ (call, attribute access, etc.)
400410
4014113 . ** Additional Metrics**
402412 - Generic type parameterization completeness
@@ -447,9 +457,12 @@ type annotations should be added to:
447457
448458### What should not be annotated
449459
450- 1 . ** Reassignments** - Adding type annotations to reassignments causes ` no-redef ` errors
451- 2 . ** Dictionary subscript operations** - Cannot annotate ` dict[key] = value ` operations
452- 3 . ** Variables with obvious literal types** - Optional, but generally omitted for simple cases
460+ 1 . ** Reassignments** -
461+ Adding type annotations to reassignments causes ` no-redef ` errors
462+ 2 . ** Dictionary subscript operations** -
463+ Cannot annotate ` dict[key] = value ` operations
464+ 3 . ** Variables with obvious literal types** -
465+ Optional, but generally omitted for simple cases
453466
454467## Future Tools
455468
0 commit comments