Fix linters

Summary:
Two fixes:
1. if cpplint is not present on the system, don't return a confusing error in the linter
2. Add include_alpha, which means our includes should be sorted lexicographically

Test Plan: Tried unsorting our includes, lint complained

Reviewers: rven, ljin, yhchiang, sdong

Reviewed By: sdong

Subscribers: dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D28845
main
Igor Canadi 10 years ago
parent 9a632b4a92
commit 37d73d597e
  1. 6
      db/column_family.cc
  2. 5
      linters/cpp_linter/FbcodeCppLinter.php
  3. 2
      linters/cpp_linter/cpplint.py

@ -19,12 +19,12 @@
#include <algorithm> #include <algorithm>
#include <limits> #include <limits>
#include "db/compaction_picker.h"
#include "db/db_impl.h" #include "db/db_impl.h"
#include "db/job_context.h"
#include "db/version_set.h"
#include "db/internal_stats.h" #include "db/internal_stats.h"
#include "db/compaction_picker.h" #include "db/job_context.h"
#include "db/table_properties_collector.h" #include "db/table_properties_collector.h"
#include "db/version_set.h"
#include "db/write_controller.h" #include "db/write_controller.h"
#include "util/autovector.h" #include "util/autovector.h"
#include "util/hash_skiplist_rep.h" #include "util/hash_skiplist_rep.h"

@ -31,7 +31,7 @@ class FbcodeCppLinter extends ArcanistLinter {
$this->getEngine()->getFilePathOnDisk($p)); $this->getEngine()->getFilePathOnDisk($p));
} else { } else {
$futures[$p] = new ExecFuture("%s %s 2>&1", $futures[$p] = new ExecFuture("%s %s 2>&1",
self::CPPLINT, $this->getEngine()->getFilePathOnDisk($p)); $CPP_LINT, $this->getEngine()->getFilePathOnDisk($p));
} }
} }
@ -68,6 +68,9 @@ class FbcodeCppLinter extends ArcanistLinter {
} }
private function getCppLintOutput($path) { private function getCppLintOutput($path) {
if (!array_key_exists($path, $this->rawLintOutput)) {
return array();
}
list($output) = $this->rawLintOutput[$path]; list($output) = $this->rawLintOutput[$path];
$msgs = array(); $msgs = array();

@ -213,7 +213,7 @@ _ERROR_CATEGORIES = [
# flag. By default all errors are on, so only add here categories that should be # flag. By default all errors are on, so only add here categories that should be
# off by default (i.e., categories that must be enabled by the --filter= flags). # off by default (i.e., categories that must be enabled by the --filter= flags).
# All entries here should start with a '-' or '+', as in the --filter= flag. # All entries here should start with a '-' or '+', as in the --filter= flag.
_DEFAULT_FILTERS = ['-build/include_alpha'] _DEFAULT_FILTERS = []
# We used to check for high-bit characters, but after much discussion we # We used to check for high-bit characters, but after much discussion we
# decided those were OK, as long as they were in UTF-8 and didn't represent # decided those were OK, as long as they were in UTF-8 and didn't represent

Loading…
Cancel
Save