Changeset View
Changeset View
Standalone View
Standalone View
src/lint/linter/ArcanistLinter.php
| Show All 22 Lines | abstract class ArcanistLinter extends Phobject { | ||||
| protected $messages = array(); | protected $messages = array(); | ||||
| protected $stopAllLinters = false; | protected $stopAllLinters = false; | ||||
| private $customSeverityMap = array(); | private $customSeverityMap = array(); | ||||
| private $customSeverityRules = array(); | private $customSeverityRules = array(); | ||||
| /* -( Human Readable Information )---------------------------------------- */ | /* -( Human Readable Information )----------------------------------------- */ | ||||
| /** | /** | ||||
| * Return an optional informative URI where humans can learn more about this | * Return an optional informative URI where humans can learn more about this | ||||
| * linter. | * linter. | ||||
| * | * | ||||
| * For most linters, this should return a link to the project home page. This | * For most linters, this should return a link to the project home page. This | ||||
| * is shown on `arc linters`. | * is shown on `arc linters`. | ||||
| ▲ Show 20 Lines • Show All 345 Lines • ▼ Show 20 Lines | /* -( Executing Linters )-------------------------------------------------- */ | ||||
| final public function getLintMessages() { | final public function getLintMessages() { | ||||
| return $this->messages; | return $this->messages; | ||||
| } | } | ||||
| final public function raiseLintAtLine( | final public function raiseLintAtLine( | ||||
| $line, | $line, | ||||
| $char, | $char, | ||||
| $code, | $code, | ||||
| $desc, | $description, | ||||
| $original = null, | $original = null, | ||||
| $replacement = null) { | $replacement = null) { | ||||
| $message = id(new ArcanistLintMessage()) | $message = id(new ArcanistLintMessage()) | ||||
| ->setPath($this->getActivePath()) | ->setPath($this->getActivePath()) | ||||
| ->setLine($line) | ->setLine($line) | ||||
| ->setChar($char) | ->setChar($char) | ||||
| ->setCode($this->getLintMessageFullCode($code)) | ->setCode($this->getLintMessageFullCode($code)) | ||||
| ->setSeverity($this->getLintMessageSeverity($code)) | ->setSeverity($this->getLintMessageSeverity($code)) | ||||
| ->setName($this->getLintMessageName($code)) | ->setName($this->getLintMessageName($code)) | ||||
| ->setDescription($desc) | ->setDescription($description) | ||||
| ->setOriginalText($original) | ->setOriginalText($original) | ||||
| ->setReplacementText($replacement); | ->setReplacementText($replacement); | ||||
| return $this->addLintMessage($message); | return $this->addLintMessage($message); | ||||
| } | } | ||||
| final public function raiseLintAtPath($code, $desc) { | final public function raiseLintAtPath($code, $desc) { | ||||
| return $this->raiseLintAtLine(null, null, $code, $desc, null, null); | return $this->raiseLintAtLine(null, null, $code, $desc, null, null); | ||||
| } | } | ||||
| final public function raiseLintAtOffset( | final public function raiseLintAtOffset( | ||||
| $offset, | $offset, | ||||
| $code, | $code, | ||||
| $desc, | $description, | ||||
| $original = null, | $original = null, | ||||
| $replacement = null) { | $replacement = null) { | ||||
| $path = $this->getActivePath(); | $path = $this->getActivePath(); | ||||
| $engine = $this->getEngine(); | $engine = $this->getEngine(); | ||||
| if ($offset === null) { | if ($offset === null) { | ||||
| $line = null; | $line = null; | ||||
| $char = null; | $char = null; | ||||
| } else { | } else { | ||||
| list($line, $char) = $engine->getLineAndCharFromOffset($path, $offset); | list($line, $char) = $engine->getLineAndCharFromOffset($path, $offset); | ||||
| } | } | ||||
| return $this->raiseLintAtLine( | return $this->raiseLintAtLine( | ||||
| $line + 1, | $line + 1, | ||||
| $char + 1, | $char + 1, | ||||
| $code, | $code, | ||||
| $desc, | $description, | ||||
| $original, | $original, | ||||
| $replacement); | $replacement); | ||||
| } | } | ||||
| public function canRun() { | public function canRun() { | ||||
| return true; | return true; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 171 Lines • Show Last 20 Lines | |||||