Skip to content

Metric Data Format

Mitchell Miller edited this page Sep 23, 2019 · 5 revisions

Metric data is formatted in json a specific way to be processed by the javascript code in our web UI.

The format data should take looks like this:

{
  path: "/mnt/g/Projects/apple-surp-2019/code-analysis/examples-to-analyze/",
  duplicateInfo: {
    duplicates: [
      [
        {
          filename:
            "/mnt/g/Projects/apple-surp-2019/code-analysis/examples-to-analyze/analyze-me.swift",
          startLine: 13,
          endLine: 84
        },
        {
          filename:
            "/mnt/g/Projects/apple-surp-2019/code-analysis/examples-to-analyze/analyze-us.swift",
          startLine: 13,
          endLine: 84
        }
      ]
    ],
    duplicateRate: 0.6430517711171662,
    uniqueRate: 0.6745562130177515
  },
  files: [
    {
      filename:
        "/mnt/g/Projects/apple-surp-2019/code-analysis/examples-to-analyze/analyze-you.py",
      filetype: "py",
      functions: [
        {
          name: "run",
          longName: "run( )",
          startLine: 18,
          nloc: 6,
          ccn: 1,
          tokens: 32,
          params: 0,
          length: 6,
          fanIn: 0,
          fanOut: 4,
          generalFanOut: 15,
          maxNestingDepth: 0,
          maxNestedStructures: 0
        },
        {
          name: "checkPathExists",
          longName: "checkPathExists( )",
          startLine: 27,
          nloc: 11,
          ccn: 4,
          tokens: 85,
          params: 0,
          length: 11,
          fanIn: 1,
          fanOut: 0,
          generalFanOut: 24,
          maxNestingDepth: 3,
          maxNestedStructures: 3
        },
        ...
      ]
    },
    {
      filename:
        "/mnt/g/Projects/apple-surp-2019/code-analysis/examples-to-analyze/analyze-me.swift",
      filetype: "swift",
      functions: [
        {
          name: "viewDidLoad",
          longName: "viewDidLoad",
          startLine: 24,
          nloc: 22,
          ccn: 2,
          tokens: 117,
          params: 0,
          length: 25,
          fanIn: 1,
          fanOut: 1,
          generalFanOut: 8,
          maxNestingDepth: 1,
          maxNestedStructures: 13
        },
        {
          name: "deinit",
          longName: "deinit",
          startLine: 50,
          nloc: 3,
          ccn: 1,
          tokens: 11,
          params: 0,
          length: 3,
          fanIn: 0,
          fanOut: 0,
          generalFanOut: 0,
          maxNestingDepth: 0,
          maxNestedStructures: 0
        },
        ...
      ]
    },
    {
      filename:
        "/mnt/g/Projects/apple-surp-2019/code-analysis/examples-to-analyze/analyze-us.swift",
      filetype: "swift",
      functions: [
        {
          name: "viewDidLoad",
          longName: "viewDidLoad",
          startLine: 24,
          nloc: 22,
          ccn: 2,
          tokens: 117,
          params: 0,
          length: 25,
          fanIn: 1,
          fanOut: 1,
          generalFanOut: 8,
          maxNestingDepth: 1,
          maxNestedStructures: 1
        },
        {
          name: "deinit",
          longName: "deinit",
          startLine: 50,
          nloc: 3,
          ccn: 1,
          tokens: 11,
          params: 0,
          length: 3,
          fanIn: 0,
          fanOut: 0,
          generalFanOut: 0,
          maxNestingDepth: 0,
          maxNestedStructures: 0
        },
        {
          name: "adjustInsetForKeyboard",
          longName:
            "adjustInsetForKeyboard isShow : Bool , notification : Notification",
          startLine: 54,
          nloc: 9,
          ccn: 2,
          tokens: 69,
          params: 2,
          length: 9,
          fanIn: 2,
          fanOut: 0,
          generalFanOut: 2,
          maxNestingDepth: 1,
          maxNestedStructures: 1
        },
       ...
      ]
    }
  ]
};

See the full json here

Clone this wiki locally