code-prune 1.5.0__tar.gz → 1.6.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.6.0 - 2026-11-29
4
+
5
+ ### Changed
6
+
7
+ - `unused-symbol` no longer reports Gosu declarations (classes, functions,
8
+ fields) annotated with `@Export`.
9
+
3
10
  ## 1.5.0 - 2026-11-29
4
11
 
5
12
  ### Changed
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: code-prune
3
- Version: 1.5.0
3
+ Version: 1.6.0
4
4
  Summary: Find unreachable, unused, and obsolete code before it becomes technical debt.
5
5
  License: MIT License
6
6
 
@@ -56,7 +56,7 @@ Description-Content-Type: text/markdown
56
56
 
57
57
  # code-prune
58
58
 
59
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/rcw3bb/code-prune/blob/main/LICENSE) [![Version](https://img.shields.io/badge/Version-1.5.0-green.svg)](https://github.com/rcw3bb/code-prune/blob/main/CHANGELOG.md) [![Python](https://img.shields.io/badge/Python-3.14%2B-blue)](https://www.python.org/) [![PyPI](https://img.shields.io/badge/PyPI-code--prune-orange)](https://pypi.org/project/code-prune/)
59
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/rcw3bb/code-prune/blob/main/LICENSE) [![Version](https://img.shields.io/badge/Version-1.6.0-green.svg)](https://github.com/rcw3bb/code-prune/blob/main/CHANGELOG.md) [![Python](https://img.shields.io/badge/Python-3.14%2B-blue)](https://www.python.org/) [![PyPI](https://img.shields.io/badge/PyPI-code--prune-orange)](https://pypi.org/project/code-prune/)
60
60
 
61
61
 
62
62
  A CLI tool that scans a codebase for unreachable, unused, and obsolete code,
@@ -172,7 +172,8 @@ Overriding members are also never reported as unused symbols: Java `@Override`,
172
172
  Gosu `override` / `@Override`, TypeScript `override`, and Python `@override` /
173
173
  `@typing.override`. In Java and Gosu, declarations annotated with
174
174
  `@SuppressWarnings("unused")` or `@SuppressWarnings("all")` (including a class
175
- annotated that way, which covers all of its members) are skipped as well.
175
+ annotated that way, which covers all of its members) are skipped as well, as are
176
+ Gosu declarations annotated with `@Export`.
176
177
 
177
178
  ## Development
178
179
 
@@ -1,6 +1,6 @@
1
1
  # code-prune
2
2
 
3
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/rcw3bb/code-prune/blob/main/LICENSE) [![Version](https://img.shields.io/badge/Version-1.5.0-green.svg)](https://github.com/rcw3bb/code-prune/blob/main/CHANGELOG.md) [![Python](https://img.shields.io/badge/Python-3.14%2B-blue)](https://www.python.org/) [![PyPI](https://img.shields.io/badge/PyPI-code--prune-orange)](https://pypi.org/project/code-prune/)
3
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/rcw3bb/code-prune/blob/main/LICENSE) [![Version](https://img.shields.io/badge/Version-1.6.0-green.svg)](https://github.com/rcw3bb/code-prune/blob/main/CHANGELOG.md) [![Python](https://img.shields.io/badge/Python-3.14%2B-blue)](https://www.python.org/) [![PyPI](https://img.shields.io/badge/PyPI-code--prune-orange)](https://pypi.org/project/code-prune/)
4
4
 
5
5
 
6
6
  A CLI tool that scans a codebase for unreachable, unused, and obsolete code,
@@ -116,7 +116,8 @@ Overriding members are also never reported as unused symbols: Java `@Override`,
116
116
  Gosu `override` / `@Override`, TypeScript `override`, and Python `@override` /
117
117
  `@typing.override`. In Java and Gosu, declarations annotated with
118
118
  `@SuppressWarnings("unused")` or `@SuppressWarnings("all")` (including a class
119
- annotated that way, which covers all of its members) are skipped as well.
119
+ annotated that way, which covers all of its members) are skipped as well, as are
120
+ Gosu declarations annotated with `@Export`.
120
121
 
121
122
  ## Development
122
123
 
@@ -10,7 +10,7 @@ Since: 1.0.0
10
10
  from env_dir_bootstrap import EnvDirBootstrap
11
11
 
12
12
  __app_name__ = "code-prune"
13
- __version__ = "1.5.0"
13
+ __version__ = "1.6.0"
14
14
 
15
15
  _bootstrapper = EnvDirBootstrap(
16
16
  env_var="CODE_PRUNE_CONFIG_DIR",
@@ -163,6 +163,9 @@ SUPPRESS_WARNINGS_VALUES = frozenset({"unused", "all"})
163
163
  #: Annotation names marking a method as an override.
164
164
  OVERRIDE_ANNOTATION_NAMES = frozenset({"Override"})
165
165
 
166
+ #: Annotation names marking a declaration as exported (used externally), per language.
167
+ EXPORT_ANNOTATION_NAMES: dict[str, frozenset[str]] = {"Gosu": frozenset({"Export"})}
168
+
166
169
  #: Modifier node types marking a declaration as an override, per language.
167
170
  OVERRIDE_MODIFIER_TYPES: dict[str, frozenset[str]] = {
168
171
  "TypeScript": frozenset({"override_modifier"}),
@@ -3,7 +3,7 @@
3
3
  A declaration is exempt when it overrides an inherited member (it is invoked
4
4
  through its base type, so it never has a textual usage) or, for Java and Gosu,
5
5
  when it (or an enclosing class) carries ``@SuppressWarnings`` with ``"unused"``
6
- or ``"all"``.
6
+ or ``"all"``, or when a Gosu declaration is annotated ``@Export``.
7
7
 
8
8
  Author: Ron Webb
9
9
  Since: 1.5.0
@@ -15,6 +15,7 @@ from tree_sitter import Node # type: ignore[import-untyped]
15
15
 
16
16
  from .language_tables import (
17
17
  ANNOTATION_NODE_TYPES,
18
+ EXPORT_ANNOTATION_NAMES,
18
19
  OVERRIDE_ANNOTATION_NAMES,
19
20
  OVERRIDE_MODIFIER_TYPES,
20
21
  SUPPRESS_WARNINGS_NAME,
@@ -181,12 +182,27 @@ def _is_override(node: Node, source_bytes: bytes, language: str) -> bool:
181
182
  )
182
183
 
183
184
 
185
+ def _is_exported(node: Node, source_bytes: bytes, language: str) -> bool:
186
+ """Return whether *node* carries an ``@Export``-style annotation.
187
+
188
+ Author: Ron Webb
189
+ Since: 1.6.0
190
+ """
191
+ export_names = EXPORT_ANNOTATION_NAMES.get(language, frozenset())
192
+ return any(
193
+ _annotation_name(annotation, source_bytes) in export_names
194
+ for annotation in _annotations(node, language)
195
+ )
196
+
197
+
184
198
  def is_exempt_symbol(node: Node, source_bytes: bytes, language: str) -> bool:
185
199
  """Return whether the declaration *node* must not be an unused-symbol finding.
186
200
 
187
201
  Author: Ron Webb
188
202
  Since: 1.5.0
189
203
  """
190
- return _is_override(node, source_bytes, language) or _is_suppressed(
191
- node, source_bytes, language
204
+ return (
205
+ _is_override(node, source_bytes, language)
206
+ or _is_exported(node, source_bytes, language)
207
+ or _is_suppressed(node, source_bytes, language)
192
208
  )
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "code-prune"
3
- version = "1.5.0"
3
+ version = "1.6.0"
4
4
  description = "Find unreachable, unused, and obsolete code before it becomes technical debt."
5
5
  authors = [
6
6
  {name = "Ron Webb"}
File without changes
File without changes