1 |
- (window.webpackJsonp=window.webpackJsonp||[]).push([[6],{106:function(e,t,n){"use strict";n.r(t),n.d(t,"frontMatter",(function(){return s})),n.d(t,"metadata",(function(){return c})),n.d(t,"rightToc",(function(){return l})),n.d(t,"default",(function(){return b}));var r=n(2),o=n(6),i=(n(0),n(117)),s={id:"01-u-overview",title:"Overview",sidebar_label:"Overview"},c={id:"01-u-overview",isDocsHomePage:!1,title:"Overview",description:"Highlights",source:"@site/docs/01-u-overview.md",permalink:"/docs/01-u-overview",editUrl:"https://metrixplusplus.github.io/docs/01-u-overview.md",sidebar_label:"Overview",sidebar:"someSidebar",next:{title:"Download and install",permalink:"/docs/02-u-download-install"}},l=[{value:"Highlights",id:"highlights",children:[]},{value:"Languages supported",id:"languages-supported",children:[]},{value:"Metrics",id:"metrics",children:[]}],a={rightToc:l};function b(e){var t=e.components,n=Object(o.a)(e,["components"]);return Object(i.b)("wrapper",Object(r.a)({},a,n,{components:t,mdxType:"MDXLayout"}),Object(i.b)("h2",{id:"highlights"},"Highlights"),Object(i.b)("p",null,"Metrix++ is a tool to collect and analyse code metrics. Any metric is useless if it is not used. Metrix++ offers ease of introduction and integration with a variety of application use cases."),Object(i.b)("ul",null,Object(i.b)("li",{parentName:"ul"},"Monitoring trends (eg. on ",Object(i.b)("strong",{parentName:"li"},"daily")," basis. In order to take actions or make right decisions earlier.)"),Object(i.b)("li",{parentName:"ul"},"Enforcing trends (eg. on ",Object(i.b)("strong",{parentName:"li"},"hourly")," basis, at every commit of code changes.)"),Object(i.b)("li",{parentName:"ul"},"Automated asistance to review agains standards (eg. on ",Object(i.b)("strong",{parentName:"li"},"per minute")," basis during code refactoring and code development.)\nThe workflow sections below demonstarate these basic application usecases.")),Object(i.b)("h2",{id:"languages-supported"},"Languages supported"),Object(i.b)("p",null,"The tool can parse C/C++, C# and Java source code files. The parser identifies certain regions in the code, such as classes, functions, namespaces, interfaces, etc. It detects comments, strings and code for the preprocessor. The identified regions form a tree of nested source code blocks, which are subsequently refered to and scanned by metrics plugins. Thus the tool attributes metrics to regions, which provides fine grained data to analysis tools. The following example demonstrates the regions concept. The right side comments describe Metrix++ properties attributed to each source line: type of region, name of a region and type of a content of a region)."),Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cpp"}),'// simple C++ code // file: __global__: comment\n // file: __global__: code\n#include <myapi.h> // file: __global__: preprocessor\n // file: __global__: code\n// I explain the following class // class: MyClass: comment\nclass MyClass { // class: MyClass: code\npublic: // class: MyClass: code\n int m_var; // some member // class: MyClass: code, comment\n // class: MyClass: code\n // I explain the following function // function: MyClass: comment\n MyClass(): m_var(0) { // function: MyClass: code\n char str[] = "unused string" // function: MyClass: code, string\n // function: MyClass: code, string\n // nested region for good measure // function: MyClass: code\n struct MyStruct {}; // struct: MyStruct: comment\n } // struct: MyStruct: code\n // function: MyClass: code\n // Do not judge ugly code below // class: MyClass: code\n#define get_max(a,b) ((a)>(b)?(a):(b)) // function: set_max: comment\n set_max(int b) { // function: set_max: preprocessor\n m_var = get_max(m_var, b); // function: set_max: code\n } // function: set_max: code\n}; // function: set_max: code\n// this is the last line // file: __global__: comment\n')),Object(i.b)("h2",{id:"metrics"},"Metrics"),Object(i.b)("p",null,"The metrics highlighed in blue are ",Object(i.b)("strong",{parentName:"p"},"per file")," metrics. The other metrics are ",Object(i.b)("strong",{parentName:"p"},"per region")," metrics."),Object(i.b)("table",{class:"table table-bordered"},Object(i.b)("thead",null,Object(i.b)("tr",null,Object(i.b)("th",null,"Metric (enable option)"),Object(i.b)("th",null,"Brief description"),Object(i.b)("th",null,"Motivation / Potential use"))),Object(i.b)("tbody",null,Object(i.b)("tr",{class:"info center-justified"},Object(i.b)("td",null,"std.general.size"),Object(i.b)("td",null,"Size of a file in bytes."),Object(i.b)("td",{rowspan:"6"},Object(i.b)("ul",null,Object(i.b)("li",null,"Monitoring the growth of source code base."),Object(i.b)("li",null,"Normalizing other metrics."),Object(i.b)("li",null,"Preventing large files and regions (large things are difficult to maintain)."),Object(i.b)("li",null,"Predicting delivery dates by comparing S-shaped code base growth / change curves.")))),Object(i.b)("tr",{class:"td-regular center-justified"},Object(i.b)("td",null,"std.code.length.total"),Object(i.b)("td",null,"The same as 'std.general.size' metric, but attributed to code regions.")),Object(i.b)("tr",{class:"info center-justified"},Object(i.b)("td",null,"std.code.filelines.total"),Object(i.b)("td",null,"Number of non-blank lines of code of any content type (exectuable, comments, etc.) per file")),Object(i.b)("tr",{class:"td-regular center-justified"},Object(i.b)("td",null,"std.code.lines.total"),Object(i.b)("td",null,"Number of non-blank lines of code of any content type (exectuable, comments, etc.) per region")),Object(i.b)("tr",{class:"info center-justified"},Object(i.b)("td",null,"std.code.filelines.code"),Object(i.b)("td",null,"Number of non-blank lines of code excluding preprocessor and comments per file.")),Object(i.b)("tr",{class:"td-regular center-justified"},Object(i.b)("td",null,"std.code.lines.code"),Object(i.b)("td",null,"Number of non-blank lines of code excluding preprocessor and comments per region.")),Object(i.b)("tr",{class:"info center-justified"},Object(i.b)("td",null,"std.code.filelines.preprocessor"),Object(i.b)("td",null,"Number of non-blank lines of preprocessor code per file."),Object(i.b)("td",{rowspan:"2"},Object(i.b)("ul",null,Object(i.b)("li",null,"Enforcing localisation of preprocessor code in a single place."),Object(i.b)("li",null,"Encouraging usage of safer code structures instead of the preprocessor.")))),Object(i.b)("tr",{class:"td-regular center-justified"},Object(i.b)("td",null,"std.code.lines.preprocessor"),Object(i.b)("td",null,"Number of non-blank lines of preprocessor code per region.")),Object(i.b)("tr",{class:"info center-justified"},Object(i.b)("td",null,"std.code.filelines.comments"),Object(i.b)("td",null,"Number of non-blank lines of comments per file."),Object(i.b)("td",{rowspan:"2"},Object(i.b)("ul",null,Object(i.b)("li",null,"Low number of comments may indicate maintainability problems.")))),Object(i.b)("tr",{class:"td-regular center-justified"},Object(i.b)("td",null,"std.code.lines.comments"),Object(i.b)("td",null,"Number of non-blank lines of comments per region.")),Object(i.b)("tr",{class:"td-regular center-justified"},Object(i.b)("td",null,"std.code.complexity.cyclomatic"),Object(i.b)("td",null,"McCabe cyclomatic complexity metric."),Object(i.b)("td",{colspan:"2"},Object(i.b)("ul",null,Object(i.b)("li",null,"Identification of highly complex code for review and refactoring."),Object(i.b)("li",null,"Preventing complex functions (complexity is a reason of many defects and a reason of expensive maintaintenance).")))),Object(i.b)("tr",{class:"td-regular center-justified"},Object(i.b)("td",null,"std.code.complexity.maxindent"),Object(i.b)("td",null,"Maximum level of indentation of blocks within a region.",Object(i.b)("pre",{class:"prettyprint"}))),Object(i.b)("tr",{class:"td-regular center-justified"},Object(i.b)("td",null,"std.code.magic.numbers"),Object(i.b)("td",null,"Number of magic numbers. There is an option to exclude 0, -1 and 1 numbers from counting."),Object(i.b)("td",null,"Magic numbers are dangerous. The ",Object(i.b)("a",{href:"http://stackoverflow.com/questions/47882/what-is-a-magic-number-and-why-is-it-bad",target:"blank"},"discussion on stackoverflow")," explains why.")),Object(i.b)("tr",{class:"td-regular center-justified"},Object(i.b)("td",null,"std.code.todo.comments, std.code.todo.strings"),Object(i.b)("td",null,"Number of TODO/FIXME/etc markers in comments and strings accordingly. There is an option to configure a list of markers."),Object(i.b)("td",null,"Manage potentially incomplete work. If project manager dispatches issues only in a tracker tool, todo markers are lost in the source code. The metric could make these 'lost' issues visible.")),Object(i.b)("tr",{class:"info center-justified"},Object(i.b)("td",null,"std.general.proctime"),Object(i.b)("td",null,"Seconds spent on processing a file."),Object(i.b)("td",null,Object(i.b)("ul",null,Object(i.b)("li",null,"Monitor and profile Metrix++ tool's performance.")))),Object(i.b)("tr",{class:"td-regular center-justified"},Object(i.b)("td",null,"std.suppress"),Object(i.b)("td",null,"An option enables collection of Metrix++ suppressions and 2 metrics: 'std.suppress:count' and 'std.suppress.file:count'. The first is number of suppressions per region. The second is the same but applies for file-scope metrics."),Object(i.b)("td",null,Object(i.b)("ul",null,Object(i.b)("li",null,"Suppressing false-positives."),Object(i.b)("li",null,"Managing the amount of suppressions. There should be no false-positives to suppress with the right metric, but there could be exceptions in specific cases. Managing suppressions is about managing exceptions. If there are many exceptional cases, maybe something is wrong with a metric or the application of a metric.")))),Object(i.b)("tr",{class:"info center-justified"},Object(i.b)("td",null,"std.general.procerrors"),Object(i.b)("td",null,"Number of errors detected by Metrix++ code parser."),Object(i.b)("td",null,Object(i.b)("ul",null,Object(i.b)("li",null,"Cleaning up errors to ensure reliable code scanning."),Object(i.b)("li",null,"Errors, like mismatched brackets, may result in bad identification of regions.")))),Object(i.b)("tr",{class:"td-regular center-justified"},Object(i.b)("td",null,"std.code.maintindex.simple"),Object(i.b)("td",null,"Simple variant of maintainability index - a measure of maintainability. It uses std.code.lines:code and std.code.complexity:cyclomatic metrics to evaluate level of maintainability. Lower value of this index indicates better level maintainability"),Object(i.b)("td",null,"Identify code, which may benefit the most from refactoring.")))))}b.isMDXComponent=!0},117:function(e,t,n){"use strict";n.d(t,"a",(function(){return d})),n.d(t,"b",(function(){return m}));var r=n(0),o=n.n(r);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var a=o.a.createContext({}),b=function(e){var t=o.a.useContext(a),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},d=function(e){var t=b(e.components);return o.a.createElement(a.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return o.a.createElement(o.a.Fragment,{},t)}},p=o.a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,s=e.parentName,a=l(e,["components","mdxType","originalType","parentName"]),d=b(n),p=r,m=d["".concat(s,".").concat(p)]||d[p]||u[p]||i;return n?o.a.createElement(m,c(c({ref:t},a),{},{components:n})):o.a.createElement(m,c({ref:t},a))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,s=new Array(i);s[0]=p;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c.mdxType="string"==typeof e?e:r,s[1]=c;for(var a=2;a<i;a++)s[a]=n[a];return o.a.createElement.apply(null,s)}return o.a.createElement.apply(null,n)}p.displayName="MDXCreateElement"}}]);
|