-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clazy #32
Comments
This looks really cool! But I might need some help implementing it; the docs seem to assume some general tool-chain familiarity that might be a blocker for me. Please let me know if you'd like help implementing this as a Restyler yourself. |
Yes sure, what would you like help with? |
I was more thinking you (or any contributor who knew this tool well) could take the lead, and I would help them :) https://github.com/restyled-io/restyled.io/wiki/Adding-a-Restyler |
Reading up on this a big,
So, this will require an extra script to:
|
I've started on this (will push a PR soon), but can't get it working. It seems like
I'm not sure what would be required to get it working. |
Hey thanks for taking up work on this. Clazy requires a file called compile_commands.json which are instructions for the compiler on how to compile a certain file. This file can be generated by a bunch of build systems, including cmake if you pass it the I'm not familiar with how restylers works (but looking forward to using it with clazy in) - you might need to get the user to provide some configuration to generate the compile commands file? |
Under normal usage would that And do you think this warning is the reason it can't find |
It's an autogenerated file and it's typically not checked in because the paths to the libraries would be different on every developers machine. Here's an example of how I use another clang-based tool to first generate the file and then run the tool when the file is present: https://github.com/Mudlet/Mudlet/blob/development/.github/workflows/clangtidy-diff-analysis.yml#L107-L136
Yeah, that would be it. |
OK, a little further:
I added Is this a file I can expect to be present in a checked-out clone? If so, how do I fake it for the test-harness. For more context, the test harness is just running a single #include <QString>
QString str = "hello";
str.mid(5).toInt(ok); |
Try this cpp file: #include <iostream>
#include <QString>
int main() {
QString str = "hello";
QString result = str.mid(5);
std::cout << "Original string: " << str.toStdString() << std::endl;
std::cout << "Substring from index 5 onwards: " << result.toStdString() << std::endl;
return 0;
} With this CMakeLists.txt file present in the same folder: cmake_minimum_required(VERSION 3.16)
project(helloworld VERSION 1.0.0 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_AUTOMOC ON)
find_package(Qt6 REQUIRED COMPONENTS Core)
add_executable(helloworld
main.cpp
)
target_link_libraries(helloworld PRIVATE Qt6::Core) and then run |
OK, I think I'm in a good place. The following seems to function, without error: cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON .
clazy-standalone --export-fixes="$tmp"/fixes.yaml --checks=level0 <input>
clang-apply-replacements "$tmp" The problem now is that it seems to do nothing. 🤔 |
https://github.com/KDE/clazy
Best practices checker for Qt (C++) with fixits.
The text was updated successfully, but these errors were encountered: