class Ameba::Formatter::JSONFormatter

Overview

A formatter that produces the result in a json format.

Example:

{
  "metadata": {
    "ameba_version":   "x.x.x",
    "crystal_version": "x.x.x",
  },
  "sources": [
    {
      "issues": [
        {
          "location": {
            "column": 7,
            "line":   17,
          },
          "end_location": {
            "column": 20,
            "line":   17,
          },
          "message":   "Useless assignment to variable `a`",
          "rule_name": "UselessAssign",
          "severity":  "Convention",
        },
        {
          "location": {
            "column": 7,
            "line":   18,
          },
          "end_location": {
            "column": 8,
            "line":   18,
          },
          "message":   "Useless assignment to variable `a`",
          "rule_name": "UselessAssign",
        },
        {
          "location": {
            "column": 7,
            "line":   19,
          },
          "end_location": {
            "column": 9,
            "line":   19,
          },
          "message":   "Useless assignment to variable `a`",
          "rule_name": "UselessAssign",
          "severity":  "Convention",
        },
      ],
      "path": "src/ameba/formatter/json_formatter.cr",
    },
  ],
  "summary": {
    "issues_count":         3,
    "target_sources_count": 1,
  },
}

Defined in:

ameba/formatter/json_formatter.cr

Constructors

Instance Method Summary

Instance methods inherited from class Ameba::Formatter::BaseFormatter

config : Hash(Symbol, Bool | String) config, finished(sources) finished, output : IO::FileDescriptor | IO::Memory output, source_finished(source : Source) source_finished, source_started(source : Source) source_started, started(sources) started

Constructor methods inherited from class Ameba::Formatter::BaseFormatter

new(output : IO = STDOUT) new

Constructor Detail

def self.new(output = STDOUT) #

[View source]

Instance Method Detail

def finished(sources) #
Description copied from class Ameba::Formatter::BaseFormatter

Callback that indicates when inspection is finished. A list of inspected sources is passed as an argument.


[View source]
def source_finished(source : Source) #
Description copied from class Ameba::Formatter::BaseFormatter

Callback that indicates when source inspection is finished. A corresponding source is passed as an argument.


[View source]
def started(sources) #
Description copied from class Ameba::Formatter::BaseFormatter

Callback that indicates when inspecting is started. A list of sources to inspect is passed as an argument.


[View source]