getting started with cppdepend how to get set up and ... · getting started with cppdepend 1 how to...
TRANSCRIPT
![Page 1: Getting Started with CppDepend How to Get Set Up and ... · Getting Started with CppDepend 1 How to Get Set Up and Running with CppDepend Whether you have purchased or downloaded](https://reader030.vdocuments.us/reader030/viewer/2022041222/5e0c7125a2e89b18196aa224/html5/thumbnails/1.jpg)
GettingStartedwithCppDepend
1
HowtoGetSetUpandRunningwithCppDepend
Whether you have purchased or downloaded the trial of CppDepend, wethank you for your involvement and interest in our product. Herewe havecompiledaquick"GettingStarted"guidetohelpyougetupandrunningwithCppDependasquicklyaspossible.Whilewehave tried to collect thebasics in thisdocument,weurge you toexperimentandexploreCppDependonyourowncodebases.Thereareatonof features and possibilities, many of which are out of the scope of thisdocument.CppDependhasbeenindevelopmentforover9years,andwitheveryversionwe take into account user feedback and requests. For any additional help,[email protected],gotoourUserVoicetoleaveasuggestion.
1. HowtoinstallCppDepend
• DownloadtheCppDependzipfile,• ExtracttheCppDepend.zipfilethatstartstheInstallationWizard,
NOTE:DON'TUNZIPTHEFILESIN:'%PROGRAMFILES%/CPPDEPEND'ASTHISWILLCREATEPROBLEMSBECAUSEOFWINDOWSPROTECTION
• Followallstepssuggestedbythewizard.
2. HowdoIanalyzemyC\C++applicationsusingCppDepend?
• RunVisualCppDepend.exefromwindowsOSorlaunchVisualCppDepend.shfromLinux.
![Page 2: Getting Started with CppDepend How to Get Set Up and ... · Getting Started with CppDepend 1 How to Get Set Up and Running with CppDepend Whether you have purchased or downloaded](https://reader030.vdocuments.us/reader030/viewer/2022041222/5e0c7125a2e89b18196aa224/html5/thumbnails/2.jpg)
GettingStartedwithCppDepend
2
• CreateNewCppDependProject
• AddyourC/C++projects.
ThefollowingkindofprojectsaremanagedbyCppDepend:
o .vcproj,.vcxproj,.sln:VisualStudioprojects.o Qtprojects:CppDependtreatoutoftheboxtheQtprojects,
youhavejusttospecifytheqmaketoolpath.o .buildfiles:TherecommendedwaytoanalyseyourC\C++
projectsotherthantheVSones,istousetheBuildMonitortooltointerceptallcompilationandlinkcommands.
o Setofsourcefiles:YoucanusetheProjectMakertooltodescribethespecificationofyourproject.WithProjectMakeryoucanspecifyyoursourcefiles,theincludepathsandthedefines.
![Page 3: Getting Started with CppDepend How to Get Set Up and ... · Getting Started with CppDepend 1 How to Get Set Up and Running with CppDepend Whether you have purchased or downloaded](https://reader030.vdocuments.us/reader030/viewer/2022041222/5e0c7125a2e89b18196aa224/html5/thumbnails/3.jpg)
GettingStartedwithCppDepend
3
• ClickF5toanalyzeyourprojects.Theanalysiswilltakeafewsecondstoafewminutesdependingonthesizeoftheprojects.
• Oncetheanalysisdone,theresultisdisplayedintheVisualCppDepend.exeUI.
3. InstallingtheCppDependaddinforVisualStudio2017,2015,2013,2012,2010
• DownloadtheCppDependinstallationzipfile• ToinstallCppDepend,justinstallthefilesinaprivateapplicationfolder
onyourmachine.Don'tinstallfilesin'%ProgramFiles%\CppDepend'.ThiswillprovokeproblemsbecauseofWindowsprotection.
• StartCppDepend.VisualStudioAddin.Installer.exeorStartVisualCppDependandinstalltheVSaddinfromthestartpage.
![Page 4: Getting Started with CppDepend How to Get Set Up and ... · Getting Started with CppDepend 1 How to Get Set Up and Running with CppDepend Whether you have purchased or downloaded](https://reader030.vdocuments.us/reader030/viewer/2022041222/5e0c7125a2e89b18196aa224/html5/thumbnails/4.jpg)
GettingStartedwithCppDepend
4
• ClickthebuttonInstallfortherightVisualStudioversion
4. AnalyzingaVisualStudiosolution
• StartVisualStudioafterhavinginstalledtheCppDependaddin.• OpentheVisualStudiosolutioncontainingthecodetoanalyze.• ClickthegreyedCppDependcirclestatus(bottomrightoftheVisual
Studiowindow)ORclickthemenuCppDepend>AttachnewCppDependprojecttocurrentVisualStudiosolutionNote:
• ACppDependprojectcanbeattachedtoseveralVisualStudiosolutions.
• ThisisusefulifyouwishtoanalyzeseveralC/C++projectscompiledwithseveralVisualStudiosolutions.
• AbenefitwillbethepossibilitytonavigateacrossseveralVisualStudiosolutionsopenedinseveralVisualStudioinstances.
![Page 5: Getting Started with CppDepend How to Get Set Up and ... · Getting Started with CppDepend 1 How to Get Set Up and Running with CppDepend Whether you have purchased or downloaded](https://reader030.vdocuments.us/reader030/viewer/2022041222/5e0c7125a2e89b18196aa224/html5/thumbnails/5.jpg)
GettingStartedwithCppDepend
5
• ThedialogopenedhasbeenpopulatedwiththeVisualStudiosolution.
Hereyoucanaddmoreprojectscompiledfromanothersolution
• LaunchtheCppDependanalysisstart.Itwilljusttakeafewminutesto
analyzeyourcodebaseforthefirsttime.
5. UsingCQLinqwithCppDependCQLinq isaquery languagebasedoffof theC#LINQsyntaxand isacriticalpart of CppDepend which uses CQLinq queries to assess a code base and,furthermore, it allows users to create their own code queries. This allowsarchitects and developers to custom make code rules to test for custommetrics.UsingCQLinq,thereisvirtuallynometricyoucan'ttest.
![Page 6: Getting Started with CppDepend How to Get Set Up and ... · Getting Started with CppDepend 1 How to Get Set Up and Running with CppDepend Whether you have purchased or downloaded](https://reader030.vdocuments.us/reader030/viewer/2022041222/5e0c7125a2e89b18196aa224/html5/thumbnails/6.jpg)
GettingStartedwithCppDepend
6
CppDepend itself comes with 200 ready-made code queries that you canimmediatelyuseonyourcodebase.Whenyouruntheanalysisonyourcode,youwillseesomecolorfeedbackonthequality. Yellowand redhighlighted lines of code showyouwhere rulesarebeingbroken,withredbeingmoreseverebreaches.FurtherinformationonCQLinqcanbefoundontheCppDependwebsite.
6. UsingCppDependforReports
ReportscanbecustomizedthroughtheVisualCppDependor theVSaddin>ProjectProperties>Reportsub-panel.Youcanchoosetoactivatemanypre-defined sections like Application and Assembliesmetrics, diagrams, CQLinqrulesviolations,andmore.Thegeneratedreportsarein.htmlformatandarefoundinthefolderCppDependReportFiles.Anyreportsshouldautomaticallyopeninyourbrowser.
![Page 7: Getting Started with CppDepend How to Get Set Up and ... · Getting Started with CppDepend 1 How to Get Set Up and Running with CppDepend Whether you have purchased or downloaded](https://reader030.vdocuments.us/reader030/viewer/2022041222/5e0c7125a2e89b18196aa224/html5/thumbnails/7.jpg)
GettingStartedwithCppDepend
7
Inaddition,thereportswillgiveasummaryofallthemainrulesviolations.Tocustomizewhichviolationsyouwantincludedinthereport,youcancheckorunchecktheboxnexttoeachoneaswellaschoosehowtheviolationwillbedisplayed in the report. You can also set which rules are to be consideredcritical.Note: It is recommended to uncheck the Type Metrics and TypeDependencieswhengeneratingreportsoncodebasescontainingmorethanathousandtypes.Thiswillcausethegeneratedreporttobeverylarge.Itisrecommended that you use the Interactive UI to browse metrics anddependenciesinstead.
![Page 8: Getting Started with CppDepend How to Get Set Up and ... · Getting Started with CppDepend 1 How to Get Set Up and Running with CppDepend Whether you have purchased or downloaded](https://reader030.vdocuments.us/reader030/viewer/2022041222/5e0c7125a2e89b18196aa224/html5/thumbnails/8.jpg)
GettingStartedwithCppDepend
8
Hereiswhatthecoderuleviolationpartofthereportlookslike:
Youcanclearlyseetherulesontheleft,alongwithhowmanyviolationswerefound (in yellow and red). Clicking on a code rule on the left, gives youadditionalinformationabouttheviolationsintheinformationwindowontheright.TheDSM isagridofcoloredcellswithnumbers insideof them.Eachcolor,blue,green,andblack,meanadifferentthingandaredefinedviaacontextsensitivehelpsystemwhenhoveredoverwithyourmousecursor.Ifthecellhas a number, this is the number of couplings between the objects in thesamerowandcolumn.Byclickingonacell,youwillseeadependencygraphofthatobject.
7. CppDepend’sDependencyMatrixTheDSM(DependencyStructureMatrix)allowsuserstoquicklygetabroadoverview of the dependencies and couplings that exists within their codebaseanddisplaysstructuralpatternsataglance.It isdifferentfromagraphsince we found that a simple dependency graph does not scale well withlarger assemblies of code. Graphs are very good at displaying informationaboutsmallercodebasesbutgetconfusingthebiggerthebaseis.
![Page 9: Getting Started with CppDepend How to Get Set Up and ... · Getting Started with CppDepend 1 How to Get Set Up and Running with CppDepend Whether you have purchased or downloaded](https://reader030.vdocuments.us/reader030/viewer/2022041222/5e0c7125a2e89b18196aa224/html5/thumbnails/9.jpg)
GettingStartedwithCppDepend
9
8. WhatdoestheCppDependreporttellmeaboutmycode?
• ApplicationMetric:Thissectiongivesyouanideaofthetopologyofyourapplication.
• ProjectMetric:Thissectiongivesyouanideaofthesizeofeachprojectwithinyourapplicationintermsofcodelineandothersmetrics.
• VisualCppDependView:Thissectionillustratesthesizeofyourprojects,namespaces,typesandmethodsintermsofcodeline.YoucanbrowsethisviewdynamicallybyclickingtheLaunchVisualCppDependonthisProjecticonintheCppDepend.ProjectUI.
• ProjectAbstracnessvs.Instability:ThissectionillustratetheAbstracness/Instabilityprincipleexplainedintheprojectsmetricssection.
• ProjectDependencies:Thissectionshowsalldependenciesbetweenprojectofyourapplicationinatable.
• ProjectDependencyDiagram:Thissectionshowsalldependenciesbetweenprojectsofyourapplicationinadiagram
• Projectbuildorder:Thissectiongivesyouoneofthepossiblebuildorderforyourprojects.Ifacycleexistsinyourprojectsdependenciesgraph,thissectionwillreportit.
![Page 10: Getting Started with CppDepend How to Get Set Up and ... · Getting Started with CppDepend 1 How to Get Set Up and Running with CppDepend Whether you have purchased or downloaded](https://reader030.vdocuments.us/reader030/viewer/2022041222/5e0c7125a2e89b18196aa224/html5/thumbnails/10.jpg)
GettingStartedwithCppDepend
10
• CppDependInformationandWarnings:Thissectiongivesyoufeedbackonyourcode:
o Itwarnsyouwhenaprojectdependsonalessstableprojectthanitself.
o Itwarnsyouwhenthevisibilityofatypeorofamemberisnotoptimal(inthecontextoftheanalyzedapplication).
o Itwarnsyouwhenatypeoramemberisnotused(inthecontextoftheanalyzedapplication).
• CQLinqQueriesandConstraints:ThissectionreportsdefaultCQLinqconstraintswhichhavebeenviolated.MoreabouttheCQLinqlanguageandCQLconstraintshere.YoucanbuildyourownCQLinqconstraintswithVisualCppDepend.
• TypeMetrics:Thissectionrecapstypemetricsinatable.Alinktothedocumentationisprovidedforeachmetric.
9. Iwanttogofurthertohaveabettercontrolovermycode
• UnderstandmetricsyieldedbyCppDependandreadrecommendations.
• GetanewunderstandingofyourcodebyplayingwiththeCppDependpanels.ModifytheviewwiththeLevelandMetriccomboboxes.
• TuneyourreportthankstotheOutputpanelintheCppDepend.ProjectUI.
• LearnCQLinq,adaptexistingCQLinqcoderulesandcreateyourownones.
• IntegratetheCppDependreportinyourdailybuildprocess.
FurtherInformationCanbeFoundOnOurWebsite
http://www.cppdepend.com