codeecho 1.2.1__py3-none-any.whl → 1.2.3__py3-none-any.whl

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.
codeecho/__init__.py CHANGED
@@ -10,7 +10,7 @@ maintainable designs.
10
10
  from env_dir_bootstrap import EnvDirBootstrap
11
11
  from logenrich import setup_logger
12
12
 
13
- __version__ = "1.2.1"
13
+ __version__ = "1.2.3"
14
14
 
15
15
  _bootstrapper = EnvDirBootstrap(
16
16
  env_var="CODEECHO_CONFIG_DIR",
codeecho/__main__.py CHANGED
@@ -237,7 +237,7 @@ def _discover_files(
237
237
  default=10,
238
238
  show_default=True,
239
239
  type=click.IntRange(1),
240
- help="Minimum token count for a fragment to be considered.",
240
+ help="Minimum line count for a fragment to be considered.",
241
241
  )
242
242
  @click.option(
243
243
  "--exclude",
codeecho/extractor.py CHANGED
@@ -91,7 +91,7 @@ def extract_fragments( # pylint: disable=too-many-arguments,too-many-positional
91
91
  :param file_path: Absolute path of the source file.
92
92
  :param language_name: Language name (e.g. ``"Python"``).
93
93
  :param session_id: UUID of the current scan session.
94
- :param min_tokens: Fragments with fewer raw tokens are discarded.
94
+ :param min_tokens: Fragments spanning fewer lines than this are discarded.
95
95
  :returns: List of fully-populated :class:`Fragment` objects.
96
96
  :since: 1.0.0
97
97
  """
@@ -118,14 +118,14 @@ def extract_fragments( # pylint: disable=too-many-arguments,too-many-positional
118
118
  ]
119
119
  del cursor, captures # free tree-sitter objects before processing
120
120
  for start_b, end_b in node_ranges:
121
+ start_ln = bisect_left(newline_offsets, start_b) + 1
122
+ end_ln = bisect_left(newline_offsets, end_b) + 1
123
+ if end_ln - start_ln + 1 < min_tokens:
124
+ continue
121
125
  src_text = source_bytes[start_b:end_b].decode("utf-8", errors="replace")
122
126
  raw_tokens, norm_tokens = normalizer.tokenise_and_normalise(
123
127
  src_text, language_name
124
128
  )
125
- if len(raw_tokens) < min_tokens:
126
- continue
127
- start_ln = bisect_left(newline_offsets, start_b) + 1
128
- end_ln = bisect_left(newline_offsets, end_b) + 1
129
129
  fragments.append(
130
130
  Fragment(
131
131
  fragment_id=str(uuid.uuid4()),
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codeecho
3
- Version: 1.2.1
3
+ Version: 1.2.3
4
4
  Summary: A developer tool that scans your codebase to detect and highlight ECHOES of duplicated or near-duplicated code so you can refactor toward cleaner, more maintainable designs.
5
5
  License-Expression: MIT
6
6
  License-File: LICENSE
@@ -37,7 +37,7 @@ Description-Content-Type: text/markdown
37
37
 
38
38
  # codeecho
39
39
 
40
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/rcw3bb/codeecho/blob/main/LICENSE) [![Version](https://img.shields.io/badge/Version-1.2.1-green.svg)](https://github.com/rcw3bb/codeecho/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-codeecho-orange)](https://pypi.org/project/codeecho/)
40
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/rcw3bb/codeecho/blob/main/LICENSE) [![Version](https://img.shields.io/badge/Version-1.2.3-green.svg)](https://github.com/rcw3bb/codeecho/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-codeecho-orange)](https://pypi.org/project/codeecho/)
41
41
 
42
42
  > A developer tool that scans your codebase to detect and highlight **echoes** of duplicated or near-duplicated code, so you can refactor toward cleaner, more maintainable designs.
43
43
 
@@ -92,7 +92,7 @@ python -m codeecho <path> [options]
92
92
  | `--output-dir <dir>` | `<cwd>/reports` | Directory where output file(s) will be written. |
93
93
  | `--db-dir <dir>` | `~/.codeecho` | Directory for the SQLite scratch database (`codeecho.db`). Session records are removed after the report is written. |
94
94
  | `--format <fmt>` | `both` | Output format: `json`, `html`, or `both`. |
95
- | `--min-tokens <n>` | `10` | Minimum token count for a code fragment to be included. |
95
+ | `--min-tokens <n>` | `10` | Minimum line count for a code fragment to be included. |
96
96
  | `--exclude <pattern>` | _(none)_ | Glob pattern(s) to exclude from scanning (repeatable). |
97
97
  | `--target-list` | `false` | Treat `PATH` as a single existing file listing target paths (files and/or directories), one per line, instead of individual `PATH` arguments. Blank lines and lines starting with `#` are skipped. |
98
98
  | `--basis <file>` | _(none)_ | File listing basis target paths, one per line — same format as `--target-list`. Absolute file/directory entries are merged into the scan automatically and matched exactly; relative entries (e.g. a bare filename like `Foo.gs`) are matched by filename/suffix against any file discovered in the scan. The report is filtered to only clone groups touching at least one basis file, and groups duplicated purely among basis files are flagged (`basis_internal` in JSON, a "Basis-to-Basis" badge in HTML). |
@@ -1,12 +1,12 @@
1
1
  codeecho/.ignore,sha256=nFtm2m82jdMWoOE-zN1Blkl5zPzvj-RTp1RBVUX0Rkk,890
2
- codeecho/__init__.py,sha256=K4rfx0Bkhc1QP35QoURdCi4q3P-BwJXtYWYbfZooY0o,646
3
- codeecho/__main__.py,sha256=G4QpRJZkc39V3XzQTwkRYP6ZaUt7lP9raG9E6Nod-GQ,15684
2
+ codeecho/__init__.py,sha256=hiQsE2th3qQNRytvz0zqIzYWm4-oqSTrxCGEHCtDCwc,646
3
+ codeecho/__main__.py,sha256=6a2Gk_0APYe_MwX2r2kOObi93zINNFpN6nbORI8NUYA,15683
4
4
  codeecho/basis.py,sha256=RHzuplqxCMMlRvEbCJKtqaHPwygLj-o8BBtFQM8qCdc,4365
5
5
  codeecho/config.ini,sha256=EJYoIxA2Z3zDFvG8rG1GFkGWNZhxR5rDottddFG9BvA,33
6
6
  codeecho/config.py,sha256=reJ9gsEQ7QLrrSlmH1AQPQe3ro3KD3dc8iuQavQwK94,992
7
7
  codeecho/db.py,sha256=5ROYg9tuueQNkNCEqCM4Z_-SMZHFDAHT2xJdj6dblrg,10887
8
8
  codeecho/detector.py,sha256=WVH6c4ZHUs6zvNY4AVJ6Rk4nrzT9pvPdiOfkAgfISA8,11108
9
- codeecho/extractor.py,sha256=a5liH8lnLqbPFzUbtY-Ok-sFhthXxt5FHvu77ibe0E8,5879
9
+ codeecho/extractor.py,sha256=sEiolm37CK2clib1F_MzQsyLOcIoQYbDuMhH5SYFkmg,5894
10
10
  codeecho/fingerprint.py,sha256=7Drnfsqg-njFva-mFhSnWdqY9wEhT26w9fTa-oSgooc,1181
11
11
  codeecho/logging.ini,sha256=lsdiIguDTxTqE-Vm8YZLBH6IFd-Jc5pqV1xBRzb4CLk,639
12
12
  codeecho/models.py,sha256=ZlO0xEqVEnWTQKVPpO6qyhxFE89BdJnHVbfZSBafRqE,1544
@@ -16,8 +16,8 @@ codeecho/reporter/__init__.py,sha256=em4qqQ5ta0LYSl1fQs6PdeXqiSfQVpO3PzyGIZo2xfQ
16
16
  codeecho/reporter/html_reporter.py,sha256=pSg2OI2FndSH90gRAXhxxms96zNleSwOPPAoaZkJL8o,11150
17
17
  codeecho/reporter/json_reporter.py,sha256=5St-yNEe5t1i4TiAtU_iUo-J-mIV_y9zkzu3aCmWdb4,4218
18
18
  codeecho/scanner.py,sha256=P4Q6uhdON3Vod5oGIpVtohno9as2TBAziGd07G9gq2g,4210
19
- codeecho-1.2.1.dist-info/METADATA,sha256=PtWX9bD7KiwRCxbYnpqbdr-y0lcthzAylDEqNWvAJ3M,8930
20
- codeecho-1.2.1.dist-info/WHEEL,sha256=M5asmiAlL6HEcOq52Yi5mmk9KmTVjY2RDPtO4p9DMrc,88
21
- codeecho-1.2.1.dist-info/entry_points.txt,sha256=xFm7C6gbwIifpmqvbD9yxlFEt6yhKYOQUs-THG3lzGU,51
22
- codeecho-1.2.1.dist-info/licenses/LICENSE,sha256=Fs1jiRzMbn9F-lRZC-Z219JKSDzhFFCNibLKwGkRtCY,1065
23
- codeecho-1.2.1.dist-info/RECORD,,
19
+ codeecho-1.2.3.dist-info/METADATA,sha256=Qf6ha9yzKKNtX30VlsOtARdr0-iUbPOl3r9CqW_TnIM,8929
20
+ codeecho-1.2.3.dist-info/WHEEL,sha256=M5asmiAlL6HEcOq52Yi5mmk9KmTVjY2RDPtO4p9DMrc,88
21
+ codeecho-1.2.3.dist-info/entry_points.txt,sha256=xFm7C6gbwIifpmqvbD9yxlFEt6yhKYOQUs-THG3lzGU,51
22
+ codeecho-1.2.3.dist-info/licenses/LICENSE,sha256=Fs1jiRzMbn9F-lRZC-Z219JKSDzhFFCNibLKwGkRtCY,1065
23
+ codeecho-1.2.3.dist-info/RECORD,,