Created attachment 146550 [details] code analysis tab It would be really cool to be able to use cargo clippy for code analysis in Kate when editing rust projects. SOFTWARE/OS VERSIONS Linux/KDE Plasma: openSUSE TW (available in About System) KDE Plasma Version: 5.25.0 KDE Frameworks Version: 5.90.0 Qt Version: 5.12.2
Please consider adding some more details about your request, for instance, what is a clippy? How does one use it? How can it integrate with Kate? Etc. It makes it easier to understand what is wanted and thus easier for someone who wants to implement this feature.
Yep, sorry. Clippy is a formatting tool for rust https://github.com/rust-lang/rust-clippy. It gives "advanced" formatting advices to the user. It can be used by installing it (cargo install cargo-clippy) and then running cargo clippy at the root of a rust crate. This fits perfectly in the scope of "Code analysis" tab of Kate.
Sounds like some good fit, yes. Are you interested in contributing a patch for this? This is handled in kate.git/addons/project/tools
(In reply to Christoph Cullmann from comment #3) > Sounds like some good fit, yes. > > Are you interested in contributing a patch for this? > > This is handled in kate.git/addons/project/tools Sure ! I'd be glad to try and do this
(In reply to Christoph Cullmann from comment #3) > Sounds like some good fit, yes. > > Are you interested in contributing a patch for this? > > This is handled in kate.git/addons/project/tools I am not seeing the changes I am making in the code being reflected in the binary or even in the compiler, I think I may be doing something wrong. I am running the cmake "kate-bin" profile, is this normal?
I assume you cloned the repo and did mkdir build cd build cmake .. make ./bin/kate # run if so, the kate that gets run loads system plugins and not the ones you built yourself. To do the latter, run kate like: QT_PLUGIN_PATHS=./bin ./bin/kate -n . Also make sure, you build the whole project and not just the target "kate-bin". Alternatively, you can use kdesrcbuild but that takes a lot of time.
QT_PLUGIN_PATHS => QT_PLUGIN_PATH typo^
(In reply to Waqar Ahmed from comment #6) > I assume you cloned the repo and did > > mkdir build > cd build > cmake .. > make > ./bin/kate # run > > if so, the kate that gets run loads system plugins and not the ones you > built yourself. To do the latter, run kate like: > > QT_PLUGIN_PATHS=./bin ./bin/kate -n . > > Also make sure, you build the whole project and not just the target > "kate-bin". > > Alternatively, you can use kdesrcbuild but that takes a lot of time. I did exactly this process : mkdir build cd build cmake .. make QT_PLUGIN_PATH=./bin ./bin/kate (while being in the build folder) But the analysis tools don't seem to get compiled
How do I make sure I am building those as well? I am very new to CMake
Running make "katebuildplugin" seems to tell me there is nothing to be built...
Maybe you forgot to add the new tool's implementation files to `addons/project/CMakeLists.txt`? Check for other tools files that are in that file and just add yours below them: tools/kateprojectcodeanalysistoolclazycurrent.cpp // already there cargoclippytool.cpp // new file
I have done this part ```rs Index: addons/project/CMakeLists.txt IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/addons/project/CMakeLists.txt b/addons/project/CMakeLists.txt --- a/addons/project/CMakeLists.txt (revision bccf9a58ab1bb6f435eb942b46a2931dd9aedd0d) +++ b/addons/project/CMakeLists.txt (date 1644573992761) @@ -80,6 +80,7 @@ tools/kateprojectcodeanalysisselector.cpp tools/kateprojectcodeanalysistoolclazy.cpp tools/kateprojectcodeanalysistoolclazycurrent.cpp + tools/kateprojectcodeanalysistoolclippy.cpp git/gitdiff.cpp git/gitutils.cpp ```
> Running make "katebuildplugin" seems to tell me there is nothing to be built... That's not right. Either just run "make" or "make kateprojectplugin". Build plugin is different. You can find the plugin name usually by looking at the CMakeLists.txt file. There will be a ling add_library(kateprojectplugin # plugin target name ... )
I would propose to just run always make. If you have once compiled the stuff in kate, only the changed stuff will be recompiled anyways. Did you have success in the mean time to get it to compile?
(In reply to Christoph Cullmann from comment #14) > I would propose to just run always make. > If you have once compiled the stuff in kate, only the changed stuff will be > recompiled anyways. > Did you have success in the mean time to get it to compile? No
Seeing how make compiles different files in addon/, it seems to never go over addon/project entirely, maybe there's a specific option I need to feed to CMake for make to build the analysis tools?
Ah, I guess you don't have the libraries installed and hence the project plugin never builds ;/ I guess we should have a warning in such cases at least so the user can know what happened. You need at least these libraries; Qt5::Concurrent KF5::GuiAddons KF5::I18n KF5::NewStuff KF5::TextEditor package names should be: - libQt5Concurrent-devel - libKF5GuiAddons5 - libKF5I18n5 ... Maybe there is a way to install the build dependencies for a package automatically in TW, not sure.
Right. I have this : ``` * KF5NewStuff (required version >= 5.83.0) Required to build the project addon Required to build the snippets addon ``` And I have the KF5NewStuff at version 5.90.0 Is my version too recent for Kate?
No. after building check if there is a `kateprojectplugin.so` file in the `build/bin/ktexteditor` directory. If it exists, that means project plugin got built successfully and then you can test it by running the command I gave you above.
Well, for some reason, I have KF5NewStuff v5.90.0 on my machine, and cmake still isn't able to detect it. Do I need some kind of *-devel package for this?
yes, devel package
(In reply to Waqar Ahmed from comment #21) > yes, devel package I've been trying to find a libKF5NewStuff5-devel package, or something rather similar to it in the oS TW repos, couldn't find anything. Do you have any insight on what the package name could be?
No, but I would suggest you to join the kde-devel chat on IRC / Matrix / Telegram and ask someone there.
Also, pasting your full cmake output will be more helpful.
Git commit db17711cf58079fb381c1f3a6673259ca588c564 by Waqar Ahmed. Committed on 11/01/2023 at 17:13. Pushed by waqar into branch 'master'. Add Clippy tool M +1 -0 addons/project/CMakeLists.txt M +1 -0 addons/project/kateprojectinfoviewcodeanalysis.cpp A +98 -0 addons/project/tools/clippy.cpp [License: LGPL(v2.0+)] A +41 -0 addons/project/tools/clippy.h [License: LGPL(v2.0+)] M +3 -0 addons/project/tools/codeanalysisselector.cpp https://invent.kde.org/utilities/kate/commit/db17711cf58079fb381c1f3a6673259ca588c564