codeecho 1.1.0__tar.gz → 1.2.1__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.
- codeecho-1.2.1/CHANGELOG.md +52 -0
- {codeecho-1.1.0 → codeecho-1.2.1}/PKG-INFO +45 -30
- {codeecho-1.1.0 → codeecho-1.2.1}/README.md +31 -7
- {codeecho-1.1.0 → codeecho-1.2.1}/codeecho/__init__.py +6 -2
- {codeecho-1.1.0 → codeecho-1.2.1}/codeecho/__main__.py +235 -41
- codeecho-1.2.1/codeecho/basis.py +101 -0
- codeecho-1.2.1/codeecho/config.ini +2 -0
- codeecho-1.2.1/codeecho/config.py +41 -0
- {codeecho-1.1.0 → codeecho-1.2.1}/codeecho/db.py +42 -11
- {codeecho-1.1.0 → codeecho-1.2.1}/codeecho/detector.py +44 -10
- {codeecho-1.1.0 → codeecho-1.2.1}/codeecho/extractor.py +5 -1
- {codeecho-1.1.0 → codeecho-1.2.1}/codeecho/fingerprint.py +9 -2
- {codeecho-1.1.0 → codeecho-1.2.1}/codeecho/models.py +4 -0
- {codeecho-1.1.0 → codeecho-1.2.1}/codeecho/normalizer.py +30 -6
- {codeecho-1.1.0 → codeecho-1.2.1}/codeecho/parser.py +11 -2
- {codeecho-1.1.0 → codeecho-1.2.1}/codeecho/reporter/html_reporter.py +42 -10
- {codeecho-1.1.0 → codeecho-1.2.1}/codeecho/reporter/json_reporter.py +45 -10
- {codeecho-1.1.0 → codeecho-1.2.1}/codeecho/scanner.py +9 -2
- {codeecho-1.1.0 → codeecho-1.2.1}/pyproject.toml +22 -6
- codeecho-1.1.0/CHANGELOG.md +0 -25
- {codeecho-1.1.0 → codeecho-1.2.1}/LICENSE +0 -0
- {codeecho-1.1.0 → codeecho-1.2.1}/codeecho/.ignore +0 -0
- {codeecho-1.1.0 → codeecho-1.2.1}/codeecho/logging.ini +0 -0
- {codeecho-1.1.0 → codeecho-1.2.1}/codeecho/reporter/__init__.py +0 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.2.1 - 2026-09-19
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- Packaging metadata updated for publishing to PyPI: added `keywords`, `classifiers`,
|
|
8
|
+
and `[project.urls]` (Homepage, Repository, Documentation, Bug Tracker, Changelog).
|
|
9
|
+
- License declared via the SPDX `license = "MIT"` string with `license-files = ["LICENSE"]`
|
|
10
|
+
instead of the deprecated `{file = "LICENSE"}` table, and the redundant MIT classifier
|
|
11
|
+
was dropped.
|
|
12
|
+
- The `codeecho` console entry point moved from `[tool.poetry.scripts]` to `[project.scripts]`.
|
|
13
|
+
|
|
14
|
+
## 1.2.0 - 2026-09-18
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- `config.ini` (seeded into `CODEECHO_CONFIG_DIR`) with an `[override]` section that lets you rename
|
|
19
|
+
the `.ignore` file via the `ignore-file` key. Falls back to the bundled `.ignore` when the
|
|
20
|
+
configured file is missing.
|
|
21
|
+
- `--target-list` flag: treat `PATH` as a single file listing scan targets, one per line (blank
|
|
22
|
+
lines and `#`-prefixed comments are skipped), instead of passing `PATH` arguments directly.
|
|
23
|
+
- `--basis` flag: file listing basis target paths, one per line — same format as
|
|
24
|
+
`--target-list`. Absolute file/directory entries are merged into the scan automatically
|
|
25
|
+
and matched exactly; relative entries (e.g. a bare filename) are matched by filename/suffix
|
|
26
|
+
against any file discovered in the scan. The report is filtered to only clone groups
|
|
27
|
+
touching at least one basis file, and groups duplicated purely among basis files are
|
|
28
|
+
flagged (`basis_internal` in JSON, a "Basis-to-Basis" badge in HTML, `is_basis` per member).
|
|
29
|
+
|
|
30
|
+
## 1.1.0 - 2026-08-15
|
|
31
|
+
|
|
32
|
+
### Added
|
|
33
|
+
|
|
34
|
+
- Gosu (`.gs`, `.gsx`) is now parsed with a dedicated [tree-sitter-gosu](https://github.com/rcw3bb/tree-sitter-gosu)
|
|
35
|
+
grammar instead of the Java fallback, enabling accurate fragment extraction using Gosu-native node types
|
|
36
|
+
(`compilation_unit`, `function_declaration`, `constructor_declaration`, `class_declaration`).
|
|
37
|
+
|
|
38
|
+
## 1.0.1 - 2026-07-10
|
|
39
|
+
|
|
40
|
+
### Fixed
|
|
41
|
+
|
|
42
|
+
- Type-3 clone detection no longer flags fragments as clones when one is nested inside the other
|
|
43
|
+
within the same file (e.g. a `function` inside its enclosing `class`).
|
|
44
|
+
- Type-3 clone groups now drop outer/container fragments (e.g. a whole-`file` fragment) when a
|
|
45
|
+
more specific nested fragment from the same file is already a member of that group, preventing
|
|
46
|
+
false positives caused by union-find transitivity.
|
|
47
|
+
|
|
48
|
+
## 1.0.0 - 2026-07-10
|
|
49
|
+
|
|
50
|
+
### Added
|
|
51
|
+
|
|
52
|
+
- Initial release of codeecho.
|
|
@@ -1,34 +1,20 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: codeecho
|
|
3
|
-
Version: 1.1
|
|
3
|
+
Version: 1.2.1
|
|
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
|
-
License: MIT
|
|
6
|
-
|
|
7
|
-
Copyright (c) 2026 Ron Webb
|
|
8
|
-
|
|
9
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
11
|
-
in the Software without restriction, including without limitation the rights
|
|
12
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
14
|
-
furnished to do so, subject to the following conditions:
|
|
15
|
-
|
|
16
|
-
The above copyright notice and this permission notice shall be included in all
|
|
17
|
-
copies or substantial portions of the Software.
|
|
18
|
-
|
|
19
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
-
SOFTWARE.
|
|
5
|
+
License-Expression: MIT
|
|
26
6
|
License-File: LICENSE
|
|
7
|
+
Keywords: code-duplication,clone-detection,refactoring,static-analysis,tree-sitter
|
|
27
8
|
Author: Ron Webb
|
|
28
9
|
Requires-Python: >=3.14
|
|
29
|
-
Classifier:
|
|
10
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
30
14
|
Classifier: Programming Language :: Python :: 3
|
|
31
15
|
Classifier: Programming Language :: Python :: 3.14
|
|
16
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
17
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
32
18
|
Requires-Dist: braincraft (>=1.2.0,<2.0.0)
|
|
33
19
|
Requires-Dist: click (>=8.4.2,<9.0.0)
|
|
34
20
|
Requires-Dist: env-dir-bootstrap (>=1.1.0,<2.0.0)
|
|
@@ -42,14 +28,18 @@ Requires-Dist: tree-sitter-java (>=0.23.5,<0.24.0)
|
|
|
42
28
|
Requires-Dist: tree-sitter-javascript (>=0.25.0,<0.26.0)
|
|
43
29
|
Requires-Dist: tree-sitter-python (>=0.25.0,<0.26.0)
|
|
44
30
|
Requires-Dist: tree-sitter-typescript (>=0.23.2,<0.24.0)
|
|
31
|
+
Project-URL: Changelog, https://github.com/rcw3bb/codeecho/blob/main/CHANGELOG.md
|
|
32
|
+
Project-URL: Documentation, https://github.com/rcw3bb/codeecho#readme
|
|
33
|
+
Project-URL: Homepage, https://github.com/rcw3bb/codeecho
|
|
34
|
+
Project-URL: Issues, https://github.com/rcw3bb/codeecho/issues
|
|
35
|
+
Project-URL: Repository, https://github.com/rcw3bb/codeecho
|
|
45
36
|
Description-Content-Type: text/markdown
|
|
46
37
|
|
|
47
|
-
# codeecho
|
|
38
|
+
# codeecho
|
|
48
39
|
|
|
49
|
-
|
|
40
|
+
[](https://github.com/rcw3bb/codeecho/blob/main/LICENSE) [](https://github.com/rcw3bb/codeecho/blob/main/CHANGELOG.md) [](https://www.python.org/) [](https://pypi.org/project/codeecho/)
|
|
50
41
|
|
|
51
|
-
|
|
52
|
-
[](CHANGELOG.md)
|
|
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.
|
|
53
43
|
|
|
54
44
|
## Prerequisites
|
|
55
45
|
|
|
@@ -104,6 +94,8 @@ python -m codeecho <path> [options]
|
|
|
104
94
|
| `--format <fmt>` | `both` | Output format: `json`, `html`, or `both`. |
|
|
105
95
|
| `--min-tokens <n>` | `10` | Minimum token count for a code fragment to be included. |
|
|
106
96
|
| `--exclude <pattern>` | _(none)_ | Glob pattern(s) to exclude from scanning (repeatable). |
|
|
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
|
+
| `--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). |
|
|
107
99
|
| `--version` | | Print the version and exit. |
|
|
108
100
|
| `-h, --help` | | Show help and exit. |
|
|
109
101
|
|
|
@@ -139,16 +131,39 @@ Exclude test and vendor directories:
|
|
|
139
131
|
python -m codeecho . --exclude "*/tests/*" --exclude "*/vendor/*"
|
|
140
132
|
```
|
|
141
133
|
|
|
134
|
+
Scan targets listed in a file, one path per line:
|
|
135
|
+
|
|
136
|
+
```powershell
|
|
137
|
+
python -m codeecho targets.txt --target-list
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Find where code from a reference/basis set of files is duplicated elsewhere in the codebase:
|
|
141
|
+
|
|
142
|
+
```powershell
|
|
143
|
+
python -m codeecho src --basis basis.txt
|
|
144
|
+
```
|
|
145
|
+
|
|
142
146
|
## Configuration
|
|
143
147
|
|
|
144
148
|
| Environment variable | Description |
|
|
145
149
|
|----------------------|-------------|
|
|
146
|
-
| `CODEECHO_CONFIG_DIR` | Directory where `logging.ini
|
|
150
|
+
| `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. |
|
|
147
151
|
|
|
148
152
|
### `.ignore` file
|
|
149
153
|
|
|
150
154
|
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.
|
|
151
155
|
|
|
156
|
+
### Overriding the ignore filename
|
|
157
|
+
|
|
158
|
+
`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`:
|
|
159
|
+
|
|
160
|
+
```ini
|
|
161
|
+
[override]
|
|
162
|
+
ignore-file = .ignore
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
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`.
|
|
166
|
+
|
|
152
167
|
## Development
|
|
153
168
|
|
|
154
169
|
### Prerequisites
|
|
@@ -197,11 +212,11 @@ poetry run pylint codeecho
|
|
|
197
212
|
poetry run pytest --cov=codeecho tests --cov-report html
|
|
198
213
|
```
|
|
199
214
|
|
|
200
|
-
## [Changelog](CHANGELOG.md)
|
|
215
|
+
## [Changelog](https://github.com/rcw3bb/codeecho/blob/main/CHANGELOG.md)
|
|
201
216
|
|
|
202
217
|
## License
|
|
203
218
|
|
|
204
|
-
This project is licensed under the [MIT License](LICENSE).
|
|
219
|
+
This project is licensed under the [MIT License](https://github.com/rcw3bb/codeecho/blob/main/LICENSE).
|
|
205
220
|
|
|
206
221
|
## Author
|
|
207
222
|
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
# codeecho
|
|
1
|
+
# codeecho
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://github.com/rcw3bb/codeecho/blob/main/LICENSE) [](https://github.com/rcw3bb/codeecho/blob/main/CHANGELOG.md) [](https://www.python.org/) [](https://pypi.org/project/codeecho/)
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
[](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
|
|
|
@@ -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
|
|
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.1
|
|
13
|
+
__version__ = "1.2.1"
|
|
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)
|