設定
設定ファイル
Section titled “設定ファイル”similarity-goは、YAML、TOML、JSON形式の設定ファイルをサポートしています。ツールは以下の順序で設定ファイルを自動的に検索します:
.similarity-go.yaml.similarity-go.yml.similarity-go.toml.similarity-go.jsonsimilarity-go.yamlsimilarity-go.ymlsimilarity-go.tomlsimilarity-go.json
# 分析設定analysis: threshold: 0.8 # 類似性しきい値 (0.0 - 1.0) min_lines: 5 # 分析対象とする最小行数 max_file_size: "10MB" # 分析する最大ファイルサイズ
# 出力設定output: format: "detailed" # 出力形式: detailed, json, yaml, csv file: "" # 出力ファイル (空 = stdout) colors: true # カラー出力を有効化 quiet: false # 非必須出力を抑制
# ファイルパターンpatterns: include: - "**/*.go" exclude: - "**/*_test.go" - "vendor/**" - "*.pb.go" - ".git/**"
# パフォーマンス設定performance: parallel: 0 # 並列ワーカー数 (0 = 自動) cache_enabled: true # 結果キャッシュを有効化 cache_dir: "" # キャッシュディレクトリ (空 = 自動) memory_limit: "1GB" # 最大メモリ使用量
# アルゴリズム設定algorithms: ast_comparison: enabled: true weight: 0.7
token_comparison: enabled: true weight: 0.2
structure_comparison: enabled: true weight: 0.1
# レポート設定reporting: group_by: "file" # 結果をグループ化: file, function, similarity sort_by: "similarity" # ソート基準: similarity, file, function show_context: true # 出力にコードコンテキストを表示 context_lines: 3 # 表示するコンテキスト行数設定オプション
Section titled “設定オプション”| オプション | 型 | デフォルト | 説明 |
|---|---|---|---|
threshold | float | 0.8 | 類似性しきい値 (0.0-1.0)。この値を超える類似性を持つ関数が報告されます。 |
min_lines | int | 5 | 関数が分析されるための最小行数。 |
max_file_size | string | "10MB" | 分析する最大ファイルサイズ。KB、MB、GBサフィックスをサポート。 |
| オプション | 型 | デフォルト | 説明 |
|---|---|---|---|
format | string | "detailed" | 出力形式: detailed、json、yaml、csv |
file | string | "" | 出力ファイルパス。空の場合はstdout。 |
colors | bool | true | ターミナルでのカラー出力を有効化。 |
quiet | bool | false | 非必須出力を抑制。 |
パターン設定
Section titled “パターン設定”| オプション | 型 | デフォルト | 説明 |
|---|---|---|---|
include | []string | ["**/*.go"] | 分析に含めるファイルパターン。 |
exclude | []string | [] | 分析から除外するファイルパターン。 |
一般的な除外パターン:
**/*_test.go- テストファイルvendor/**- Vendorの依存関係*.pb.go- Protocol bufferで生成されたファイル.git/**- Gitディレクトリ**/.*- 隠しファイルとディレクトリ