Bug 565367 - Add code metrics checkers (lines of code, nested blocks, cyclomatic complexity)
Summary: Add code metrics checkers (lines of code, nested blocks, cyclomatic complexity)
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-codan (show other bugs)
Version: Next   Edit
Hardware: All All
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: CDT Codan Inbox CLA
QA Contact: Elena Laskavaia CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-07-20 10:08 EDT by Sergey Vladimirov CLA
Modified: 2020-07-21 07:20 EDT (History)
5 users (show)

See Also:


Attachments
Patch for ParametersComposite to allow integer checker preference (1.22 KB, patch)
2020-07-20 14:07 EDT, Sergey Vladimirov CLA
no flags Details | Diff
Add code metrics category (1.21 KB, patch)
2020-07-20 14:46 EDT, Sergey Vladimirov CLA
no flags Details | Diff
Nested Block Depth Checker (9.91 KB, patch)
2020-07-20 14:51 EDT, Sergey Vladimirov CLA
no flags Details | Diff
Cyclomatic Complexity Checker (along with prev. Nested Block Depth Checker) (19.86 KB, patch)
2020-07-20 15:24 EDT, Sergey Vladimirov CLA
no flags Details | Diff
Allow to register checker preferences using annotations (4.86 KB, patch)
2020-07-20 16:08 EDT, Sergey Vladimirov CLA
no flags Details | Diff
Cyclomatic Complexity Checker (along with prev. Nested Block Depth Checker) (18.23 KB, patch)
2020-07-20 16:20 EDT, Sergey Vladimirov CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sergey Vladimirov CLA 2020-07-20 10:08:07 EDT
Implement checkers for:
- lines of code in functions
- nesting block depth
- cyclomatic complexity (McCabe + boolean OR/AND expressions)

This bug is a holder for CDT Codan patch
Comment 1 Sergey Vladimirov CLA 2020-07-20 10:08:27 EDT
Not related to 372722
Comment 2 Sergey Vladimirov CLA 2020-07-20 14:07:21 EDT
Created attachment 283650 [details]
Patch for ParametersComposite to allow integer checker preference
Comment 3 Sergey Vladimirov CLA 2020-07-20 14:46:50 EDT
Created attachment 283652 [details]
Add code metrics category

Feel free to fix my Engrlish ;-)
Comment 4 Sergey Vladimirov CLA 2020-07-20 14:51:26 EDT
Created attachment 283653 [details]
Nested Block Depth Checker
Comment 5 Marco Stornelli CLA 2020-07-20 14:54:16 EDT
Please post the code on Gerrit for review, here it's unlikely the code will be reviewed and merged.
Comment 6 Sergey Vladimirov CLA 2020-07-20 15:24:20 EDT
Created attachment 283655 [details]
Cyclomatic Complexity Checker (along with prev. Nested Block Depth Checker)
Comment 7 Sergey Vladimirov CLA 2020-07-20 16:08:19 EDT
Created attachment 283656 [details]
Allow to register checker preferences using annotations

This patch includes prev. patch "283652: Add code metrics category"
Comment 8 Sergey Vladimirov CLA 2020-07-20 16:20:47 EDT
Created attachment 283657 [details]
Cyclomatic Complexity Checker (along with prev. Nested Block Depth Checker)
Comment 9 Sergey Vladimirov CLA 2020-07-20 16:22:37 EDT
Marco, is there step-by-step instruction how to post the code on Gerrit?
Comment 10 Nathan Ridge CLA 2020-07-20 16:26:09 EDT
(In reply to Sergey Vladimirov from comment #9)
> Marco, is there step-by-step instruction how to post the code on Gerrit?

Yup, here: https://wiki.eclipse.org/CDT/git#Using_Gerrit_for_CDT
Comment 11 Sergey Vladimirov CLA 2020-07-20 16:34:22 EDT
Marco, there is a point "Right-click on 'Remotes' and select "Create remote..."", but i see not such link / item on https://git.eclipse.org/r/admin/repos/cdt/org.eclipse.cdt screen.
Comment 12 Nathan Ridge CLA 2020-07-20 16:50:06 EDT
(In reply to Sergey Vladimirov from comment #11)
> Marco, there is a point "Right-click on 'Remotes' and select "Create
> remote..."", but i see not such link / item on
> https://git.eclipse.org/r/admin/repos/cdt/org.eclipse.cdt screen.

This step is meant to be done from within Eclipse (the development instance that you used to write the patches). You can also do equivalent steps using the git command line, though we don't have that written up.
Comment 13 Sergey Vladimirov CLA 2020-07-20 16:51:42 EDT
Not in obvious way, but i've done it: https://git.eclipse.org/r/c/cdt/org.eclipse.cdt/+/165660