GitlabCiFormatter
in package
implements
FormatterInterface
Formatter for GitLab CI Code Quality report (Code Climate JSON format).
Table of Contents
Interfaces
Properties
- $fingerprints : array<string|int, string>
Methods
- endLinting() : string
- End linting a source file.
- getName() : non-empty-string
- Returns the name used to select this formatter (e.g., 'plain', 'json').
- printFatalError() : string
- Output a fatal error message.
- printLintError() : string
- Output a parsing or runtime error message.
- startLinting() : string
- Start linting a source file.
- generateFingerprint() : string
- printCommaIfNeeded() : string
- printIssue() : string
Properties
$fingerprints
private
array<string|int, string>
$fingerprints
= []
Used to track fingerprints to avoid duplicates. This is not strictly necessary for GitLab CI, but helps ensure unique issues.
Methods
endLinting()
End linting a source file.
public
endLinting(string $source, bool $isValid) : string
Parameters
- $source : string
-
The source being linted (e.g., "CSS file "..."").
- $isValid : bool
-
Whether the source is valid CSS.
Return values
stringgetName()
Returns the name used to select this formatter (e.g., 'plain', 'json').
public
getName() : non-empty-string
Return values
non-empty-stringprintFatalError()
Output a fatal error message.
public
printFatalError(string|null $source, mixed $error) : string
Parameters
- $source : string|null
-
The source being linted (e.g., "CSS file "..."").
- $error : mixed
-
The exception or error that occurred, which may include a message and stack trace.
Return values
stringprintLintError()
Output a parsing or runtime error message.
public
printLintError(string $source, LintError $lintError) : string
Parameters
- $source : string
-
The source being linted (e.g., "CSS file "..."").
- $lintError : LintError
Return values
stringstartLinting()
Start linting a source file.
public
startLinting(string $source) : string
Parameters
- $source : string
-
The source being linted (e.g., "CSS file "..."").
Return values
stringgenerateFingerprint()
private
generateFingerprint(string $path, IssueSeverity $severity, string $checkName, string $message, Position $begin[, Position|null $end = null ]) : string
Parameters
- $path : string
- $severity : IssueSeverity
- $checkName : string
- $message : string
- $begin : Position
- $end : Position|null = null
Return values
stringprintCommaIfNeeded()
private
printCommaIfNeeded() : string
Return values
stringprintIssue()
private
printIssue(string $path, IssueSeverity $severity, string $checkName, string $message, Position $begin[, Position|null $end = null ]) : string
Parameters
- $path : string
- $severity : IssueSeverity
- $checkName : string
- $message : string
- $begin : Position
- $end : Position|null = null