First diff for kdev-clang-tidy
ClosedPublic

Authored by coliveira on Sep 22 2016, 11:56 PM.

Details

Summary

Hi guys, let's get it started! think you guys know better than me who should be looking into this. Any suggestions are welcome.

Diff Detail

Repository
R218 KDev Clang-Tidy Support
Lint
Lint Skipped
Unit
Unit Tests Skipped
coliveira updated this revision to Diff 6885.Sep 22 2016, 11:56 PM
coliveira retitled this revision from to First diff for kdev-clang-tidy.
coliveira updated this object.
coliveira edited the test plan for this revision. (Show Details)
coliveira added reviewers: mwolff, kfunk, antonanikin, apol.
coliveira set the repository for this revision to R218 KDev Clang-Tidy Support.
Restricted Application added a subscriber: kdevelop-devel. · View Herald TranscriptSep 22 2016, 11:56 PM
kfunk edited edge metadata.Sep 30 2016, 2:42 PM

This looks really nice for a start.

I've just had a very brief first look.

General remarks:

  • Use const& where useful (e.g. for setFoo(QString foo -> setFoo(const QString& foo))
  • I'd camel case the term 'clangtidy' everywhere in source code. That means Clangtidy -> ClangTidy`, or clangtidy -> clangTidy, etc.
cmake/ClangFormatAll.cmake
13

Does that need to be an error?

src/config/perprojectconfigpage.h
64

const&

65

I'm not too fond of this API (QStringList*). Maybe it makes more sense to use a property for the receptor list and communicate changes via signal/slots?

src/plugin/job.cpp
151

Handling those QProcess errors should probably be moved to the KDevelop::OutputExecuteJob class in kdevplatform?

tests/test_clangtidyparser.cpp
53

Style: Use camel-case style var names here

antonanikin edited edge metadata.Oct 1 2016, 3:52 PM

Looks good, thanks.

I also had a very brief first look, and my remarks are:

  1. Your TODO about removing hard-coded CLANG_TIDY_PATH - good idea, do it.
  1. Check code reworked from kdev-cppcheck for unused parts. My main remark - confusing comments, which seems to be an incorrect for your app (see job.cpp for example).
  1. Per-project configuration code looks a bit complicated and redundant. I think it will be good to reimplement per-project configuration with using standard KConfigSceleton approach. This way allows you to drop(or simplify) some "boring" code like a manually created apply() methods for Config Pages. My last version of kdev-cppcheck (differential D2844) already uses this approach.
src/plugin/plugin.cpp
251

it's better to use new API:
core()->languageController()->problemModelSet()->showModel(problemModelName);

coliveira marked 6 inline comments as done.Oct 3 2016, 11:59 PM

Thanks for the comments, guys. I already made most of the suggestions, I think.
About the KConfigSkeleton approach I need to study more to understand how it works. In the meantime, I left the PerProjectConfigPage almost in the same way it was, except for the pointer API, which Kevin Funk suggested to change.
As soon as I understand the KConfigSkeleton enough to reimplement the PerProjectConfigPage I'll submit another patch.

Thank you, guys!

cmake/ClangFormatAll.cmake
13

Well, WARNING should be enough, since it's just for developers to auto format code.

src/config/perprojectconfigpage.h
65

Now PerProjectConfigPage is the owner of the list of selected checks and it passes this list by value by emitting a signal which is connected to a slot on the Plugin class. Do you think it is enough?

src/plugin/job.cpp
151

I saw KDevelop::OutputExecuteJob code and realized that I was doing nothing special, so I preferred to drop this method.

src/plugin/plugin.cpp
251

Cleaner API. I like it.

coliveira updated this revision to Diff 7239.Oct 10 2016, 1:11 AM
coliveira removed a reviewer: mwolff.
coliveira changed the visibility from "All Users" to "Public (No Login Required)".
coliveira marked 4 inline comments as done.

Improved style by preferring camel case identifiers, cleaned wrong comments, changed ClangFormat target to issue a WARNING instead of ERROR in case of clang-format executable not being found, and changed the API on PerProjectConfigPage to issue a signal when the selection of checks change instead of using a QStringList pointer owned by someone else.

I didn't get a clue on how to use KConfigSkeleton in PerProjectConfigPage because the list of checks is generated during runtime, by running clang-tidy and parsing its output. I had a hard time trying to use this and still have the list of checks not hard-coded inside the plugin code, which I believe it's the right way to do the plugin, since the list of checks may change from one version to another of clang-tidy. Ideas are welcome.

Hi guys!

I think I got the idea on using KConfigSkeleton, as suggested by Anton Anikin.
By the way, I made some improvements on the UI and added a few features to support the changes in the UI.
I have quite a long diff to submit for review.

Would it be appropriate to add the diff in this revision or should we close this review and create another one with this new diff?

kfunk added a comment.Oct 15 2016, 7:26 PM

Hi guys!

I think I got the idea on using KConfigSkeleton, as suggested by Anton Anikin.
By the way, I made some improvements on the UI and added a few features to support the changes in the UI.
I have quite a long diff to submit for review.

Would it be appropriate to add the diff in this revision or should we close this review and create another one with this new diff?

Please create a new review.

Cheers,
Kevin

kfunk accepted this revision.Oct 15 2016, 7:27 PM
kfunk edited edge metadata.
This revision is now accepted and ready to land.Oct 15 2016, 7:27 PM
kfunk closed this revision.Oct 15 2016, 7:27 PM