Browse Source

More refactoring + initial lines plugin

avkonst 11 years ago
parent
commit
33f0f78a8d

+ 37 - 5
mainline/core/api.py

@@ -19,12 +19,44 @@
 
 class Plugin(object):
     
-    def initialize(self):
+    class Field(object):
+        def __init__(self, name, ftype, non_zero=False):
+            self.name = name
+            self.type = ftype
+            self.non_zero = non_zero
+
+    class Property(object):
+        def __init__(self, name, value):
+            self.name = name
+            self.value = value
+    
+    def initialize(self, namespace=None, fields=[], properties=[]):
         self.is_updated = False
         db_loader = self.get_plugin_loader().get_database_loader()
-        prev_version = db_loader.set_property(self.get_name() + ":version", self.get_version())
-        if prev_version != self.get_version():
-            self.is_updated = True
+        if namespace == None:
+            namespace = self.get_name()
+
+        if (len(fields) != 0 or len(properties) != 0):
+            prev_version = db_loader.set_property(self.get_name() + ":version", self.get_version())
+            if prev_version != self.get_version():
+                self.is_updated = True
+
+        for prop in properties:
+            assert(prop.name != 'version')
+            prev_prop = db_loader.set_property(self.get_name() + ":" + prop.name, prop.value)
+            if prev_prop != prop.value:
+                self.is_updated = True
+
+        if len(fields) != 0:
+            namespace_obj = db_loader.create_namespace(namespace,
+                                                       support_regions=True,
+                                                       version=self.get_version())
+            for field in fields:
+                is_created = namespace_obj.add_field(field.name, field.type, non_zero=field.non_zero)
+                assert(is_created != None)
+                # if field is created (not cloned from the previous db),
+                # mark the plug-in as updated in order to trigger full rescan
+                self.is_updated = self.is_updated or is_created
     
     def terminate(self):
         pass
@@ -119,6 +151,7 @@ class Parent(object):
         for child in self.children:
             yield child
 
+# TODO re-factor and remove this
 class ExitError(Exception):
     def __init__(self, plugin, reason):
         if plugin != None:
@@ -150,4 +183,3 @@ class ITool(object):
     def run(self, tool_args):
         raise InterfaceNotImplemented(self)
 
-

+ 8 - 5
mainline/core/db/loader.py

@@ -622,7 +622,7 @@ class FieldError(Exception):
 
 class Namespace(object):
     
-    def __init__(self, db_handle, name, support_regions = False):
+    def __init__(self, db_handle, name, support_regions = False, version='1.0'):
         if not isinstance(name, str):
             raise NamespaceError(name, "name not a string")
         self.name = name
@@ -631,7 +631,7 @@ class Namespace(object):
         self.db = db_handle
         
         if self.db.check_table(name) == False:        
-            self.db.create_table(name, support_regions)
+            self.db.create_table(name, support_regions, version)
         else:
             for column in self.db.iterate_columns(name):
                 self.add_field(column.name, PackagerFactory().get_python_type(column.sql_type), non_zero=column.non_zero)
@@ -651,7 +651,10 @@ class Namespace(object):
         self.fields[field_name] = packager
         
         if self.db.check_column(self.get_name(), field_name) == False:        
-            self.db.create_column(self.name, field_name, packager.get_sql_type(), non_zero=non_zero)
+            # - False if cloned
+            # - True if created
+            return self.db.create_column(self.name, field_name, packager.get_sql_type(), non_zero=non_zero)
+        return None # if double request
     
     def iterate_field_names(self):
         for name in self.fields.keys():
@@ -726,13 +729,13 @@ class Loader(object):
             return None
         return self.db.iterate_properties()
             
-    def create_namespace(self, name, support_regions = False):
+    def create_namespace(self, name, support_regions = False, version='1.0'):
         if self.db == None:
             return None
         
         if name in self.namespaces.keys():
             raise NamespaceError(name, "double used")
-        new_namespace = Namespace(self.db, name, support_regions)
+        new_namespace = Namespace(self.db, name, support_regions, version)
         self.namespaces[name] = new_namespace
         return new_namespace
     

+ 28 - 10
mainline/core/db/sqlite.py

@@ -229,7 +229,7 @@ class Database(object):
                 sql = "INSERT INTO __info__ (property, value, confirmed) VALUES ('version', '" + self.version + "', 1)"
                 self.log(sql)
                 self.conn.execute(sql)
-                sql = "CREATE TABLE __tables__ (id integer NOT NULL PRIMARY KEY, name text NOT NULL, support_regions integer NOT NULL, confirmed integer NOT NULL, UNIQUE (name))"
+                sql = "CREATE TABLE __tables__ (id integer NOT NULL PRIMARY KEY, name text NOT NULL, version text NOT NULL, support_regions integer NOT NULL, confirmed integer NOT NULL, UNIQUE (name))"
                 self.log(sql)
                 self.conn.execute(sql)
                 sql = "CREATE TABLE __columns__ (id integer NOT NULL PRIMARY KEY, name text NOT NULL, type text NOT NULL, table_id integer NOT_NULL, non_zero integer NOT NULL, confirmed integer NOT NULL, UNIQUE (name, table_id))"
@@ -278,17 +278,29 @@ class Database(object):
         for each in self.conn.execute(sql).fetchall():
             yield self.PropertyData(each['id'], each['property'], each['value'])
 
-    def create_table(self, table_name, support_regions = False):
+    def create_table(self, table_name, support_regions = False, version='1.0'):
         assert(self.read_only == False)
 
         sql = "SELECT * FROM __tables__ WHERE (name = '" + table_name + "'AND confirmed == 0)"
         self.log(sql)
         result = self.conn.execute(sql).fetchall()
         if len(result) != 0:
-            sql = "UPDATE __tables__ SET confirmed = 1 WHERE (name = '" + table_name + "')"
-            self.log(sql)
-            self.conn.execute(sql)
-            return        
+            if result[0]['version'] != version:
+                # in case of changes in version, drop existing table data
+                sql = "DELETE FROM __columns__ WHERE table_id = '" + str(result[0]['id']) + "'"
+                self.log(sql)
+                self.conn.execute(sql)
+                sql = "DELETE FROM __tables__ WHERE id = '" + str(result[0]['id']) + "'"
+                self.log(sql)
+                self.conn.execute(sql)
+                sql = "DROP TABLE '" + result[0]['name'] + "'"
+                self.log(sql)
+                self.conn.execute(sql)
+            else:                
+                sql = "UPDATE __tables__ SET confirmed = 1 WHERE (name = '" + table_name + "')"
+                self.log(sql)
+                self.conn.execute(sql)
+                return False      
         
         sql = "CREATE TABLE '" + table_name + "' (file_id integer NOT NULL PRIMARY KEY)"
         if support_regions == True:
@@ -297,10 +309,11 @@ class Database(object):
             
         self.log(sql)
         self.conn.execute(sql)
-        sql = "INSERT INTO __tables__ (name, support_regions, confirmed) VALUES ('" + table_name + "', '" + str(int(support_regions)) + "', 1)"
+        sql = "INSERT INTO __tables__ (name, version, support_regions, confirmed) VALUES ('" + table_name + "', '" + version + "', '" + str(int(support_regions)) + "', 1)"
         self.log(sql)
         self.conn.execute(sql)
-        
+        return True
+
     def iterate_tables(self):
         sql = "SELECT * FROM __tables__ WHERE (confirmed = 1)"
         self.log(sql)
@@ -330,10 +343,14 @@ class Database(object):
         self.log(sql)
         result = self.conn.execute(sql).fetchall()
         if len(result) != 0:
+            # Major changes in columns should result in step up of table version,
+            # which causes drop the table in case of database reuse
+            assert(result[0]['type'] == column_type)
+            assert(result[0]['non_zero'] == non_zero)
             sql = "UPDATE __columns__ SET confirmed = 1 WHERE (table_id = '" + str(table_id) + "' AND name = '" + column_name + "')"
             self.log(sql)
             self.conn.execute(sql)
-            return        
+            return False       
         
         sql = "ALTER TABLE '" + table_name + "' ADD COLUMN '" + column_name + "' " + column_type
         self.log(sql)
@@ -343,7 +360,8 @@ class Database(object):
         table_id = self.conn.execute(sql).next()['id']
         sql = "INSERT INTO __columns__ (name, type, table_id, non_zero, confirmed) VALUES ('" + column_name + "', '" + column_type + "', '" + str(table_id) + "', '" + str(int(non_zero)) + "', 1)"
         self.log(sql)
-        self.conn.execute(sql)        
+        self.conn.execute(sql)
+        return True        
 
     def iterate_columns(self, table_name):
         sql = "SELECT id FROM __tables__ WHERE (name = '" + table_name + "')"

+ 5 - 4
mainline/core/dir.py

@@ -51,13 +51,14 @@ class Plugin(core.api.Plugin, core.api.Parent, core.api.IConfigurable, core.api.
         self.is_size_enabled = options.__dict__['std.general.size']
 
     def initialize(self):
-        namespace = self.get_plugin_loader().get_database_loader().create_namespace('std.general')
+        fields = []
         if self.is_proctime_enabled == True:
-            namespace.add_field('proctime', float)
+            fields.append(self.Field('proctime', float))
         if self.is_procerrors_enabled == True:
-            namespace.add_field('procerrors', int)
+            fields.append(self.Field('procerrors', int))
         if self.is_size_enabled == True:
-            namespace.add_field('size', int)
+            fields.append(self.Field('size', int))
+        core.api.Plugin.initialize(self, namespace='std.general', fields=fields)
         
     def run(self, args):
         if len(args) == 0:

+ 5 - 4
mainline/ext/std/code/complexity.py

@@ -31,11 +31,12 @@ class Plugin(core.api.Plugin, core.api.Child, core.api.IConfigurable):
         self.is_active = options.__dict__['std.code.complexity.cyclomatic']
         
     def initialize(self):
+        fields = []
         if self.is_active == True:
-            # trigger version property set
-            core.api.Plugin.initialize(self)
-            namespace = self.get_plugin_loader().get_database_loader().create_namespace(self.get_name(), support_regions = True)
-            namespace.add_field('cyclomatic', int)
+            fields.append(self.Field('cyclomatic', int))
+        core.api.Plugin.initialize(self, fields=fields)
+        
+        if len(fields) != 0:
             core.api.subscribe_by_parents_name('std.code.cpp', self, 'callback_cpp')
             core.api.subscribe_by_parents_name('std.code.cs', self, 'callback_cs')
             core.api.subscribe_by_parents_name('std.code.java', self, 'callback_java')

+ 3 - 7
mainline/ext/std/code/cpp.py

@@ -35,13 +35,9 @@ class Plugin(core.api.Plugin, core.api.Parent, core.api.IParser, core.api.IConfi
         self.files.sort() # sorted list goes to properties
         
     def initialize(self):
-        # trigger version property set
-        core.api.Plugin.initialize(self)
-        db_loader = self.get_plugin_loader().get_database_loader()
-        prev_ext = db_loader.set_property(self.get_name() + ":files", ','.join(self.files))
-        if prev_ext != ','.join(self.files):
-            self.is_updated = True
-
+        core.api.Plugin.initialize(self, properties=[
+            self.Property('files', ','.join(self.files))
+        ])
         self.get_plugin_loader().register_parser(self.files, self)
         
     def process(self, parent, data, is_updated):

+ 3 - 7
mainline/ext/std/code/cs.py

@@ -35,13 +35,9 @@ class Plugin(core.api.Plugin, core.api.Parent, core.api.IParser, core.api.IConfi
         self.files.sort() # sorted list goes to properties
         
     def initialize(self):
-        # trigger version property set
-        core.api.Plugin.initialize(self)
-        db_loader = self.get_plugin_loader().get_database_loader()
-        prev_ext = db_loader.set_property(self.get_name() + ":files", ','.join(self.files))
-        if prev_ext != ','.join(self.files):
-            self.is_updated = True
-
+        core.api.Plugin.initialize(self, properties=[
+            self.Property('files', ','.join(self.files))
+        ])
         self.get_plugin_loader().register_parser(self.files, self)
         
     def process(self, parent, data, is_updated):

+ 3 - 7
mainline/ext/std/code/java.py

@@ -35,13 +35,9 @@ class Plugin(core.api.Plugin, core.api.Parent, core.api.IParser, core.api.IConfi
         self.files.sort() # sorted list goes to properties
         
     def initialize(self):
-        # trigger version property set
-        core.api.Plugin.initialize(self)
-        db_loader = self.get_plugin_loader().get_database_loader()
-        prev_ext = db_loader.set_property(self.get_name() + ":files", ','.join(self.files))
-        if prev_ext != ','.join(self.files):
-            self.is_updated = True
-
+        core.api.Plugin.initialize(self, properties=[
+            self.Property('files', ','.join(self.files))
+        ])
         self.get_plugin_loader().register_parser(self.files, self)
         
     def process(self, parent, data, is_updated):

+ 8 - 7
mainline/ext/std/code/length.py

@@ -22,18 +22,19 @@ import core.api
 class Plugin(core.api.Plugin, core.api.Child, core.api.IConfigurable):
     
     def declare_configuration(self, parser):
-        parser.add_option("--std.code.length.size", "--scls", action="store_true", default=False,
+        parser.add_option("--std.code.length.total", "--sclent", action="store_true", default=False,
                          help="Enables collection of size metric (in number of symbols per region) [default: %default]")
     
     def configure(self, options):
-        self.is_active = options.__dict__['std.code.length.size']
+        self.is_active = options.__dict__['std.code.length.total']
         
     def initialize(self):
+        fields = []
         if self.is_active == True:
-            # trigger version property set
-            core.api.Plugin.initialize(self)
-            namespace = self.get_plugin_loader().get_database_loader().create_namespace(self.get_name(), support_regions = True)
-            namespace.add_field('size', int)
+            fields.append(self.Field('total', int))
+        core.api.Plugin.initialize(self, fields=fields)
+        
+        if len(fields) != 0:
             core.api.subscribe_by_parents_interface(core.api.ICode, self, 'callback')
 
     def callback(self, parent, data, is_updated):
@@ -47,5 +48,5 @@ class Plugin(core.api.Plugin, core.api.Child, core.api.IConfigurable):
                     size += data.get_region(sub_id).get_offset_begin() - start_pos
                     start_pos = data.get_region(sub_id).get_offset_end()
                 size += region.get_offset_end() - start_pos
-                region.set_data(self.get_name(), 'size', size)
+                region.set_data(self.get_name(), 'total', size)
 

+ 26 - 0
mainline/ext/std/code/lines.ini

@@ -0,0 +1,26 @@
+;
+;    Metrix++, Copyright 2009-2013, Metrix++ Project
+;    Link: http://metrixplusplus.sourceforge.net
+;    
+;    This file is a part of Metrix++ Tool.
+;    
+;    Metrix++ is free software: you can redistribute it and/or modify
+;    it under the terms of the GNU General Public License as published by
+;    the Free Software Foundation, version 3 of the License.
+;    
+;    Metrix++ is distributed in the hope that it will be useful,
+;    but WITHOUT ANY WARRANTY; without even the implied warranty of
+;    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;    GNU General Public License for more details.
+;    
+;    You should have received a copy of the GNU General Public License
+;    along with Metrix++.  If not, see <http://www.gnu.org/licenses/>.
+;
+
+[Plugin]
+version: 1.1
+package: std.code
+module:  lines
+class:   Plugin
+depends: None
+enabled: True

+ 82 - 0
mainline/ext/std/code/lines.py

@@ -0,0 +1,82 @@
+#
+#    Metrix++, Copyright 2009-2013, Metrix++ Project
+#    Link: http://metrixplusplus.sourceforge.net
+#    
+#    This file is a part of Metrix++ Tool.
+#    
+#    Metrix++ is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, version 3 of the License.
+#    
+#    Metrix++ is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#    GNU General Public License for more details.
+#    
+#    You should have received a copy of the GNU General Public License
+#    along with Metrix++.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+import core.api
+
+class Plugin(core.api.Plugin, core.api.Child, core.api.IConfigurable):
+    
+    def declare_configuration(self, parser):
+        parser.add_option("--std.code.lines.code", "--sclc", action="store_true", default=False,
+                         help="Enables collection of lines of code metric - "
+                         "number of non-empty lines of code, excluding comments "
+                         "[default: %default]")
+        parser.add_option("--std.code.lines.preprocessor", "--sclp", action="store_true", default=False,
+                         help="Enables collection of lines of preprocessor code metric - "
+                         "number of non-empty lines of preprocessor code "
+                         "[default: %default]")
+        parser.add_option("--std.code.lines.comments", "--sclcom", action="store_true", default=False,
+                         help="Enables collection of lines of comments metric - "
+                         "number of non-empty lines of comments "
+                         "[default: %default]")
+        parser.add_option("--std.code.lines.blank", "--sclb", action="store_true", default=False,
+                         help="Enables collection of blank lines metric - "
+                         "number of blank lines, i.e. lines without code or comments "
+                         "[default: %default]")
+        parser.add_option("--std.code.lines.total", "--sclt", action="store_true", default=False,
+                         help="Enables collection of lines of comments metric - "
+                         "number of non-empty lines of comments "
+                         "[default: %default]")
+    
+    def configure(self, options):
+        self.is_active_code = options.__dict__['std.code.lines.code']
+        self.is_active_preprocessor = options.__dict__['std.code.lines.preprocessor']
+        self.is_active_comments = options.__dict__['std.code.lines.comments']
+        self.is_active_blank = options.__dict__['std.code.lines.blank']
+        self.is_active_total = options.__dict__['std.code.lines.total']
+        
+    def initialize(self):
+        fields = []
+        if self.is_active_code == True:
+            fields.append(self.Field('code', int))
+        if self.is_active_preprocessor == True:
+            fields.append(self.Field('preprocessor', int))
+        if self.is_active_comments == True:
+            fields.append(self.Field('comments', int))
+        if self.is_active_blank == True:
+            fields.append(self.Field('blank', int))
+        if self.is_active_total == True:
+            fields.append(self.Field('total', int))
+        core.api.Plugin.initialize(self, fields=fields)
+        
+        if len(fields) != 0:
+            core.api.subscribe_by_parents_interface(core.api.ICode, self, 'callback')
+
+    def callback(self, parent, data, is_updated):
+        is_updated = is_updated or self.is_updated
+        if is_updated == True:
+            for region in data.iterate_regions():
+                size = 0
+                start_pos = region.get_offset_begin()
+                for sub_id in region.iterate_subregion_ids():
+                    # exclude sub regions, like enclosed classes
+                    size += data.get_region(sub_id).get_offset_begin() - start_pos
+                    start_pos = data.get_region(sub_id).get_offset_end()
+                size += region.get_offset_end() - start_pos
+                region.set_data(self.get_name(), 'size', size)
+

+ 6 - 5
mainline/ext/std/suppress.py

@@ -37,12 +37,13 @@ class Plugin(core.api.Plugin, core.api.Child, core.api.IConfigurable):
         self.is_active = options.__dict__['std.suppress']
         
     def initialize(self):
+        fields = []
         if self.is_active == True:
-            # trigger version property set
-            core.api.Plugin.initialize(self)
-            namespace = self.get_plugin_loader().get_database_loader().create_namespace(self.get_name(), support_regions = True)
-            namespace.add_field('count', int, non_zero=True)
-            namespace.add_field('list', str)
+            fields.append(self.Field('count', int, non_zero=True))
+            fields.append(self.Field('list', str))
+        core.api.Plugin.initialize(self, fields=fields)
+        
+        if len(fields) != 0:
             core.api.subscribe_by_parents_interface(core.api.ICode, self, 'callback')
 
     # suppress pattern

+ 19 - 1
mainline/tests/general/test_basic/test_help_collect_default_stdout.gold.txt

@@ -44,9 +44,27 @@ Options:
   --std.code.java.files=STD.CODE.JAVA.FILES
                         Enumerates filename extensions to match Java files
                         [default: *.java]
-  --std.code.length.size, --scls
+  --std.code.length.total, --sclent
                         Enables collection of size metric (in number of
                         symbols per region) [default: False]
+  --std.code.lines.code, --sclc
+                        Enables collection of lines of code metric - number of
+                        non-empty lines of code, excluding comments [default:
+                        False]
+  --std.code.lines.preprocessor, --sclp
+                        Enables collection of lines of preprocessor code
+                        metric - number of non-empty lines of preprocessor
+                        code [default: False]
+  --std.code.lines.comments, --sclcom
+                        Enables collection of lines of comments metric -
+                        number of non-empty lines of comments [default: False]
+  --std.code.lines.blank, --sclb
+                        Enables collection of blank lines metric - number of
+                        blank lines, i.e. lines without code or comments
+                        [default: False]
+  --std.code.lines.total, --sclt
+                        Enables collection of lines of comments metric -
+                        number of non-empty lines of comments [default: False]
   --std.suppress, --ss  If set (True), suppression markers are collected from
                         comments in code. Suppressions are used by post-
                         processing tools, like limit, to remove false-positive

+ 0 - 1
mainline/tests/general/test_basic/test_workflow_info_default_stdout.gold.txt

@@ -1,6 +1,5 @@
 Properties:
 	version	=>	1.0
-	core.log:version	=>	1.0
 	std.code.complexity:version	=>	1.1
 	std.code.cpp:version	=>	1.1
 	std.code.cpp:files	=>	*.c,*.cc,*.cpp,*.cxx,*.h,*.hh,*.hpp,*.hxx

+ 0 - 1
mainline/tests/general/test_basic/test_workflow_info_second_stdout.gold.txt

@@ -1,6 +1,5 @@
 Properties:
 	version	=>	1.0
-	core.log:version	=>	1.0
 	std.code.complexity:version	=>	1.1
 	std.code.cpp:version	=>	1.1
 	std.code.cpp:files	=>	*.c,*.cc,*.cpp,*.cxx,*.h,*.hh,*.hpp,*.hxx

+ 4 - 5
mainline/tests/general/test_std_suppress.py

@@ -19,7 +19,6 @@
 
 
 import unittest
-import os
 
 import tests.common
 
@@ -29,7 +28,7 @@ class Test(tests.common.TestCase):
         
         runner = tests.common.ToolRunner('collect', ['--std.suppress',
                                                      '--std.code.complexity.cyclomatic',
-                                                     '--std.code.length.size'])
+                                                     '--std.code.length.total'])
         self.assertExec(runner.run())
 
         runner = tests.common.ToolRunner('limit',
@@ -45,19 +44,19 @@ class Test(tests.common.TestCase):
         self.assertExec(runner.run())
 
         runner = tests.common.ToolRunner('limit',
-                                         ['--max-limit=std.code.length:size:0'],
+                                         ['--max-limit=std.code.length:total:0'],
                                          exit_code=7,
                                          prefix='3')
         self.assertExec(runner.run())
 
         runner = tests.common.ToolRunner('limit',
-                                         ['--max-limit=std.code.length:size:0', '--disable-suppressions'],
+                                         ['--max-limit=std.code.length:total:0', '--disable-suppressions'],
                                          exit_code=24,
                                          prefix='4')
         self.assertExec(runner.run())
 
         runner = tests.common.ToolRunner('limit',
-                                         ['--max-limit=std.code.complexity:cyclomatic:0', '--max-limit=std.code.length:size:0'],
+                                         ['--max-limit=std.code.complexity:cyclomatic:0', '--max-limit=std.code.length:total:0'],
                                          exit_code=8,
                                          prefix='5')
         self.assertExec(runner.run())

+ 20 - 20
mainline/tests/general/test_std_suppress/sources/test.c

@@ -1,10 +1,10 @@
 /* comment here per global region
  *
- *	metrix++:	suppress std.code.length:size
+ *	metrix++:	suppress std.code.length:total
  */
 
 
-/*metrix++: suppress	std.code.length:size*/
+/*metrix++: suppress	std.code.length:total*/
 int func()
 {
 	/* comment here */
@@ -12,25 +12,25 @@ int func()
 
 int func2()
 {
-	/*metrix++: suppress std.code.length:size*/
+	/*metrix++: suppress std.code.length:total*/
 }
 
-/* metrix++: suppress std.code.length:size */
+/* metrix++: suppress std.code.length:total */
 int func3()
 {
-	/* metrix++: suppress std.code.length:size*/
+	/* metrix++: suppress std.code.length:total*/
 }
 
 
 /* bla-bla */
-/* metrix++: suppress std.code.length:size */
+/* metrix++: suppress std.code.length:total */
 /* bla-bla */
 int func4()
 {
-	/* metrix++: suppress std.code.length:size*/
+	/* metrix++: suppress std.code.length:total*/
 }
 
-/* metrix++: suppress std.code.length:size */
+/* metrix++: suppress std.code.length:total */
 struct cl1
 {
 
@@ -38,12 +38,12 @@ struct cl1
 
 struct cl2
 {
-	/* metrix++: suppress std.code.length:size*/
+	/* metrix++: suppress std.code.length:total*/
 
 };
 
 // bla-bla
-//metrix++: suppress std.code.length:size
+//metrix++: suppress std.code.length:total
 // bla-bla
 struct cl3
 {
@@ -64,9 +64,9 @@ int nu_suppress_func()
 
 struct cl2
 {
-	/* metrix++: suppress std.code.length:size per class */
+	/* metrix++: suppress std.code.length:total per class */
 
-	/* metrix++: suppress std.code.length:size per function */
+	/* metrix++: suppress std.code.length:total per function */
 	int func4()
 	{
 
@@ -91,21 +91,21 @@ struct suppresed_for_invalid_metric
 };
 
 /* metrix++: suppress invalid:metric */
-/* metrix++: suppress std.code.length:size */
+/* metrix++: suppress std.code.length:total */
 struct suppressed_for_size_and_invalid_metric
 {
 
 };
 
 /* metrix++: suppress invalid:metric */
-/* metrix++: suppress std.code.length:size */
+/* metrix++: suppress std.code.length:total */
 /* metrix++: suppress std.code.complexity:cyclomatic */
 int suppressed_for_size_and_complexity_and_invalid_metric()
 {
 	if (1) return;
 }
 
-// metrix++: suppress std.code.length:size asdas
+// metrix++: suppress std.code.length:total asdas
 // metrix++: suppress std.code.complexity:cyclomatic adsad
 int func7()
 {
@@ -118,13 +118,13 @@ int nu_suppress_for_size()
 	if (1) return;
 }
 
-// metrix++: suppress std.code.length:size adsad
+// metrix++: suppress std.code.length:total adsad
 int no_suppress_for_cyclomatic_complexity()
 {
 	if (1) return;
 }
 
-// metrix++: suppress std.code.length:size long-long
+// metrix++: suppress std.code.length:total long-long
 // description why it was suppressed
 // metrix++: suppress std.code.complexity:cyclomatic
 int func8()
@@ -132,7 +132,7 @@ int func8()
 	if (1) return;
 }
 
-/* metrix++: suppress std.code.length:size long-long */
+/* metrix++: suppress std.code.length:total long-long */
 /* description why it was suppressed */
 /* metrix++: suppress std.code.complexity:cyclomatic */
 int func9()
@@ -143,12 +143,12 @@ int func9()
 // metrix++: suppress std.code.complexity:cyclomatic adsad
 int bad_suppress_for_size()
 {
-	// metrix++: suppress std.code.length:size
+	// metrix++: suppress std.code.length:total
 
 	if (1) return;
 }
 
-/* metrix++: suppress std.code.length:size long-long
+/* metrix++: suppress std.code.length:total long-long
  * description why it was suppressed
  * metrix++: suppress std.code.complexity:cyclomatic */
 int func10()

+ 15 - 15
mainline/tests/general/test_std_suppress/test_basic_limit_3_stdout.gold.txt

@@ -1,5 +1,5 @@
-./test.c:54: warning: Metric 'std.code.length:size' for region 'no_suppress_cl' exceeds the limit.
-	Metric name    : std.code.length:size
+./test.c:54: warning: Metric 'std.code.length:total' for region 'no_suppress_cl' exceeds the limit.
+	Metric name    : std.code.length:total
 	Region name    : no_suppress_cl
 	Metric value   : 44
 	Modified       : None
@@ -7,8 +7,8 @@
 	Limit          : 0.0
 	Suppressed     : False
 
-./test.c:60: warning: Metric 'std.code.length:size' for region 'nu_suppress_func' exceeds the limit.
-	Metric name    : std.code.length:size
+./test.c:60: warning: Metric 'std.code.length:total' for region 'nu_suppress_func' exceeds the limit.
+	Metric name    : std.code.length:total
 	Region name    : nu_suppress_func
 	Metric value   : 63
 	Modified       : None
@@ -16,8 +16,8 @@
 	Limit          : 0.0
 	Suppressed     : False
 
-./test.c:75: warning: Metric 'std.code.length:size' for region 'func_no_suppress_within_struct' exceeds the limit.
-	Metric name    : std.code.length:size
+./test.c:75: warning: Metric 'std.code.length:total' for region 'func_no_suppress_within_struct' exceeds the limit.
+	Metric name    : std.code.length:total
 	Region name    : func_no_suppress_within_struct
 	Metric value   : 43
 	Modified       : None
@@ -25,8 +25,8 @@
 	Limit          : 0.0
 	Suppressed     : False
 
-./test.c:82: warning: Metric 'std.code.length:size' for region 'suppresed_for_invalid_metric' exceeds the limit.
-	Metric name    : std.code.length:size
+./test.c:82: warning: Metric 'std.code.length:total' for region 'suppresed_for_invalid_metric' exceeds the limit.
+	Metric name    : std.code.length:total
 	Region name    : suppresed_for_invalid_metric
 	Metric value   : 80
 	Modified       : None
@@ -34,8 +34,8 @@
 	Limit          : 0.0
 	Suppressed     : False
 
-./test.c:88: warning: Metric 'std.code.length:size' for region 'suppresed_for_invalid_metric' exceeds the limit.
-	Metric name    : std.code.length:size
+./test.c:88: warning: Metric 'std.code.length:total' for region 'suppresed_for_invalid_metric' exceeds the limit.
+	Metric name    : std.code.length:total
 	Region name    : suppresed_for_invalid_metric
 	Metric value   : 96
 	Modified       : None
@@ -43,8 +43,8 @@
 	Limit          : 0.0
 	Suppressed     : False
 
-./test.c:116: warning: Metric 'std.code.length:size' for region 'nu_suppress_for_size' exceeds the limit.
-	Metric name    : std.code.length:size
+./test.c:116: warning: Metric 'std.code.length:total' for region 'nu_suppress_for_size' exceeds the limit.
+	Metric name    : std.code.length:total
 	Region name    : nu_suppress_for_size
 	Metric value   : 105
 	Modified       : None
@@ -52,10 +52,10 @@
 	Limit          : 0.0
 	Suppressed     : False
 
-./test.c:144: warning: Metric 'std.code.length:size' for region 'bad_suppress_for_size' exceeds the limit.
-	Metric name    : std.code.length:size
+./test.c:144: warning: Metric 'std.code.length:total' for region 'bad_suppress_for_size' exceeds the limit.
+	Metric name    : std.code.length:total
 	Region name    : bad_suppress_for_size
-	Metric value   : 151
+	Metric value   : 152
 	Modified       : None
 	Change trend   : None
 	Limit          : 0.0

+ 66 - 66
mainline/tests/general/test_std_suppress/test_basic_limit_4_stdout.gold.txt

@@ -1,77 +1,77 @@
-./test.c:0: warning: Metric 'std.code.length:size' for region '__global__' exceeds the limit.
-	Metric name    : std.code.length:size
+./test.c:0: warning: Metric 'std.code.length:total' for region '__global__' exceeds the limit.
+	Metric name    : std.code.length:total
 	Region name    : __global__
-	Metric value   : 138
+	Metric value   : 139
 	Modified       : None
 	Change trend   : None
 	Limit          : 0.0
 	Suppressed     : True
 
-./test.c:8: warning: Metric 'std.code.length:size' for region 'func' exceeds the limit.
-	Metric name    : std.code.length:size
+./test.c:8: warning: Metric 'std.code.length:total' for region 'func' exceeds the limit.
+	Metric name    : std.code.length:total
 	Region name    : func
-	Metric value   : 78
+	Metric value   : 79
 	Modified       : None
 	Change trend   : None
 	Limit          : 0.0
 	Suppressed     : True
 
-./test.c:13: warning: Metric 'std.code.length:size' for region 'func2' exceeds the limit.
-	Metric name    : std.code.length:size
+./test.c:13: warning: Metric 'std.code.length:total' for region 'func2' exceeds the limit.
+	Metric name    : std.code.length:total
 	Region name    : func2
-	Metric value   : 60
+	Metric value   : 61
 	Modified       : None
 	Change trend   : None
 	Limit          : 0.0
 	Suppressed     : True
 
-./test.c:19: warning: Metric 'std.code.length:size' for region 'func3' exceeds the limit.
-	Metric name    : std.code.length:size
+./test.c:19: warning: Metric 'std.code.length:total' for region 'func3' exceeds the limit.
+	Metric name    : std.code.length:total
 	Region name    : func3
-	Metric value   : 107
+	Metric value   : 109
 	Modified       : None
 	Change trend   : None
 	Limit          : 0.0
 	Suppressed     : True
 
-./test.c:28: warning: Metric 'std.code.length:size' for region 'func4' exceeds the limit.
-	Metric name    : std.code.length:size
+./test.c:28: warning: Metric 'std.code.length:total' for region 'func4' exceeds the limit.
+	Metric name    : std.code.length:total
 	Region name    : func4
-	Metric value   : 135
+	Metric value   : 137
 	Modified       : None
 	Change trend   : None
 	Limit          : 0.0
 	Suppressed     : True
 
-./test.c:34: warning: Metric 'std.code.length:size' for region 'cl1' exceeds the limit.
-	Metric name    : std.code.length:size
+./test.c:34: warning: Metric 'std.code.length:total' for region 'cl1' exceeds the limit.
+	Metric name    : std.code.length:total
 	Region name    : cl1
-	Metric value   : 61
+	Metric value   : 62
 	Modified       : None
 	Change trend   : None
 	Limit          : 0.0
 	Suppressed     : True
 
-./test.c:39: warning: Metric 'std.code.length:size' for region 'cl2' exceeds the limit.
-	Metric name    : std.code.length:size
+./test.c:39: warning: Metric 'std.code.length:total' for region 'cl2' exceeds the limit.
+	Metric name    : std.code.length:total
 	Region name    : cl2
-	Metric value   : 61
+	Metric value   : 62
 	Modified       : None
 	Change trend   : None
 	Limit          : 0.0
 	Suppressed     : True
 
-./test.c:48: warning: Metric 'std.code.length:size' for region 'cl3' exceeds the limit.
-	Metric name    : std.code.length:size
+./test.c:48: warning: Metric 'std.code.length:total' for region 'cl3' exceeds the limit.
+	Metric name    : std.code.length:total
 	Region name    : cl3
-	Metric value   : 79
+	Metric value   : 80
 	Modified       : None
 	Change trend   : None
 	Limit          : 0.0
 	Suppressed     : True
 
-./test.c:54: warning: Metric 'std.code.length:size' for region 'no_suppress_cl' exceeds the limit.
-	Metric name    : std.code.length:size
+./test.c:54: warning: Metric 'std.code.length:total' for region 'no_suppress_cl' exceeds the limit.
+	Metric name    : std.code.length:total
 	Region name    : no_suppress_cl
 	Metric value   : 44
 	Modified       : None
@@ -79,8 +79,8 @@
 	Limit          : 0.0
 	Suppressed     : False
 
-./test.c:60: warning: Metric 'std.code.length:size' for region 'nu_suppress_func' exceeds the limit.
-	Metric name    : std.code.length:size
+./test.c:60: warning: Metric 'std.code.length:total' for region 'nu_suppress_func' exceeds the limit.
+	Metric name    : std.code.length:total
 	Region name    : nu_suppress_func
 	Metric value   : 63
 	Modified       : None
@@ -88,26 +88,26 @@
 	Limit          : 0.0
 	Suppressed     : False
 
-./test.c:65: warning: Metric 'std.code.length:size' for region 'cl2' exceeds the limit.
-	Metric name    : std.code.length:size
+./test.c:65: warning: Metric 'std.code.length:total' for region 'cl2' exceeds the limit.
+	Metric name    : std.code.length:total
 	Region name    : cl2
-	Metric value   : 77
+	Metric value   : 78
 	Modified       : None
 	Change trend   : None
 	Limit          : 0.0
 	Suppressed     : True
 
-./test.c:70: warning: Metric 'std.code.length:size' for region 'func4' exceeds the limit.
-	Metric name    : std.code.length:size
+./test.c:70: warning: Metric 'std.code.length:total' for region 'func4' exceeds the limit.
+	Metric name    : std.code.length:total
 	Region name    : func4
-	Metric value   : 78
+	Metric value   : 79
 	Modified       : None
 	Change trend   : None
 	Limit          : 0.0
 	Suppressed     : True
 
-./test.c:75: warning: Metric 'std.code.length:size' for region 'func_no_suppress_within_struct' exceeds the limit.
-	Metric name    : std.code.length:size
+./test.c:75: warning: Metric 'std.code.length:total' for region 'func_no_suppress_within_struct' exceeds the limit.
+	Metric name    : std.code.length:total
 	Region name    : func_no_suppress_within_struct
 	Metric value   : 43
 	Modified       : None
@@ -115,8 +115,8 @@
 	Limit          : 0.0
 	Suppressed     : False
 
-./test.c:82: warning: Metric 'std.code.length:size' for region 'suppresed_for_invalid_metric' exceeds the limit.
-	Metric name    : std.code.length:size
+./test.c:82: warning: Metric 'std.code.length:total' for region 'suppresed_for_invalid_metric' exceeds the limit.
+	Metric name    : std.code.length:total
 	Region name    : suppresed_for_invalid_metric
 	Metric value   : 80
 	Modified       : None
@@ -124,8 +124,8 @@
 	Limit          : 0.0
 	Suppressed     : False
 
-./test.c:88: warning: Metric 'std.code.length:size' for region 'suppresed_for_invalid_metric' exceeds the limit.
-	Metric name    : std.code.length:size
+./test.c:88: warning: Metric 'std.code.length:total' for region 'suppresed_for_invalid_metric' exceeds the limit.
+	Metric name    : std.code.length:total
 	Region name    : suppresed_for_invalid_metric
 	Metric value   : 96
 	Modified       : None
@@ -133,35 +133,35 @@
 	Limit          : 0.0
 	Suppressed     : False
 
-./test.c:95: warning: Metric 'std.code.length:size' for region 'suppressed_for_size_and_invalid_metric' exceeds the limit.
-	Metric name    : std.code.length:size
+./test.c:95: warning: Metric 'std.code.length:total' for region 'suppressed_for_size_and_invalid_metric' exceeds the limit.
+	Metric name    : std.code.length:total
 	Region name    : suppressed_for_size_and_invalid_metric
-	Metric value   : 136
+	Metric value   : 137
 	Modified       : None
 	Change trend   : None
 	Limit          : 0.0
 	Suppressed     : True
 
-./test.c:103: warning: Metric 'std.code.length:size' for region 'suppressed_for_size_and_complexity_and_invalid_metric' exceeds the limit.
-	Metric name    : std.code.length:size
+./test.c:103: warning: Metric 'std.code.length:total' for region 'suppressed_for_size_and_complexity_and_invalid_metric' exceeds the limit.
+	Metric name    : std.code.length:total
 	Region name    : suppressed_for_size_and_complexity_and_invalid_metric
-	Metric value   : 221
+	Metric value   : 222
 	Modified       : None
 	Change trend   : None
 	Limit          : 0.0
 	Suppressed     : True
 
-./test.c:110: warning: Metric 'std.code.length:size' for region 'func7' exceeds the limit.
-	Metric name    : std.code.length:size
+./test.c:110: warning: Metric 'std.code.length:total' for region 'func7' exceeds the limit.
+	Metric name    : std.code.length:total
 	Region name    : func7
-	Metric value   : 139
+	Metric value   : 140
 	Modified       : None
 	Change trend   : None
 	Limit          : 0.0
 	Suppressed     : True
 
-./test.c:116: warning: Metric 'std.code.length:size' for region 'nu_suppress_for_size' exceeds the limit.
-	Metric name    : std.code.length:size
+./test.c:116: warning: Metric 'std.code.length:total' for region 'nu_suppress_for_size' exceeds the limit.
+	Metric name    : std.code.length:total
 	Region name    : nu_suppress_for_size
 	Metric value   : 105
 	Modified       : None
@@ -169,46 +169,46 @@
 	Limit          : 0.0
 	Suppressed     : False
 
-./test.c:122: warning: Metric 'std.code.length:size' for region 'no_suppress_for_cyclomatic_complexity' exceeds the limit.
-	Metric name    : std.code.length:size
+./test.c:122: warning: Metric 'std.code.length:total' for region 'no_suppress_for_cyclomatic_complexity' exceeds the limit.
+	Metric name    : std.code.length:total
 	Region name    : no_suppress_for_cyclomatic_complexity
-	Metric value   : 112
+	Metric value   : 113
 	Modified       : None
 	Change trend   : None
 	Limit          : 0.0
 	Suppressed     : True
 
-./test.c:130: warning: Metric 'std.code.length:size' for region 'func8' exceeds the limit.
-	Metric name    : std.code.length:size
+./test.c:130: warning: Metric 'std.code.length:total' for region 'func8' exceeds the limit.
+	Metric name    : std.code.length:total
 	Region name    : func8
-	Metric value   : 174
+	Metric value   : 175
 	Modified       : None
 	Change trend   : None
 	Limit          : 0.0
 	Suppressed     : True
 
-./test.c:138: warning: Metric 'std.code.length:size' for region 'func9' exceeds the limit.
-	Metric name    : std.code.length:size
+./test.c:138: warning: Metric 'std.code.length:total' for region 'func9' exceeds the limit.
+	Metric name    : std.code.length:total
 	Region name    : func9
-	Metric value   : 183
+	Metric value   : 184
 	Modified       : None
 	Change trend   : None
 	Limit          : 0.0
 	Suppressed     : True
 
-./test.c:144: warning: Metric 'std.code.length:size' for region 'bad_suppress_for_size' exceeds the limit.
-	Metric name    : std.code.length:size
+./test.c:144: warning: Metric 'std.code.length:total' for region 'bad_suppress_for_size' exceeds the limit.
+	Metric name    : std.code.length:total
 	Region name    : bad_suppress_for_size
-	Metric value   : 151
+	Metric value   : 152
 	Modified       : None
 	Change trend   : None
 	Limit          : 0.0
 	Suppressed     : False
 
-./test.c:154: warning: Metric 'std.code.length:size' for region 'func10' exceeds the limit.
-	Metric name    : std.code.length:size
+./test.c:154: warning: Metric 'std.code.length:total' for region 'func10' exceeds the limit.
+	Metric name    : std.code.length:total
 	Region name    : func10
-	Metric value   : 178
+	Metric value   : 179
 	Modified       : None
 	Change trend   : None
 	Limit          : 0.0

+ 15 - 15
mainline/tests/general/test_std_suppress/test_basic_limit_5_stdout.gold.txt

@@ -7,8 +7,8 @@
 	Limit          : 0.0
 	Suppressed     : False
 
-./test.c:54: warning: Metric 'std.code.length:size' for region 'no_suppress_cl' exceeds the limit.
-	Metric name    : std.code.length:size
+./test.c:54: warning: Metric 'std.code.length:total' for region 'no_suppress_cl' exceeds the limit.
+	Metric name    : std.code.length:total
 	Region name    : no_suppress_cl
 	Metric value   : 44
 	Modified       : None
@@ -16,8 +16,8 @@
 	Limit          : 0.0
 	Suppressed     : False
 
-./test.c:60: warning: Metric 'std.code.length:size' for region 'nu_suppress_func' exceeds the limit.
-	Metric name    : std.code.length:size
+./test.c:60: warning: Metric 'std.code.length:total' for region 'nu_suppress_func' exceeds the limit.
+	Metric name    : std.code.length:total
 	Region name    : nu_suppress_func
 	Metric value   : 63
 	Modified       : None
@@ -25,8 +25,8 @@
 	Limit          : 0.0
 	Suppressed     : False
 
-./test.c:75: warning: Metric 'std.code.length:size' for region 'func_no_suppress_within_struct' exceeds the limit.
-	Metric name    : std.code.length:size
+./test.c:75: warning: Metric 'std.code.length:total' for region 'func_no_suppress_within_struct' exceeds the limit.
+	Metric name    : std.code.length:total
 	Region name    : func_no_suppress_within_struct
 	Metric value   : 43
 	Modified       : None
@@ -34,8 +34,8 @@
 	Limit          : 0.0
 	Suppressed     : False
 
-./test.c:82: warning: Metric 'std.code.length:size' for region 'suppresed_for_invalid_metric' exceeds the limit.
-	Metric name    : std.code.length:size
+./test.c:82: warning: Metric 'std.code.length:total' for region 'suppresed_for_invalid_metric' exceeds the limit.
+	Metric name    : std.code.length:total
 	Region name    : suppresed_for_invalid_metric
 	Metric value   : 80
 	Modified       : None
@@ -43,8 +43,8 @@
 	Limit          : 0.0
 	Suppressed     : False
 
-./test.c:88: warning: Metric 'std.code.length:size' for region 'suppresed_for_invalid_metric' exceeds the limit.
-	Metric name    : std.code.length:size
+./test.c:88: warning: Metric 'std.code.length:total' for region 'suppresed_for_invalid_metric' exceeds the limit.
+	Metric name    : std.code.length:total
 	Region name    : suppresed_for_invalid_metric
 	Metric value   : 96
 	Modified       : None
@@ -52,8 +52,8 @@
 	Limit          : 0.0
 	Suppressed     : False
 
-./test.c:116: warning: Metric 'std.code.length:size' for region 'nu_suppress_for_size' exceeds the limit.
-	Metric name    : std.code.length:size
+./test.c:116: warning: Metric 'std.code.length:total' for region 'nu_suppress_for_size' exceeds the limit.
+	Metric name    : std.code.length:total
 	Region name    : nu_suppress_for_size
 	Metric value   : 105
 	Modified       : None
@@ -61,10 +61,10 @@
 	Limit          : 0.0
 	Suppressed     : False
 
-./test.c:144: warning: Metric 'std.code.length:size' for region 'bad_suppress_for_size' exceeds the limit.
-	Metric name    : std.code.length:size
+./test.c:144: warning: Metric 'std.code.length:total' for region 'bad_suppress_for_size' exceeds the limit.
+	Metric name    : std.code.length:total
 	Region name    : bad_suppress_for_size
-	Metric value   : 151
+	Metric value   : 152
 	Modified       : None
 	Change trend   : None
 	Limit          : 0.0