codeecho 1.0.1__tar.gz → 1.2.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.
@@ -0,0 +1,41 @@
1
+ # Changelog
2
+
3
+ ## 1.2.0 - 2026-09-18
4
+
5
+ ### Added
6
+
7
+ - `config.ini` (seeded into `CODEECHO_CONFIG_DIR`) with an `[override]` section that lets you rename
8
+ the `.ignore` file via the `ignore-file` key. Falls back to the bundled `.ignore` when the
9
+ configured file is missing.
10
+ - `--target-list` flag: treat `PATH` as a single file listing scan targets, one per line (blank
11
+ lines and `#`-prefixed comments are skipped), instead of passing `PATH` arguments directly.
12
+ - `--basis` flag: file listing basis target paths, one per line — same format as
13
+ `--target-list`. Absolute file/directory entries are merged into the scan automatically
14
+ and matched exactly; relative entries (e.g. a bare filename) are matched by filename/suffix
15
+ against any file discovered in the scan. The report is filtered to only clone groups
16
+ touching at least one basis file, and groups duplicated purely among basis files are
17
+ flagged (`basis_internal` in JSON, a "Basis-to-Basis" badge in HTML, `is_basis` per member).
18
+
19
+ ## 1.1.0 - 2026-08-15
20
+
21
+ ### Added
22
+
23
+ - Gosu (`.gs`, `.gsx`) is now parsed with a dedicated [tree-sitter-gosu](https://github.com/rcw3bb/tree-sitter-gosu)
24
+ grammar instead of the Java fallback, enabling accurate fragment extraction using Gosu-native node types
25
+ (`compilation_unit`, `function_declaration`, `constructor_declaration`, `class_declaration`).
26
+
27
+ ## 1.0.1 - 2026-07-10
28
+
29
+ ### Fixed
30
+
31
+ - Type-3 clone detection no longer flags fragments as clones when one is nested inside the other
32
+ within the same file (e.g. a `function` inside its enclosing `class`).
33
+ - Type-3 clone groups now drop outer/container fragments (e.g. a whole-`file` fragment) when a
34
+ more specific nested fragment from the same file is already a member of that group, preventing
35
+ false positives caused by union-find transitivity.
36
+
37
+ ## 1.0.0 - 2026-07-10
38
+
39
+ ### Added
40
+
41
+ - Initial release of codeecho.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codeecho
3
- Version: 1.0.1
3
+ Version: 1.2.0
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: MIT License
6
6
 
@@ -37,18 +37,18 @@ Requires-Dist: logenrich (>=1.0.1,<2.0.0)
37
37
  Requires-Dist: rich (>=15.0.0,<16.0.0)
38
38
  Requires-Dist: tree-sitter (>=0.26.0,<0.27.0)
39
39
  Requires-Dist: tree-sitter-go (>=0.25.0,<0.26.0)
40
+ Requires-Dist: tree-sitter-gosu (>=0.2.0,<0.3.0)
40
41
  Requires-Dist: tree-sitter-java (>=0.23.5,<0.24.0)
41
42
  Requires-Dist: tree-sitter-javascript (>=0.25.0,<0.26.0)
42
43
  Requires-Dist: tree-sitter-python (>=0.25.0,<0.26.0)
43
44
  Requires-Dist: tree-sitter-typescript (>=0.23.2,<0.24.0)
44
45
  Description-Content-Type: text/markdown
45
46
 
46
- # codeecho 1.0.1
47
+ # codeecho 1.2.0
47
48
 
48
- > 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.
49
+ [![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.0-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/)
49
50
 
50
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
51
- [![Version](https://img.shields.io/badge/version-1.0.1-blue.svg)](CHANGELOG.md)
51
+ > 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.
52
52
 
53
53
  ## Prerequisites
54
54
 
@@ -76,14 +76,14 @@ python -m codeecho <path> [options]
76
76
 
77
77
  ### Supported languages
78
78
 
79
- | Language | Extensions |
80
- |----------|-----------|
81
- | Python | `.py` |
82
- | JavaScript | `.js`, `.mjs`, `.cjs` |
83
- | TypeScript | `.ts`, `.tsx` |
84
- | Java | `.java` |
85
- | Go | `.go` |
86
- | Gosu | `.gs`, `.gsx` |
79
+ | Language | Extensions | Grammar |
80
+ |----------|-----------|--------|
81
+ | Python | `.py` | [tree-sitter-python](https://github.com/tree-sitter/tree-sitter-python) |
82
+ | JavaScript | `.js`, `.mjs`, `.cjs` | [tree-sitter-javascript](https://github.com/tree-sitter/tree-sitter-javascript) |
83
+ | TypeScript | `.ts`, `.tsx` | [tree-sitter-typescript](https://github.com/tree-sitter/tree-sitter-typescript) |
84
+ | Java | `.java` | [tree-sitter-java](https://github.com/tree-sitter/tree-sitter-java) |
85
+ | Go | `.go` | [tree-sitter-go](https://github.com/tree-sitter/tree-sitter-go) |
86
+ | Gosu | `.gs`, `.gsx` | [tree-sitter-gosu](https://github.com/rcw3bb/tree-sitter-gosu) |
87
87
 
88
88
  ### Arguments
89
89
 
@@ -103,6 +103,8 @@ python -m codeecho <path> [options]
103
103
  | `--format <fmt>` | `both` | Output format: `json`, `html`, or `both`. |
104
104
  | `--min-tokens <n>` | `10` | Minimum token count for a code fragment to be included. |
105
105
  | `--exclude <pattern>` | _(none)_ | Glob pattern(s) to exclude from scanning (repeatable). |
106
+ | `--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. |
107
+ | `--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). |
106
108
  | `--version` | | Print the version and exit. |
107
109
  | `-h, --help` | | Show help and exit. |
108
110
 
@@ -138,16 +140,39 @@ Exclude test and vendor directories:
138
140
  python -m codeecho . --exclude "*/tests/*" --exclude "*/vendor/*"
139
141
  ```
140
142
 
143
+ Scan targets listed in a file, one path per line:
144
+
145
+ ```powershell
146
+ python -m codeecho targets.txt --target-list
147
+ ```
148
+
149
+ Find where code from a reference/basis set of files is duplicated elsewhere in the codebase:
150
+
151
+ ```powershell
152
+ python -m codeecho src --basis basis.txt
153
+ ```
154
+
141
155
  ## Configuration
142
156
 
143
157
  | Environment variable | Description |
144
158
  |----------------------|-------------|
145
- | `CODEECHO_CONFIG_DIR` | Directory where `logging.ini` and `.ignore` are seeded on first run. When unset, the bundled copies inside the package are used directly. |
159
+ | `CODEECHO_CONFIG_DIR` | Directory where `logging.ini`, `.ignore`, and `config.ini` are seeded on first run. When unset, the bundled copies inside the package are used directly. |
146
160
 
147
161
  ### `.ignore` file
148
162
 
149
163
  On first run, a `.ignore` file is seeded into `CODEECHO_CONFIG_DIR` (or the package directory when unset). It follows gitignore syntax and is applied during file scanning to exclude paths in addition to any `--exclude` patterns passed on the command line. Edit this file to permanently suppress paths you never want scanned.
150
164
 
165
+ ### Overriding the ignore filename
166
+
167
+ `config.ini` (also seeded into `CODEECHO_CONFIG_DIR` on first run) contains an `[override]` section with an `ignore-file` key, which names the file used in place of `.ignore`, resolved relative to `CODEECHO_CONFIG_DIR`:
168
+
169
+ ```ini
170
+ [override]
171
+ ignore-file = .ignore
172
+ ```
173
+
174
+ Point `ignore-file` at a different filename to use an alternate ignore file (also placed inside `CODEECHO_CONFIG_DIR`). If the configured file is missing, codeecho logs a warning and falls back to the bundled `.ignore`.
175
+
151
176
  ## Development
152
177
 
153
178
  ### Prerequisites
@@ -196,11 +221,11 @@ poetry run pylint codeecho
196
221
  poetry run pytest --cov=codeecho tests --cov-report html
197
222
  ```
198
223
 
199
- ## [Changelog](CHANGELOG.md)
224
+ ## [Changelog](https://github.com/rcw3bb/codeecho/blob/main/CHANGELOG.md)
200
225
 
201
226
  ## License
202
227
 
203
- This project is licensed under the [MIT License](LICENSE).
228
+ This project is licensed under the [MIT License](https://github.com/rcw3bb/codeecho/blob/main/LICENSE).
204
229
 
205
230
  ## Author
206
231
 
@@ -1,9 +1,8 @@
1
- # codeecho 1.0.1
1
+ # codeecho 1.2.0
2
2
 
3
- > 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.
3
+ [![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.0-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/)
4
4
 
5
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
6
- [![Version](https://img.shields.io/badge/version-1.0.1-blue.svg)](CHANGELOG.md)
5
+ > 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.
7
6
 
8
7
  ## Prerequisites
9
8
 
@@ -31,14 +30,14 @@ python -m codeecho <path> [options]
31
30
 
32
31
  ### Supported languages
33
32
 
34
- | Language | Extensions |
35
- |----------|-----------|
36
- | Python | `.py` |
37
- | JavaScript | `.js`, `.mjs`, `.cjs` |
38
- | TypeScript | `.ts`, `.tsx` |
39
- | Java | `.java` |
40
- | Go | `.go` |
41
- | Gosu | `.gs`, `.gsx` |
33
+ | Language | Extensions | Grammar |
34
+ |----------|-----------|--------|
35
+ | Python | `.py` | [tree-sitter-python](https://github.com/tree-sitter/tree-sitter-python) |
36
+ | JavaScript | `.js`, `.mjs`, `.cjs` | [tree-sitter-javascript](https://github.com/tree-sitter/tree-sitter-javascript) |
37
+ | TypeScript | `.ts`, `.tsx` | [tree-sitter-typescript](https://github.com/tree-sitter/tree-sitter-typescript) |
38
+ | Java | `.java` | [tree-sitter-java](https://github.com/tree-sitter/tree-sitter-java) |
39
+ | Go | `.go` | [tree-sitter-go](https://github.com/tree-sitter/tree-sitter-go) |
40
+ | Gosu | `.gs`, `.gsx` | [tree-sitter-gosu](https://github.com/rcw3bb/tree-sitter-gosu) |
42
41
 
43
42
  ### Arguments
44
43
 
@@ -58,6 +57,8 @@ python -m codeecho <path> [options]
58
57
  | `--format <fmt>` | `both` | Output format: `json`, `html`, or `both`. |
59
58
  | `--min-tokens <n>` | `10` | Minimum token count for a code fragment to be included. |
60
59
  | `--exclude <pattern>` | _(none)_ | Glob pattern(s) to exclude from scanning (repeatable). |
60
+ | `--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. |
61
+ | `--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). |
61
62
  | `--version` | | Print the version and exit. |
62
63
  | `-h, --help` | | Show help and exit. |
63
64
 
@@ -93,16 +94,39 @@ Exclude test and vendor directories:
93
94
  python -m codeecho . --exclude "*/tests/*" --exclude "*/vendor/*"
94
95
  ```
95
96
 
97
+ Scan targets listed in a file, one path per line:
98
+
99
+ ```powershell
100
+ python -m codeecho targets.txt --target-list
101
+ ```
102
+
103
+ Find where code from a reference/basis set of files is duplicated elsewhere in the codebase:
104
+
105
+ ```powershell
106
+ python -m codeecho src --basis basis.txt
107
+ ```
108
+
96
109
  ## Configuration
97
110
 
98
111
  | Environment variable | Description |
99
112
  |----------------------|-------------|
100
- | `CODEECHO_CONFIG_DIR` | Directory where `logging.ini` and `.ignore` are seeded on first run. When unset, the bundled copies inside the package are used directly. |
113
+ | `CODEECHO_CONFIG_DIR` | Directory where `logging.ini`, `.ignore`, and `config.ini` are seeded on first run. When unset, the bundled copies inside the package are used directly. |
101
114
 
102
115
  ### `.ignore` file
103
116
 
104
117
  On first run, a `.ignore` file is seeded into `CODEECHO_CONFIG_DIR` (or the package directory when unset). It follows gitignore syntax and is applied during file scanning to exclude paths in addition to any `--exclude` patterns passed on the command line. Edit this file to permanently suppress paths you never want scanned.
105
118
 
119
+ ### Overriding the ignore filename
120
+
121
+ `config.ini` (also seeded into `CODEECHO_CONFIG_DIR` on first run) contains an `[override]` section with an `ignore-file` key, which names the file used in place of `.ignore`, resolved relative to `CODEECHO_CONFIG_DIR`:
122
+
123
+ ```ini
124
+ [override]
125
+ ignore-file = .ignore
126
+ ```
127
+
128
+ Point `ignore-file` at a different filename to use an alternate ignore file (also placed inside `CODEECHO_CONFIG_DIR`). If the configured file is missing, codeecho logs a warning and falls back to the bundled `.ignore`.
129
+
106
130
  ## Development
107
131
 
108
132
  ### Prerequisites
@@ -151,11 +175,11 @@ poetry run pylint codeecho
151
175
  poetry run pytest --cov=codeecho tests --cov-report html
152
176
  ```
153
177
 
154
- ## [Changelog](CHANGELOG.md)
178
+ ## [Changelog](https://github.com/rcw3bb/codeecho/blob/main/CHANGELOG.md)
155
179
 
156
180
  ## License
157
181
 
158
- This project is licensed under the [MIT License](LICENSE).
182
+ This project is licensed under the [MIT License](https://github.com/rcw3bb/codeecho/blob/main/LICENSE).
159
183
 
160
184
  ## Author
161
185
 
@@ -2,21 +2,25 @@
2
2
  codeecho - A developer tool that scans your codebase to detect and highlight ECHOES
3
3
  of duplicated or near-duplicated code so you can refactor toward cleaner, more
4
4
  maintainable designs.
5
+
6
+ :author: Ron Webb
7
+ :since: 1.0.0
5
8
  """
6
9
 
7
10
  from env_dir_bootstrap import EnvDirBootstrap
8
11
  from logenrich import setup_logger
9
12
 
10
- __version__ = "1.0.1"
13
+ __version__ = "1.2.0"
11
14
 
12
15
  _bootstrapper = EnvDirBootstrap(
13
16
  env_var="CODEECHO_CONFIG_DIR",
14
- resources=["logging.ini", ".ignore"],
17
+ resources=["logging.ini", ".ignore", "config.ini"],
15
18
  package="codeecho",
16
19
  )
17
20
 
18
21
  _bootstrapper.setup()
19
22
 
20
23
  CONF_DIR = str(_bootstrapper.get_dir())
24
+ DEFAULT_IGNORE_PATH = _bootstrapper.resolve(".ignore")
21
25
 
22
26
  setup_logger("codeecho", conf_dir=CONF_DIR)