2011-02-24 17:59:49 -08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
2014-05-11 13:42:56 -07:00
|
|
|
* Stops other linters from running on code marked with a nolint annotation.
|
2011-02-24 17:59:49 -08:00
|
|
|
*/
|
2012-01-31 12:07:05 -08:00
|
|
|
final class ArcanistNoLintLinter extends ArcanistLinter {
|
2011-02-24 17:59:49 -08:00
|
|
|
|
2014-05-11 13:42:56 -07:00
|
|
|
public function getInfoName() {
|
|
|
|
return pht('Lint Disabler');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getInfoDescription() {
|
|
|
|
return pht(
|
|
|
|
'Allows you to disable all lint messages for a file by putting "%s" in '.
|
|
|
|
'the file body.',
|
|
|
|
'@'.'nolint');
|
|
|
|
}
|
|
|
|
|
2011-02-24 17:59:49 -08:00
|
|
|
public function getLinterName() {
|
|
|
|
return 'NOLINT';
|
|
|
|
}
|
|
|
|
|
Ready more linters and linter functions for .arclint
Summary:
Ref T3186. Ref T2039. Continues work on readying linters for `.arclint`.
- **Ruby**: Make this an ExternalLinter.
- **Priority**: Currently, linters have an implicit "correct" order (notably, the "NoLint" linter needs to run before other linters). Make this explicit by introducing `getLinterPriority()`.
- **Binaries**: Currently, linters manually reject binary files. Instead, reject binary files by default (linters can override this if they do want to lint binary files).
- **Deleted Files**: Currently, linters manually reject deleted files (usually in engines). Instead, reject deleted files by default (linters can override this).
- **Severity**: Move this `.arclint` config option up to top level.
- **willLintPaths()**: This method is abstract, but almost all linters provide a trivial implementation. Provide a trivial implementation in the base class.
- **getLintSeverityMap()/getLintNameMap()**: A bunch of linters have empty implementations; these are redundant. Remove them.
- **Spelling**: clean up some dead / test-only / unconventional code.
- **`.arclint`**: Allow the filename, generated, nolint, text, spelling and ruby linters to be configured via `.arclint`.
Test Plan:
https://github.com/epriestley/arclint-examples/commit/458beca3d65b64d52ed612904ae66eb837118b94
Ran unit tests.
Reviewers: btrahan
Reviewed By: btrahan
CC: Firehed, aran
Maniphest Tasks: T2039, T3186
Differential Revision: https://secure.phabricator.com/D6805
2013-08-26 05:37:10 -07:00
|
|
|
public function getLinterPriority() {
|
|
|
|
return 0.25;
|
2011-02-24 17:59:49 -08:00
|
|
|
}
|
|
|
|
|
Ready more linters and linter functions for .arclint
Summary:
Ref T3186. Ref T2039. Continues work on readying linters for `.arclint`.
- **Ruby**: Make this an ExternalLinter.
- **Priority**: Currently, linters have an implicit "correct" order (notably, the "NoLint" linter needs to run before other linters). Make this explicit by introducing `getLinterPriority()`.
- **Binaries**: Currently, linters manually reject binary files. Instead, reject binary files by default (linters can override this if they do want to lint binary files).
- **Deleted Files**: Currently, linters manually reject deleted files (usually in engines). Instead, reject deleted files by default (linters can override this).
- **Severity**: Move this `.arclint` config option up to top level.
- **willLintPaths()**: This method is abstract, but almost all linters provide a trivial implementation. Provide a trivial implementation in the base class.
- **getLintSeverityMap()/getLintNameMap()**: A bunch of linters have empty implementations; these are redundant. Remove them.
- **Spelling**: clean up some dead / test-only / unconventional code.
- **`.arclint`**: Allow the filename, generated, nolint, text, spelling and ruby linters to be configured via `.arclint`.
Test Plan:
https://github.com/epriestley/arclint-examples/commit/458beca3d65b64d52ed612904ae66eb837118b94
Ran unit tests.
Reviewers: btrahan
Reviewed By: btrahan
CC: Firehed, aran
Maniphest Tasks: T2039, T3186
Differential Revision: https://secure.phabricator.com/D6805
2013-08-26 05:37:10 -07:00
|
|
|
public function getLinterConfigurationName() {
|
|
|
|
return 'nolint';
|
2011-02-24 17:59:49 -08:00
|
|
|
}
|
|
|
|
|
2014-05-11 19:28:26 -07:00
|
|
|
protected function canCustomizeLintSeverities() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-02-24 17:59:49 -08:00
|
|
|
public function lintPath($path) {
|
|
|
|
$data = $this->getData($path);
|
|
|
|
if (preg_match('/@'.'nolint/', $data)) {
|
|
|
|
$this->stopAllLinters();
|
|
|
|
}
|
|
|
|
}
|
Ready more linters and linter functions for .arclint
Summary:
Ref T3186. Ref T2039. Continues work on readying linters for `.arclint`.
- **Ruby**: Make this an ExternalLinter.
- **Priority**: Currently, linters have an implicit "correct" order (notably, the "NoLint" linter needs to run before other linters). Make this explicit by introducing `getLinterPriority()`.
- **Binaries**: Currently, linters manually reject binary files. Instead, reject binary files by default (linters can override this if they do want to lint binary files).
- **Deleted Files**: Currently, linters manually reject deleted files (usually in engines). Instead, reject deleted files by default (linters can override this).
- **Severity**: Move this `.arclint` config option up to top level.
- **willLintPaths()**: This method is abstract, but almost all linters provide a trivial implementation. Provide a trivial implementation in the base class.
- **getLintSeverityMap()/getLintNameMap()**: A bunch of linters have empty implementations; these are redundant. Remove them.
- **Spelling**: clean up some dead / test-only / unconventional code.
- **`.arclint`**: Allow the filename, generated, nolint, text, spelling and ruby linters to be configured via `.arclint`.
Test Plan:
https://github.com/epriestley/arclint-examples/commit/458beca3d65b64d52ed612904ae66eb837118b94
Ran unit tests.
Reviewers: btrahan
Reviewed By: btrahan
CC: Firehed, aran
Maniphest Tasks: T2039, T3186
Differential Revision: https://secure.phabricator.com/D6805
2013-08-26 05:37:10 -07:00
|
|
|
|
2011-02-24 17:59:49 -08:00
|
|
|
}
|