Browse Source

Added clang-tidy preference items

pipelines/235045657
eidheim 6 years ago
parent
commit
a0d911f176
  1. 2
      CMakeLists.txt
  2. 7
      README.md
  3. 14
      src/compile_commands.cc
  4. 2
      src/config.cc
  5. 3
      src/config.h
  6. 4
      src/files.h

2
CMakeLists.txt

@ -1,7 +1,7 @@
cmake_minimum_required (VERSION 2.8.8)
project(juci)
set(JUCI_VERSION "1.6.0.1")
set(JUCI_VERSION "1.6.0.2")
set(CPACK_PACKAGE_NAME "jucipp")
set(CPACK_PACKAGE_CONTACT "Ole Christian Eidheim <eidheim@gmail.com>")

7
README.md

@ -13,12 +13,7 @@ towards libclang with speed, stability, and ease of use in mind.
* Syntax highlighting for more than 100 different file types
* C++ warnings and errors on the fly
* C++ Fix-its
* Integrated Clang-Tidy checks possible through clang plugins, for instance (recreating existing build is needed):
```sh
CXX=clang++ CXXFLAGS="-Xclang -add-plugin -Xclang clang-tidy -Xclang -plugin-arg-clang-tidy -Xclang -checks='-*, clang-analyzer-core.*'" juci [project-path]
```
* Integrated Clang-Tidy checks can be enabled in preferences
* Debug integration, both local and remote, through lldb
* Supports the following build systems:
* CMake

14
src/compile_commands.cc

@ -1,5 +1,6 @@
#include "compile_commands.h"
#include "clangmm.h"
#include "config.h"
#include "terminal.h"
#include <algorithm>
#include <boost/property_tree/json_parser.hpp>
@ -238,6 +239,19 @@ std::vector<std::string> CompileCommands::get_arguments(const boost::filesystem:
arguments.emplace_back(build_path.string());
}
if(Config::get().source.enable_clang_tidy) {
arguments.emplace_back("-Xclang");
arguments.emplace_back("-add-plugin");
arguments.emplace_back("-Xclang");
arguments.emplace_back("clang-tidy");
if(!Config::get().source.clang_tidy_checks.empty()) {
arguments.emplace_back("-Xclang");
arguments.emplace_back("-plugin-arg-clang-tidy");
arguments.emplace_back("-Xclang");
arguments.emplace_back("-checks=" + Config::get().source.clang_tidy_checks);
}
}
return arguments;
}

2
src/config.cc

@ -172,6 +172,8 @@ void Config::read(const boost::property_tree::ptree &cfg) {
source.search_for_selection = source_json.get<bool>("search_for_selection");
source.clang_format_style = source_json.get<std::string>("clang_format_style");
source.clang_usages_threads = static_cast<unsigned>(source_json.get<int>("clang_usages_threads"));
source.enable_clang_tidy = source_json.get<bool>("enable_clang_tidy");
source.clang_tidy_checks = source_json.get<std::string>("clang_tidy_checks");
source.debug_place_cursor_at_stop = source_json.get<bool>("debug_place_cursor_at_stop");
auto pt_doc_search = cfg.get_child("documentation_searches");
for(auto &pt_doc_search_lang : pt_doc_search) {

3
src/config.h

@ -95,6 +95,9 @@ public:
std::string clang_format_style;
unsigned clang_usages_threads;
bool enable_clang_tidy;
std::string clang_tidy_checks;
bool debug_place_cursor_at_stop;
std::unordered_map<std::string, DocumentationSearch> documentation_searches;

4
src/files.h

@ -67,6 +67,10 @@ const std::string default_config_file = R"RAW({
"clang_format_style": "ColumnLimit: 0, NamespaceIndentation: All",
"clang_usages_threads_comment": "The number of threads used in finding usages in unparsed files. -1 corresponds to the number of cores available, and 0 disables the search",
"clang_usages_threads": -1,
"enable_clang_tidy_comment": "Enable clang-tidy in new C/C++ buffers",
"enable_clang_tidy": false,
"clang_tidy_checks_comment": "In new C/C++ buffers, these checks are appended to the value of 'Checks' in the .clang-tidy file, if any",
"clang_tidy_checks": "",
"debug_place_cursor_at_stop": false
},
"terminal": {

Loading…
Cancel
Save