Skip to content

Releases: ysk8hori/typescript-graph

v0.19.1

05 Jan 23:54
2cbcc4d
Compare
Choose a tag to compare

0.19.1 (2025-01-05)

Bug Fixes

  • metrics: current ディレクトリにない tsconfig を指定して解析する際にソースコードのパスが不正になる件を修正 (fbe9b71)

v0.19.0

03 Jan 02:49
d58ae06
Compare
Choose a tag to compare

0.19.0 (2025-01-03)

Features

  • watchmetrics: --watch-metrics で変更したファイルの metrics を watch 可能とする (6e59fd3)
  • watchmetrics: しきい値を下回った場合の表現を実装 (3c77433)
  • watchmetrics: 起動時と現在値の差分を表示する (4209c00)

v0.18.0

01 Jan 14:23
cd9f08e
Compare
Choose a tag to compare

🚀 Code Metrics (ベータ版) が登場!

--metrics オプションを使って、コードの複雑さや保守性を測定可能にしました。以下のメトリクスが計測可能です:

📊 保守容易性指数 (Maintainability Index)

以下のリソースを参考に、保守容易性指数の計測を実装しました:

Maintainability Index は 0〜100 までの値であり、関数やクラスのメソッドにおいては 20 を下回ると注意表示、10を下回ると警告表示となります。

TypeScript Graph オリジナル仕様:

  • Cyclomatic Complexity と Cognitive Complexity を等価に考慮。
  • Halstead Volume の代わりに「意味のある構文要素量」を使用した Semantic Syntax Volume を採用。

🔄 循環的複雑度 (Cyclomatic Complexity)

コード内の線形的に独立した経路数を直接数えるメトリクスです。(wiki)

🧠 認知的複雑度 (Cognitive Complexity)

SonarSource 社の G. Ann Campbell 氏によるホワイトペーパー「A new way of measuring understandability」を参考に実装しています。
※このプロジェクトは SonarSource 社と提携していません。

📏 行数 (Lines)

対象コードの行数を単純にカウントします。

📐 Semantic Syntax Volume

Halstead Volume の代替として、意味のある構文ノードを用いて計測した指標です。この方法を Semantic Syntax Volume と呼びます。

その他

オペランド数や Semantic Syntax 数も計測可能です。


🚀 Introducing Code Metrics (Beta)!

With the --metrics option, you can now measure code complexity and maintainability. The following metrics are available:

📊 Maintainability Index

We implemented the Maintainability Index based on the following references:

TypeScript Graph Custom Features:

  • Equal consideration of Cyclomatic Complexity and Cognitive Complexity.
  • Replaced Halstead Volume with a metric based on "meaningful syntax nodes," named Semantic Syntax Volume.

🔄 Cyclomatic Complexity

This metric counts the number of linearly independent paths through the code. (wiki)

🧠 Cognitive Complexity

Implemented following G. Ann Campbell's white paper “A new way of measuring understandability” by SonarSource.
※ This project is not affiliated with SonarSource.

📏 Lines

Simple count of the total lines of code.

📐 Semantic Syntax Volume

Instead of Halstead Volume, this metric measures "meaningful syntax nodes" in the code. We refer to this approach as Semantic Syntax Volume.

Additional Metrics

Operands and Semantic Syntax counts are also available.


例えば、 TypeScript Graph のプロジェクトの Metrics は以下のように出力されます。

tsg --metrics

Code Metrics

filescopenameMaintainability IndexCyclomatic ComplexityCognitive Complexitylinessemantic syntax volumetotal operandsunique operandstotal semantic syntaxunique semantic syntax
src/graph/createGraph.tsfile-13.19325027710010.8259117967858
src/graph/createGraph.tsfunctionanalyzeSoucreFile33.611629682186.211576117535
src/graph/createGraph.tsfunctioncreateGraphForVue34.9646742337.191667718031
src/graph/createGraph.tsfunctioncreateGraph39.6565491771.081226614435
src/graph/createGraph.tsfunctiongetVueAndTsFilePathsRecursive45.63539544.6348334916
src/graph/createGraph.tsfunctiongetName54.165217442.837174820
src/graph/createGraph.tsfunctiongetFilePath63.42228235.5621112817
src/graph/createGraph.tsfunctionfindNode74.54103138.241172015
src/graph/createGraph.tsfunctionremoveSlash75.51213961061410
src/mermaidify.tsfile-13.926412919482.7555113967574
src/mermaidify.tsfunctioncreateDirAndNodesTree31.09919942660.941715224235
src/mermaidify.tsfunctionaddGraph39.4689511457.451094811936
src/mermaidify.tsfunctionmermaidify40.919948106888419023
src/mermaidify.tsfunctionwriteRelations48.353426796.3266247921
src/mermaidify.tsfunctionaddLink53.871018465.1240224817
src/mermaidify.tsfunctionwriteFileLink66.46107140.551391912
src/mermaidify.tsfunctionfileNameToMermaidId66.92106195.0417132512
src/mermaidify.tsfunctionwriteFileNodesWithSubgraph68.37106121.011181712
src/mermaidify.tsfunctionfileNameToMermaidName76.7610366.6176117
src/metrics/calculateCodeMetrics.tsfile-17.5918162687555.9344716552060
src/metrics/calculateCodeMetrics.tsfunctioncalculateCodeMetrics35.1564732294.71658616931
src/metrics/calculateCodeMetrics.tsfunctionconvert37.1320731426.481204311623
src/metrics/calculateCodeMetrics.tsfunctionhoge45.682240535.2937176521
src/metrics/calculateCodeMetrics.tsfunctiongetFilePath63.42228235.5621112817
src/metrics/calculateCodeMetrics.tsfunctiongetMarker64.24311089.9298139
src/metrics/calculateCodeMetrics.tsfunctiongetFileMIStatus69.78325122.981191712
src/metrics/calculateCodeMetrics.tsfunction
Read more

v0.17.3

26 Dec 16:58
3262457
Compare
Choose a tag to compare

0.17.3 (2024-12-26)

Bug Fixes

  • deps: update all minor and patch dependencies (#221) (3262457)

v0.17.2

19 Dec 16:05
b228c95
Compare
Choose a tag to compare

0.17.2 (2024-12-19)

Bug Fixes

  • deps: update all minor and patch dependencies (#219) (b228c95)

v0.17.1

12 Dec 17:17
4ead6b8
Compare
Choose a tag to compare

0.17.1 (2024-12-12)

Bug Fixes

  • deps: update all minor and patch dependencies (#217) (4ead6b8)

v0.17.0

29 Nov 12:25
d96c07e
Compare
Choose a tag to compare

🌟 Experimental support Vue [0.17.0](v0.16.2...v0.17.0) (2024-11-29)

with ChatGPT

新機能

新規コントリビューター

  • @roottool が初参加!素晴らしい貢献に感謝ね。 ([PR #204](#204))
    新しい風が吹いて、ますます進化が止まらないわ。

完全な変更履歴はこちら: [Changelog](https://github.com/ysk8hori/typescript-graph/compare/v0.16.2...v[0.17.0](https://github.com/ysk8hori/typescript-graph/compare/v0.16.2...v0.17.0))


🌟 0.17.0 (2024-11-29)

Features

  • creategraph: Now you can analyze Vue files like a pro! ([d39e54f](d39e54f))
    For all you Vue devs out there, we’ve got your back. You’re welcome.

  • option: Toggle Vue file analysis with the vue flag ([5e8c09a](5e8c09a))
    Closed Issue [#207](#207). Customization at your fingertips—flex your workflow as you see fit.

New Contributors

  • @roottool made their debut! Thanks for your awesome contribution. ([PR #204](#204))
    Fresh talent, driving innovation like never before.

Check out the full changelog here: [Changelog](v0.16.2...v0.17.0)


What's Changed

New Contributors

Full Changelog: v0.16.2...v0.17.0

v0.16.2

14 Nov 18:05
acecd40
Compare
Choose a tag to compare

0.16.2 (2024-11-14)

Bug Fixes

  • deps: update all minore and patch dependencies (#203) (acecd40)

v0.16.1

13 Nov 12:04
6d1f733
Compare
Choose a tag to compare

0.16.1 (2024-11-13)

Bug Fixes

  • abstraction: abstraction でファイルを指定した際の出力でファイルがdirの見た目になるバグを修正 (b51e0f3)

v0.16.0

08 Nov 15:00
48da3fe
Compare
Choose a tag to compare

0.16.0 (2024-11-08)

Features

  • option: tsconfig を相対パスで指定可能とする (21379fc)