~ubuntu-branches/ubuntu/vivid/phabricator/vivid-proposed

« back to all changes in this revision

Viewing changes to arcanist/src/lint/linter/ArcanistNoLintLinter.php

  • Committer: Package Import Robot
  • Author(s): Richard Sellam
  • Date: 2014-10-23 20:49:26 UTC
  • mfrom: (0.2.1) (0.1.1)
  • Revision ID: package-import@ubuntu.com-20141023204926-vq80u1op4df44azb
Tags: 0~git20141023-1
Initial release (closes: #703046)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
 
 
3
/**
 
4
 * Stops other linters from running on code marked with a nolint annotation.
 
5
 */
 
6
final class ArcanistNoLintLinter extends ArcanistLinter {
 
7
 
 
8
  public function getInfoName() {
 
9
    return pht('Lint Disabler');
 
10
  }
 
11
 
 
12
  public function getInfoDescription() {
 
13
    return pht(
 
14
      'Allows you to disable all lint messages for a file by putting "%s" in '.
 
15
      'the file body.',
 
16
      '@'.'nolint');
 
17
  }
 
18
 
 
19
  public function getLinterName() {
 
20
    return 'NOLINT';
 
21
  }
 
22
 
 
23
  public function getLinterPriority() {
 
24
    return 0.25;
 
25
  }
 
26
 
 
27
  public function getLinterConfigurationName() {
 
28
    return 'nolint';
 
29
  }
 
30
 
 
31
  protected function canCustomizeLintSeverities() {
 
32
    return false;
 
33
  }
 
34
 
 
35
  public function lintPath($path) {
 
36
    $data = $this->getData($path);
 
37
    if (preg_match('/@'.'nolint/', $data)) {
 
38
      $this->stopAllLinters();
 
39
    }
 
40
  }
 
41
 
 
42
}