codecaliper 0.1.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.
Files changed (168) hide show
  1. codecaliper-0.1.0/.editorconfig +31 -0
  2. codecaliper-0.1.0/.gitattributes +12 -0
  3. codecaliper-0.1.0/.gitignore +41 -0
  4. codecaliper-0.1.0/.mailmap +3 -0
  5. codecaliper-0.1.0/ARCHITECTURE.md +661 -0
  6. codecaliper-0.1.0/CHANGELOG.md +170 -0
  7. codecaliper-0.1.0/CITATION.cff +47 -0
  8. codecaliper-0.1.0/CODE_OF_CONDUCT.md +56 -0
  9. codecaliper-0.1.0/CONTRIBUTING.md +60 -0
  10. codecaliper-0.1.0/LICENSE +21 -0
  11. codecaliper-0.1.0/NOTICE +29 -0
  12. codecaliper-0.1.0/PKG-INFO +180 -0
  13. codecaliper-0.1.0/README.md +134 -0
  14. codecaliper-0.1.0/RELEASING.md +100 -0
  15. codecaliper-0.1.0/SECURITY.md +22 -0
  16. codecaliper-0.1.0/constraints/build.txt +13 -0
  17. codecaliper-0.1.0/constraints/ci.txt +18 -0
  18. codecaliper-0.1.0/constraints/docs.txt +40 -0
  19. codecaliper-0.1.0/constraints/retrain.txt +14 -0
  20. codecaliper-0.1.0/docs/api.md +63 -0
  21. codecaliper-0.1.0/docs/contributing.md +8 -0
  22. codecaliper-0.1.0/docs/honesty.md +108 -0
  23. codecaliper-0.1.0/docs/index.md +67 -0
  24. codecaliper-0.1.0/docs/quickstart.md +134 -0
  25. codecaliper-0.1.0/docs/spec/divergences.md +52 -0
  26. codecaliper-0.1.0/docs/spec/rulings.md +711 -0
  27. codecaliper-0.1.0/docs/validation.md +30 -0
  28. codecaliper-0.1.0/mkdocs.yml +76 -0
  29. codecaliper-0.1.0/notes.md +153 -0
  30. codecaliper-0.1.0/pyproject.toml +112 -0
  31. codecaliper-0.1.0/src/codecaliper/__init__.py +64 -0
  32. codecaliper-0.1.0/src/codecaliper/_version.py +1 -0
  33. codecaliper-0.1.0/src/codecaliper/api.py +446 -0
  34. codecaliper-0.1.0/src/codecaliper/canonical.py +130 -0
  35. codecaliper-0.1.0/src/codecaliper/cli.py +231 -0
  36. codecaliper-0.1.0/src/codecaliper/errors.py +27 -0
  37. codecaliper-0.1.0/src/codecaliper/languages/__init__.py +44 -0
  38. codecaliper-0.1.0/src/codecaliper/languages/base.py +162 -0
  39. codecaliper-0.1.0/src/codecaliper/languages/java.py +192 -0
  40. codecaliper-0.1.0/src/codecaliper/languages/python.py +179 -0
  41. codecaliper-0.1.0/src/codecaliper/metrics/__init__.py +0 -0
  42. codecaliper-0.1.0/src/codecaliper/metrics/base.py +55 -0
  43. codecaliper-0.1.0/src/codecaliper/metrics/cognitive.py +111 -0
  44. codecaliper-0.1.0/src/codecaliper/metrics/cyclomatic.py +62 -0
  45. codecaliper-0.1.0/src/codecaliper/metrics/halstead.py +55 -0
  46. codecaliper-0.1.0/src/codecaliper/metrics/loc.py +62 -0
  47. codecaliper-0.1.0/src/codecaliper/metrics/mi.py +31 -0
  48. codecaliper-0.1.0/src/codecaliper/model.py +132 -0
  49. codecaliper-0.1.0/src/codecaliper/py.typed +0 -0
  50. codecaliper-0.1.0/src/codecaliper/readability/__init__.py +13 -0
  51. codecaliper-0.1.0/src/codecaliper/readability/base.py +11 -0
  52. codecaliper-0.1.0/src/codecaliper/readability/bw2010.py +156 -0
  53. codecaliper-0.1.0/src/codecaliper/readability/granularity.py +210 -0
  54. codecaliper-0.1.0/src/codecaliper/readability/retrain.py +67 -0
  55. codecaliper-0.1.0/src/codecaliper/spec/__init__.py +3 -0
  56. codecaliper-0.1.0/src/codecaliper/spec/registry.py +112 -0
  57. codecaliper-0.1.0/src/codecaliper/spec/rulings/bw.toml +156 -0
  58. codecaliper-0.1.0/src/codecaliper/spec/rulings/cognitive.toml +124 -0
  59. codecaliper-0.1.0/src/codecaliper/spec/rulings/core.toml +87 -0
  60. codecaliper-0.1.0/src/codecaliper/spec/rulings/cyclomatic.toml +172 -0
  61. codecaliper-0.1.0/src/codecaliper/spec/rulings/halstead.toml +20 -0
  62. codecaliper-0.1.0/src/codecaliper/spec/rulings/index.toml +54 -0
  63. codecaliper-0.1.0/src/codecaliper/spec/rulings/loc.toml +50 -0
  64. codecaliper-0.1.0/src/codecaliper/spec/rulings/mi.toml +15 -0
  65. codecaliper-0.1.0/src/codecaliper/spec/rulings/tokenization.toml +191 -0
  66. codecaliper-0.1.0/src/codecaliper/spec/validated_grammars.toml +6 -0
  67. codecaliper-0.1.0/src/codecaliper/syntax/__init__.py +0 -0
  68. codecaliper-0.1.0/src/codecaliper/syntax/_treesitter.py +179 -0
  69. codecaliper-0.1.0/src/codecaliper/syntax/grammars.py +45 -0
  70. codecaliper-0.1.0/src/codecaliper/syntax/tokens.py +165 -0
  71. codecaliper-0.1.0/tests/_reference/__init__.py +0 -0
  72. codecaliper-0.1.0/tests/_reference/bw_stdlib.py +158 -0
  73. codecaliper-0.1.0/tests/_reference/py_ast_lane.py +161 -0
  74. codecaliper-0.1.0/tests/conftest.py +85 -0
  75. codecaliper-0.1.0/tests/corpus/java/java-block-comment-001/expected.toml +28 -0
  76. codecaliper-0.1.0/tests/corpus/java/java-block-comment-001/input.java +6 -0
  77. codecaliper-0.1.0/tests/corpus/java/java-boolop-catch-001/expected.toml +33 -0
  78. codecaliper-0.1.0/tests/corpus/java/java-boolop-catch-001/input.java +12 -0
  79. codecaliper-0.1.0/tests/corpus/java/java-contextual-001/expected.toml +45 -0
  80. codecaliper-0.1.0/tests/corpus/java/java-contextual-001/input.java +10 -0
  81. codecaliper-0.1.0/tests/corpus/java/java-elseif-001/expected.toml +36 -0
  82. codecaliper-0.1.0/tests/corpus/java/java-elseif-001/input.java +11 -0
  83. codecaliper-0.1.0/tests/corpus/java/java-labeled-jump-001/expected.toml +40 -0
  84. codecaliper-0.1.0/tests/corpus/java/java-labeled-jump-001/input.java +15 -0
  85. codecaliper-0.1.0/tests/corpus/java/java-loops-001/expected.toml +55 -0
  86. codecaliper-0.1.0/tests/corpus/java/java-loops-001/input.java +17 -0
  87. codecaliper-0.1.0/tests/corpus/java/java-snippet-constructor-001/expected.toml +107 -0
  88. codecaliper-0.1.0/tests/corpus/java/java-snippet-constructor-001/input.java +6 -0
  89. codecaliper-0.1.0/tests/corpus/java/java-switch-001/expected.toml +36 -0
  90. codecaliper-0.1.0/tests/corpus/java/java-switch-001/input.java +14 -0
  91. codecaliper-0.1.0/tests/corpus/java/java-ternary-001/expected.toml +35 -0
  92. codecaliper-0.1.0/tests/corpus/java/java-ternary-001/input.java +7 -0
  93. codecaliper-0.1.0/tests/corpus/java/java-underscore-001/expected.toml +44 -0
  94. codecaliper-0.1.0/tests/corpus/java/java-underscore-001/input.java +6 -0
  95. codecaliper-0.1.0/tests/corpus/python/py-blank-lines-001/expected.toml +32 -0
  96. codecaliper-0.1.0/tests/corpus/python/py-blank-lines-001/input.py +4 -0
  97. codecaliper-0.1.0/tests/corpus/python/py-bw-fallback-001/expected.toml +81 -0
  98. codecaliper-0.1.0/tests/corpus/python/py-bw-fallback-001/input.py +5 -0
  99. codecaliper-0.1.0/tests/corpus/python/py-cc-boolop-001/expected.toml +84 -0
  100. codecaliper-0.1.0/tests/corpus/python/py-cc-boolop-001/input.py +5 -0
  101. codecaliper-0.1.0/tests/corpus/python/py-comprehension-001/expected.toml +34 -0
  102. codecaliper-0.1.0/tests/corpus/python/py-comprehension-001/input.py +2 -0
  103. codecaliper-0.1.0/tests/corpus/python/py-concat-string-001/expected.toml +46 -0
  104. codecaliper-0.1.0/tests/corpus/python/py-concat-string-001/input.py +5 -0
  105. codecaliper-0.1.0/tests/corpus/python/py-elif-chain-001/expected.toml +40 -0
  106. codecaliper-0.1.0/tests/corpus/python/py-elif-chain-001/input.py +9 -0
  107. codecaliper-0.1.0/tests/corpus/python/py-ellipsis-001/expected.toml +74 -0
  108. codecaliper-0.1.0/tests/corpus/python/py-ellipsis-001/input.py +4 -0
  109. codecaliper-0.1.0/tests/corpus/python/py-error-opacity-001/expected.toml +40 -0
  110. codecaliper-0.1.0/tests/corpus/python/py-error-opacity-001/input.py +6 -0
  111. codecaliper-0.1.0/tests/corpus/python/py-future-import-001/expected.toml +51 -0
  112. codecaliper-0.1.0/tests/corpus/python/py-future-import-001/input.py +7 -0
  113. codecaliper-0.1.0/tests/corpus/python/py-match-001/expected.toml +45 -0
  114. codecaliper-0.1.0/tests/corpus/python/py-match-001/input.py +17 -0
  115. codecaliper-0.1.0/tests/corpus/python/py-multiline-string-001/expected.toml +33 -0
  116. codecaliper-0.1.0/tests/corpus/python/py-multiline-string-001/input.py +4 -0
  117. codecaliper-0.1.0/tests/corpus/python/py-nested-function-001/expected.toml +34 -0
  118. codecaliper-0.1.0/tests/corpus/python/py-nested-function-001/input.py +10 -0
  119. codecaliper-0.1.0/tests/corpus/python/py-recursion-001/expected.toml +28 -0
  120. codecaliper-0.1.0/tests/corpus/python/py-recursion-001/input.py +4 -0
  121. codecaliper-0.1.0/tests/corpus/python/py-ternary-001/expected.toml +43 -0
  122. codecaliper-0.1.0/tests/corpus/python/py-ternary-001/input.py +4 -0
  123. codecaliper-0.1.0/tests/corpus/python/py-tok-normalize-001/expected.toml +105 -0
  124. codecaliper-0.1.0/tests/corpus/python/py-tok-normalize-001/input.py +4 -0
  125. codecaliper-0.1.0/tests/corpus/python/py-try-except-001/expected.toml +119 -0
  126. codecaliper-0.1.0/tests/corpus/python/py-try-except-001/input.py +7 -0
  127. codecaliper-0.1.0/tests/differential/__init__.py +9 -0
  128. codecaliper-0.1.0/tests/differential/_harness.py +382 -0
  129. codecaliper-0.1.0/tests/differential/divergences.toml +143 -0
  130. codecaliper-0.1.0/tests/differential/test_cognitive.py +30 -0
  131. codecaliper-0.1.0/tests/differential/test_lizard.py +29 -0
  132. codecaliper-0.1.0/tests/differential/test_radon.py +28 -0
  133. codecaliper-0.1.0/tests/differential/test_table.py +45 -0
  134. codecaliper-0.1.0/tests/snapshots/corpus_values.json +1200 -0
  135. codecaliper-0.1.0/tests/test_bw_port_fidelity.py +72 -0
  136. codecaliper-0.1.0/tests/test_cli.py +156 -0
  137. codecaliper-0.1.0/tests/test_consistency_corpus.py +152 -0
  138. codecaliper-0.1.0/tests/test_determinism.py +37 -0
  139. codecaliper-0.1.0/tests/test_grammar_integrity.py +63 -0
  140. codecaliper-0.1.0/tests/test_measure_behavior.py +480 -0
  141. codecaliper-0.1.0/tests/test_perf_smoke.py +41 -0
  142. codecaliper-0.1.0/tests/test_python_lane_crosscheck.py +96 -0
  143. codecaliper-0.1.0/tests/test_spec_coverage.py +106 -0
  144. codecaliper-0.1.0/tests/test_spec_drift.py +65 -0
  145. codecaliper-0.1.0/tests/tools_snapshot.py +52 -0
  146. codecaliper-0.1.0/tools/gen_divergences.py +101 -0
  147. codecaliper-0.1.0/tools/gen_spec_docs.py +51 -0
  148. codecaliper-0.1.0/tools/update_snapshot.py +94 -0
  149. codecaliper-0.1.0/validation/bw_faithfulness/README.md +101 -0
  150. codecaliper-0.1.0/validation/bw_faithfulness/arbitrate.py +831 -0
  151. codecaliper-0.1.0/validation/bw_faithfulness/dataset.toml +27 -0
  152. codecaliper-0.1.0/validation/bw_faithfulness/derived/arbitration_inputs/extract_meta_fallback_on_tab1.json +46 -0
  153. codecaliper-0.1.0/validation/bw_faithfulness/derived/arbitration_inputs/features_fallback_on_tab1.csv +101 -0
  154. codecaliper-0.1.0/validation/bw_faithfulness/derived/arbitration_inputs/train_results_fallback_off.json +251 -0
  155. codecaliper-0.1.0/validation/bw_faithfulness/derived/arbitration_report.json +1183 -0
  156. codecaliper-0.1.0/validation/bw_faithfulness/derived/arbitration_report.md +105 -0
  157. codecaliper-0.1.0/validation/bw_faithfulness/derived/bw_faithfulness_report.json +270 -0
  158. codecaliper-0.1.0/validation/bw_faithfulness/derived/bw_faithfulness_report.md +69 -0
  159. codecaliper-0.1.0/validation/bw_faithfulness/derived/extract_meta.json +45 -0
  160. codecaliper-0.1.0/validation/bw_faithfulness/derived/features.csv +101 -0
  161. codecaliper-0.1.0/validation/bw_faithfulness/derived/features_fallback_off.csv +101 -0
  162. codecaliper-0.1.0/validation/bw_faithfulness/derived/train_results.json +255 -0
  163. codecaliper-0.1.0/validation/bw_faithfulness/extract.py +171 -0
  164. codecaliper-0.1.0/validation/bw_faithfulness/fetch.py +54 -0
  165. codecaliper-0.1.0/validation/bw_faithfulness/fig9_signs.toml +155 -0
  166. codecaliper-0.1.0/validation/bw_faithfulness/report.py +194 -0
  167. codecaliper-0.1.0/validation/bw_faithfulness/stats.py +59 -0
  168. codecaliper-0.1.0/validation/bw_faithfulness/train.py +267 -0
@@ -0,0 +1,31 @@
1
+ # EditorConfig (https://editorconfig.org) — keeps non-Python files consistent;
2
+ # Python style is enforced by ruff (line-length 100, see pyproject.toml).
3
+ root = true
4
+
5
+ [*]
6
+ charset = utf-8
7
+ end_of_line = lf
8
+ insert_final_newline = true
9
+ trim_trailing_whitespace = true
10
+ indent_style = space
11
+
12
+ [*.py]
13
+ indent_size = 4
14
+ max_line_length = 100
15
+
16
+ [*.{toml,yml,yaml}]
17
+ indent_size = 2
18
+
19
+ [*.md]
20
+ # Markdown uses trailing double-space as a hard line break.
21
+ trim_trailing_whitespace = false
22
+
23
+ # Corpus fixtures are measurement inputs with hand-computed expected values —
24
+ # trailing whitespace and missing final newlines can be the very thing a case
25
+ # measures (e.g. py-blank-lines-001). Editors must never "clean" them; a silent
26
+ # fix here surfaces later as a baffling spec-drift gate failure.
27
+ [tests/corpus/**]
28
+ trim_trailing_whitespace = false
29
+ insert_final_newline = false
30
+ indent_style = unset
31
+ indent_size = unset
@@ -0,0 +1,12 @@
1
+ # Normalize everything to LF in the repository and on checkout — the
2
+ # reproducibility claim (byte-identical outputs per platform) dies if git
3
+ # rewrites source line endings differently per contributor.
4
+ * text=auto eol=lf
5
+
6
+ # Corpus fixtures are MEASUREMENT INPUTS with hand-computed expected values:
7
+ # their exact bytes (line endings, trailing whitespace, BOMs for future TOK-*
8
+ # cases) are load-bearing. Never convert them.
9
+ tests/corpus/** -text
10
+
11
+ # Reference dataset snapshots, if any ever land, are exact bytes too.
12
+ tests/snapshots/** -text
@@ -0,0 +1,41 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ dist/
6
+ build/
7
+ .venv/
8
+ venv/
9
+ .python-version
10
+ .mypy_cache/
11
+ .pytest_cache/
12
+ .ruff_cache/
13
+ .hypothesis/
14
+ .tox/
15
+ .nox/
16
+ .coverage
17
+ .coverage.*
18
+ coverage.xml
19
+ htmlcov/
20
+
21
+ # BW faithfulness dataset cache — the license-UNVERIFIED data is NEVER committed
22
+ # (ARCHITECTURE.md §8.3). cache/ holds the fetched archive and anything extracted
23
+ # from it; the committable extractor outputs live in the TRACKED sibling
24
+ # validation/bw_faithfulness/derived/ — do not add ignore rules for derived/.
25
+ validation/bw_faithfulness/cache/
26
+ validation/bw_faithfulness/*.zip
27
+
28
+ # mkdocs build output (deployed by .github/workflows/docs.yml, never committed)
29
+ site/
30
+
31
+ # MSR paper sources — submission material, kept local until publication
32
+ # (pyproject.toml excludes it from the sdist and release.yml asserts that,
33
+ # as defense in depth should this rule ever be dropped)
34
+ paper/
35
+
36
+ # Editors / OS
37
+ .idea/
38
+ .vscode/
39
+ *.swp
40
+ *~
41
+ .DS_Store
@@ -0,0 +1,3 @@
1
+ # Canonical publishing identity (matches CITATION.cff and pyproject.toml).
2
+ Yuxiang Ji <kurathandrew@gmail.com> Kurath <112796037+KurathSec@users.noreply.github.com>
3
+ Yuxiang Ji <kurathandrew@gmail.com> <kurath0307@gmail.com>