Browse Source

Improved usability of options.

avkonst 11 năm trước cách đây
mục cha
commit
e9eea05b8a

+ 4 - 4
mainline/core/db/post.py

@@ -25,17 +25,17 @@ import re
 class Plugin(core.api.Plugin, core.api.IConfigurable):
     
     def declare_configuration(self, parser):
-        parser.add_option("--general.db-file", default='./metrixpp.db',
+        parser.add_option("--db-file", "--dbf", default='./metrixpp.db',
                          help="Primary database file to write (by the collector) and post-process (by other tools) [default: %default]")
-        parser.add_option("--general.db-file-prev", default=None,
+        parser.add_option("--db-file-prev", "--dbfp", default=None,
                          help="Database file with data collected for the past/previous revision."
                              " If it is set for the collector tool to perform an incremental/iterative collection,"
                              " it may reduce the processing time significantly."
                              " Post-processing tools use it in order to recognise/evaluate change trends. [default: %default].")
     
     def configure(self, options):
-        self.dbfile = options.__dict__['general.db_file']
-        self.dbfile_prev = options.__dict__['general.db_file_prev']
+        self.dbfile = options.__dict__['db_file']
+        self.dbfile_prev = options.__dict__['db_file_prev']
         
     def initialize(self):
         

+ 15 - 15
mainline/core/dir.py

@@ -32,26 +32,26 @@ class Plugin(core.api.Plugin, core.api.Parent, core.api.IConfigurable, core.api.
         self.exclude_rules = []
     
     def declare_configuration(self, parser):
-        parser.add_option("--general.non-recursively", action="store_true", default=False,
+        parser.add_option("--non-recursively", "--nr", action="store_true", default=False,
                          help="If the option is set (True), sub-directories are not processed [default: %default]")
-        parser.add_option("--general.exclude-files", default=r'^[.]',
+        parser.add_option("--exclude-files", "--ef", default=r'^[.]',
                          help="Defines the pattern to exclude files from processing [default: %default]")
-        parser.add_option("--general.proctime-on", action="store_true", default=False,
+        parser.add_option("--std.general.proctime", "--sgpt", action="store_true", default=False,
                          help="If the option is set (True), the tool measures processing time per file [default: %default]")
-        parser.add_option("--general.procerrors-on", action="store_true", default=False,
+        parser.add_option("--std.general.procerrors", "--sgpe", action="store_true", default=False,
                          help="If the option is set (True), the tool counts number of processing/parsing errors per file [default: %default]")
-        parser.add_option("--general.size-on", action="store_true", default=False,
+        parser.add_option("--std.general.size", "--sgs", action="store_true", default=False,
                          help="If the option is set (True), the tool collects file size metric (in bytes) [default: %default]")
     
     def configure(self, options):
-        self.non_recursively = options.__dict__['general.non_recursively']
-        self.add_exclude_rule(re.compile(options.__dict__['general.exclude_files']))
-        self.is_proctime_enabled = options.__dict__['general.proctime_on']
-        self.is_procerrors_enabled = options.__dict__['general.procerrors_on']
-        self.is_size_enabled = options.__dict__['general.size_on']
+        self.non_recursively = options.__dict__['non_recursively']
+        self.add_exclude_rule(re.compile(options.__dict__['exclude_files']))
+        self.is_proctime_enabled = options.__dict__['std.general.proctime']
+        self.is_procerrors_enabled = options.__dict__['std.general.procerrors']
+        self.is_size_enabled = options.__dict__['std.general.size']
 
     def initialize(self):
-        namespace = self.get_plugin_loader().get_database_loader().create_namespace('general')
+        namespace = self.get_plugin_loader().get_database_loader().create_namespace('std.general')
         if self.is_proctime_enabled == True:
             namespace.add_field('proctime', float)
         if self.is_procerrors_enabled == True:
@@ -67,7 +67,7 @@ class Plugin(core.api.Plugin, core.api.Parent, core.api.IConfigurable, core.api.
         
     def add_exclude_rule(self, re_compiled_pattern):
         # TODO file name may have special regexp symbols what causes an exception
-        # For example try to run a collection with "--general.db-file=metrix++" option
+        # For example try to run a collection with "--db-file=metrix++" option
         self.exclude_rules.append(re_compiled_pattern)
         
     def is_file_excluded(self, file_name):
@@ -104,11 +104,11 @@ class DirectoryReader():
                             (data, is_updated) = plugin.get_plugin_loader().get_database_loader().create_file_data(full_path, checksum, text)
                             procerrors = parser.process(plugin, data, is_updated)
                             if plugin.is_proctime_enabled == True:
-                                data.set_data('general', 'proctime', time.time() - ts)
+                                data.set_data('std.general', 'proctime', time.time() - ts)
                             if plugin.is_procerrors_enabled == True and procerrors != None and procerrors != 0:
-                                data.set_data('general', 'procerrors', procerrors)
+                                data.set_data('std.general', 'procerrors', procerrors)
                             if plugin.is_size_enabled == True:
-                                data.set_data('general', 'size', len(text))
+                                data.set_data('std.general', 'size', len(text))
                             plugin.get_plugin_loader().get_database_loader().save_file_data(data)
                             logging.debug("-" * 60)
                             exit_code += procerrors

+ 7 - 7
mainline/core/log.py

@@ -28,27 +28,27 @@ class Plugin(core.api.Plugin, core.api.IConfigurable):
         default_value_cur = default_value
         if os.environ.has_key('METRIXPLUSPLUS_LOG_LEVEL') and os.environ['METRIXPLUSPLUS_LOG_LEVEL'] in allowed_values:
             default_value_cur = os.environ['METRIXPLUSPLUS_LOG_LEVEL']
-        parser.add_option("--general.log-level", default=default_value_cur, choices=allowed_values,
+        parser.add_option("--log-level", "--ll", default=default_value_cur, choices=allowed_values,
                          help="Defines log level. Possible values are 'DEBUG','INFO','WARNING' or 'ERROR'. "
                          "Default value is inherited from environment variable 'METRIXPLUSPLUS_LOG_LEVEL' if set. "
                          "[default: " + default_value + "]")
     
     def configure(self, options):
-        if options.__dict__['general.log_level'] == 'ERROR':
+        if options.__dict__['log_level'] == 'ERROR':
             log_level = logging.ERROR
-        elif options.__dict__['general.log_level'] == 'WARNING':
+        elif options.__dict__['log_level'] == 'WARNING':
             log_level = logging.WARNING
-        elif options.__dict__['general.log_level'] == 'INFO':
+        elif options.__dict__['log_level'] == 'INFO':
             log_level = logging.INFO
-        elif options.__dict__['general.log_level'] == 'DEBUG':
+        elif options.__dict__['log_level'] == 'DEBUG':
             log_level = logging.DEBUG
         else:
             raise AssertionError("Unhandled choice of log level")
         
         self.level = log_level
         logging.getLogger().setLevel(self.level)
-        os.environ['METRIXPLUSPLUS_LOG_LEVEL'] = options.__dict__['general.log_level']
-        logging.warn("Logging enabled with " + options.__dict__['general.log_level'] + " level")
+        os.environ['METRIXPLUSPLUS_LOG_LEVEL'] = options.__dict__['log_level']
+        logging.warn("Logging enabled with " + options.__dict__['log_level'] + " level")
 
 
 

+ 15 - 15
mainline/core/warn.py

@@ -31,7 +31,7 @@ class Plugin(core.api.Plugin, core.api.IConfigurable):
     
     def declare_configuration(self, parser):
         self.parser = parser
-        parser.add_option("--general.warn", default='all', choices=['new', 'trend', 'touched', 'all'],
+        parser.add_option("--warn-mode", "--wm", default='all', choices=['new', 'trend', 'touched', 'all'],
                          help="Defines the warnings mode. "
                          "'new' - warnings for new regions only, "
                          "'trend' - warnings for new regions and for bad trend of modified regions, "
@@ -39,13 +39,13 @@ class Plugin(core.api.Plugin, core.api.IConfigurable):
                          "'all' - all warnings active "
                          "[default: %default]")
 
-        parser.add_option("--general.min-limit", action="multiopt",
+        parser.add_option("--min-limit", "--min", action="multiopt",
                           help="A threshold per 'namespace:field' metric in order to select regions, "
                           "which have got metric value less than the specified limit. "
                           "This option can be specified multiple times, if it is necessary to apply several limits. "
                           "Should be in the format: <namespace>:<field>:<limit-value>, for example: "
                           "'std.code.complexity:cyclomatic:7'.") # TODO think about better example
-        parser.add_option("--general.max-limit", action="multiopt",
+        parser.add_option("--max-limit", "--max", action="multiopt",
                           help="A threshold per 'namespace:field' metric in order to select regions, "
                           "which have got metric value more than the specified limit. "
                           "This option can be specified multiple times, if it is necessary to apply several limits. "
@@ -53,17 +53,17 @@ class Plugin(core.api.Plugin, core.api.IConfigurable):
                           "'std.code.complexity:cyclomatic:7'.")
         
     def configure(self, options):
-        if options.__dict__['general.warn'] == 'new':
+        if options.__dict__['warn_mode'] == 'new':
             self.mode = self.MODE_NEW
-        elif options.__dict__['general.warn'] == 'trend':
+        elif options.__dict__['warn_mode'] == 'trend':
             self.mode = self.MODE_TREND
-        elif options.__dict__['general.warn'] == 'touched':
+        elif options.__dict__['warn_mode'] == 'touched':
             self.mode = self.MODE_TOUCHED
-        elif options.__dict__['general.warn'] == 'all':
+        elif options.__dict__['warn_mode'] == 'all':
             self.mode = self.MODE_ALL
             
-        if self.mode != self.MODE_ALL and options.__dict__['general.db_file_prev'] == None:
-            self.parser.error("The mode '" + options.__dict__['general.warn'] + "' for 'general.warn' option requires 'general.db-file-prev' option set")
+        if self.mode != self.MODE_ALL and options.__dict__['db_file_prev'] == None:
+            self.parser.error("The mode '" + options.__dict__['warn_mode'] + "' for 'general.warn' option requires '--db-file-prev' option set")
 
         class Limit(object):
             def __init__(self, limit_type, limit, namespace, field, db_filter):
@@ -78,18 +78,18 @@ class Plugin(core.api.Plugin, core.api.IConfigurable):
         
         self.limits = []
         pattern = re.compile(r'''([^:]+)[:]([^:]+)[:]([-+]?[0-9]+(?:[.][0-9]+)?)''')
-        if options.__dict__['general.max_limit'] != None:
-            for each in options.__dict__['general.max_limit']:
+        if options.__dict__['max_limit'] != None:
+            for each in options.__dict__['max_limit']:
                 match = re.match(pattern, each)
                 if match == None:
-                    self.parser.error("Invalid format of the 'general.max-limit' option: " + each)
+                    self.parser.error("Invalid format of the '--max-limit' option: " + each)
                 limit = Limit("max", float(match.group(3)), match.group(1), match.group(2), (match.group(2), '>', float(match.group(3))))
                 self.limits.append(limit)
-        if options.__dict__['general.min_limit'] != None:
-            for each in options.__dict__['general.min_limit']:  
+        if options.__dict__['min_limit'] != None:
+            for each in options.__dict__['min_limit']:  
                 match = re.match(pattern, each)
                 if match == None:
-                    self.parser.error("Invalid format of the 'general.min-limit' option: " + each)
+                    self.parser.error("Invalid format of the '--min-limit' option: " + each)
                 limit = Limit("min", float(match.group(3)), match.group(1), match.group(2), (match.group(2), '<', float(match.group(3))))
                 self.limits.append(limit)
                 

+ 3 - 3
mainline/ext/std/code/complexity.py

@@ -24,11 +24,11 @@ import re
 class Plugin(core.api.Plugin, core.api.Child, core.api.IConfigurable):
     
     def declare_configuration(self, parser):
-        parser.add_option("--std.code.complexity.on", action="store_true", default=False,
-                         help="Enables collection of complexity metrics: cyclomatic by McCabe [default: %default]")
+        parser.add_option("--std.code.complexity.cyclomatic", "--sccc", action="store_true", default=False,
+                         help="Enables collection of cyclomatic complexity metric (McCabe) [default: %default]")
     
     def configure(self, options):
-        self.is_active = options.__dict__['std.code.complexity.on']
+        self.is_active = options.__dict__['std.code.complexity.cyclomatic']
         
     def initialize(self):
         if self.is_active == True:

+ 2 - 2
mainline/tests/common.py

@@ -64,9 +64,9 @@ class ToolRunner(object):
 
         self.cwd = cwd
 
-        db_opts = ['--general.db-file=' + db_file]
+        db_opts = ['--db-file=' + db_file]
         if use_prev == True:
-            db_opts.append('--general.db-file-prev=' + db_file_prev)
+            db_opts.append('--db-file-prev=' + db_file_prev)
         self.dbopts = db_opts
         
         self.dirs_list = [] 

+ 39 - 33
mainline/tests/general/test_basic.py

@@ -28,34 +28,34 @@ class Test(tests.common.TestCase):
         
         # first collection
         runner = tests.common.ToolRunner('collect',
-                                         ['--std.code.complexity.on',
-                                          '--general.log-level=INFO'],
+                                         ['--std.code.complexity.cyclomatic',
+                                          '--log-level=INFO'],
                                          check_stderr=[(0, -1)],
                                          save_prev=True)
         self.assertExec(runner.run())
 
         runner = tests.common.ToolRunner('view',
-                                         ['--general.log-level=INFO', '--general.format=xml'],
+                                         ['--log-level=INFO', '--format=xml'],
                                          check_stderr=[(0, -1)])
         self.assertExec(runner.run())
 
         runner = tests.common.ToolRunner('limit',
-                                         ['--general.log-level=INFO',
-                                          '--general.max-limit=std.code.complexity:cyclomatic:0'],
+                                         ['--log-level=INFO',
+                                          '--max-limit=std.code.complexity:cyclomatic:0'],
                                          check_stderr=[(0, -1)],
                                          exit_code=4)
         self.assertExec(runner.run())
 
         runner = tests.common.ToolRunner('info',
-                                         ['--general.log-level=INFO'],
+                                         ['--log-level=INFO'],
                                          check_stderr=[(0, -1)],
                                          exit_code=0)
         self.assertExec(runner.run())
 
         # second collection
         runner = tests.common.ToolRunner('collect',
-                                         ['--std.code.complexity.on',
-                                          '--general.log-level=INFO'],
+                                         ['--std.code.complexity.cyclomatic',
+                                          '--log-level=INFO'],
                                          check_stderr=[(0, -1)],
                                          prefix='second',
                                          cwd="sources_changed",
@@ -63,14 +63,14 @@ class Test(tests.common.TestCase):
         self.assertExec(runner.run())
 
         runner = tests.common.ToolRunner('view',
-                                         ['--general.log-level=INFO', '--general.format=xml'],
+                                         ['--log-level=INFO', '--format=xml'],
                                          check_stderr=[(0, -1)],
                                          prefix='second',
                                          use_prev=True)
         self.assertExec(runner.run())
 
         runner = tests.common.ToolRunner('view',
-                                         ['--general.log-level=INFO', '--general.format=xml'],
+                                         ['--log-level=INFO', '--format=xml'],
                                          check_stderr=[(0, -1)],
                                          prefix='second_per_file',
                                          dirs_list=['./simple.cpp'],
@@ -78,8 +78,8 @@ class Test(tests.common.TestCase):
         self.assertExec(runner.run())
 
         runner = tests.common.ToolRunner('limit',
-                                         ['--general.log-level=INFO',
-                                          '--general.max-limit=std.code.complexity:cyclomatic:0'],
+                                         ['--log-level=INFO',
+                                          '--max-limit=std.code.complexity:cyclomatic:0'],
                                          check_stderr=[(0, -1)],
                                          exit_code=6,
                                          prefix='second',
@@ -87,9 +87,9 @@ class Test(tests.common.TestCase):
         self.assertExec(runner.run())
 
         runner = tests.common.ToolRunner('limit',
-                                         ['--general.log-level=INFO',
-                                          '--general.max-limit=std.code.complexity:cyclomatic:0',
-                                          '--general.warn=all'],
+                                         ['--log-level=INFO',
+                                          '--max-limit=std.code.complexity:cyclomatic:0',
+                                          '--warn-mode=all'],
                                          check_stderr=[(0, -1)],
                                          exit_code=6,
                                          prefix='second_warn_all',
@@ -97,9 +97,9 @@ class Test(tests.common.TestCase):
         self.assertExec(runner.run())
 
         runner = tests.common.ToolRunner('limit',
-                                         ['--general.log-level=INFO',
-                                          '--general.max-limit=std.code.complexity:cyclomatic:0',
-                                          '--general.warn=touched'],
+                                         ['--log-level=INFO',
+                                          '--max-limit=std.code.complexity:cyclomatic:0',
+                                          '--warn-mode=touched'],
                                          check_stderr=[(0, -1)],
                                          exit_code=4,
                                          prefix='second_warn_touched',
@@ -107,9 +107,9 @@ class Test(tests.common.TestCase):
         self.assertExec(runner.run())
 
         runner = tests.common.ToolRunner('limit',
-                                         ['--general.log-level=INFO',
-                                          '--general.max-limit=std.code.complexity:cyclomatic:0',
-                                          '--general.warn=trend'],
+                                         ['--log-level=INFO',
+                                          '--max-limit=std.code.complexity:cyclomatic:0',
+                                          '--warn-mode=trend'],
                                          check_stderr=[(0, -1)],
                                          exit_code=3,
                                          prefix='second_warn_trend',
@@ -117,9 +117,9 @@ class Test(tests.common.TestCase):
         self.assertExec(runner.run())
 
         runner = tests.common.ToolRunner('limit',
-                                         ['--general.log-level=INFO',
-                                          '--general.max-limit=std.code.complexity:cyclomatic:0',
-                                          '--general.warn=new'],
+                                         ['--log-level=INFO',
+                                          '--max-limit=std.code.complexity:cyclomatic:0',
+                                          '--warn-mode=new'],
                                          check_stderr=[(0, -1)],
                                          exit_code=2,
                                          prefix='second_warn_new',
@@ -127,7 +127,7 @@ class Test(tests.common.TestCase):
         self.assertExec(runner.run())
 
         runner = tests.common.ToolRunner('info',
-                                         ['--general.log-level=INFO'],
+                                         ['--log-level=INFO'],
                                          check_stderr=[(0, -1)],
                                          prefix='second',
                                          use_prev=True)
@@ -135,47 +135,53 @@ class Test(tests.common.TestCase):
 
     def test_help(self):
         
+        runner = tests.common.ToolRunner('--help', exit_code=1)
+        self.assertExec(runner.run())
+
         runner = tests.common.ToolRunner('collect', ['--help'])
         self.assertExec(runner.run())
 
+        runner = tests.common.ToolRunner('info', ['--help'])
+        self.assertExec(runner.run())
+
         runner = tests.common.ToolRunner('view', ['--help'])
         self.assertExec(runner.run())
 
         runner = tests.common.ToolRunner('limit', ['--help'])
         self.assertExec(runner.run())
 
-        runner = tests.common.ToolRunner('info', ['--help'])
+        runner = tests.common.ToolRunner('export', ['--help'])
         self.assertExec(runner.run())
 
     def test_view_format(self):
 
-        runner = tests.common.ToolRunner('collect', ['--std.code.complexity.on'], save_prev=True)
+        runner = tests.common.ToolRunner('collect', ['--std.code.complexity.cyclomatic'], save_prev=True)
         self.assertExec(runner.run())
 
-        runner = tests.common.ToolRunner('view', ['--general.format=txt'], prefix='txt')
+        runner = tests.common.ToolRunner('view', ['--format=txt'], prefix='txt')
         self.assertExec(runner.run())
 
-        runner = tests.common.ToolRunner('view', ['--general.format=python'], prefix='python')
+        runner = tests.common.ToolRunner('view', ['--format=python'], prefix='python')
         self.assertExec(runner.run())
 
-        runner = tests.common.ToolRunner('view', ['--general.format=xml'], prefix='xml')
+        runner = tests.common.ToolRunner('view', ['--format=xml'], prefix='xml')
         self.assertExec(runner.run())
         
         runner = tests.common.ToolRunner('collect',
-                                         ['--std.code.complexity.on'],
+                                         ['--std.code.complexity.cyclomatic'],
                                          prefix='nest',
                                          cwd="sources_changed",
                                          use_prev=True)
         self.assertExec(runner.run())
 
         runner = tests.common.ToolRunner('view',
-                                         ['--general.nest-regions', '--general.format=xml'],
+                                         ['--nest-regions', '--format=xml'],
                                          prefix='nest',
                                          use_prev=True)
         self.assertExec(runner.run())
 
         runner = tests.common.ToolRunner('view',
-                                         ['--general.nest-regions', '--general.format=xml'],
+                                         ['--nest-regions', '--format=xml'],
                                          prefix='nest_per_file',
                                          dirs_list=['./simple.cpp'],
                                          use_prev=True)

+ 10 - 0
mainline/tests/general/test_basic/test_help_--help_default_stdout.gold.txt

@@ -0,0 +1,10 @@
+Usage: D:\Projects\Metrix++\metrixpp.py <action> --help
+   or: D:\Projects\Metrix++\metrixpp.py <action> [options] -- [path 1] ... [path N]
+where: actions are:
+	collect
+	debug
+	export
+	info
+	limit
+	test
+	view

+ 12 - 11
mainline/tests/general/test_basic/test_help_collect_default_stdout.gold.txt

@@ -2,38 +2,39 @@ Usage: metrixpp.py collect [options] -- [path 1] ... [path N]
 
 Options:
   -h, --help            show this help message and exit
-  --general.db-file=GENERAL.DB_FILE
+  --db-file=DB_FILE, --dbf=DB_FILE
                         Primary database file to write (by the collector) and
                         post-process (by other tools) [default: ./metrixpp.db]
-  --general.db-file-prev=GENERAL.DB_FILE_PREV
+  --db-file-prev=DB_FILE_PREV, --dbfp=DB_FILE_PREV
                         Database file with data collected for the
                         past/previous revision. If it is set for the collector
                         tool to perform an incremental/iterative collection,
                         it may reduce the processing time significantly. Post-
                         processing tools use it in order to recognise/evaluate
                         change trends. [default: none].
-  --general.non-recursively
+  --non-recursively, --nr
                         If the option is set (True), sub-directories are not
                         processed [default: False]
-  --general.exclude-files=GENERAL.EXCLUDE_FILES
+  --exclude-files=EXCLUDE_FILES, --ef=EXCLUDE_FILES
                         Defines the pattern to exclude files from processing
                         [default: ^[.]]
-  --general.proctime-on
+  --std.general.proctime, --sgpt
                         If the option is set (True), the tool measures
                         processing time per file [default: False]
-  --general.procerrors-on
+  --std.general.procerrors, --sgpe
                         If the option is set (True), the tool counts number of
                         processing/parsing errors per file [default: False]
-  --general.size-on     If the option is set (True), the tool collects file
+  --std.general.size, --sgs
+                        If the option is set (True), the tool collects file
                         size metric (in bytes) [default: False]
-  --general.log-level=GENERAL.LOG_LEVEL
+  --log-level=LOG_LEVEL, --ll=LOG_LEVEL
                         Defines log level. Possible values are
                         'DEBUG','INFO','WARNING' or 'ERROR'. Default value is
                         inherited from environment variable
                         'METRIXPLUSPLUS_LOG_LEVEL' if set. [default: INFO]
-  --std.code.complexity.on
-                        Enables collection of complexity metrics: cyclomatic
-                        by McCabe [default: False]
+  --std.code.complexity.cyclomatic, --sccc
+                        Enables collection of cyclomatic complexity metric
+                        (McCabe) [default: False]
   --std.code.cpp.files=STD.CODE.CPP.FILES
                         Enumerates filename extensions to match C/C++ files
                         [default: *.c,*.h,*.cpp,*.hpp,*.cc,*.hh,*.cxx,*.hxx]

+ 6 - 7
mainline/tests/general/test_basic/test_help_export_default_stdout.gold.txt

@@ -2,31 +2,30 @@ Usage: metrixpp.py export [options] -- [path 1] ... [path N]
 
 Options:
   -h, --help            show this help message and exit
-  --general.log-level=GENERAL.LOG_LEVEL
+  --log-level=LOG_LEVEL, --ll=LOG_LEVEL
                         Defines log level. Possible values are
                         'DEBUG','INFO','WARNING' or 'ERROR'. Default value is
                         inherited from environment variable
                         'METRIXPLUSPLUS_LOG_LEVEL' if set. [default: INFO]
-  --general.db-file=GENERAL.DB_FILE
+  --db-file=DB_FILE, --dbf=DB_FILE
                         Primary database file to write (by the collector) and
                         post-process (by other tools) [default: ./metrixpp.db]
-  --general.db-file-prev=GENERAL.DB_FILE_PREV
+  --db-file-prev=DB_FILE_PREV, --dbfp=DB_FILE_PREV
                         Database file with data collected for the
                         past/previous revision. If it is set for the collector
                         tool to perform an incremental/iterative collection,
                         it may reduce the processing time significantly. Post-
                         processing tools use it in order to recognise/evaluate
                         change trends. [default: none].
-  --general.format=GENERAL.FORMAT
+  --format=FORMAT, --ft=FORMAT
                         Format of the output data. Possible values are 'xml',
                         'txt' or 'python' [default: xml]
-  --general.namespaces=GENERAL.NAMESPACES
+  --namespaces=NAMESPACES, --ns=NAMESPACES
                         Allows to enumerate namespaces of interest. If not
                         defined all namespaces available in database file will
                         be processed. Separate several namespaces by comma,
                         for example 'general,std.code.complexity' [default:
                         none]
-  --general.nest-regions
-                        If the option is set (True), data for regions is
+  --nest-regions, --nr  If the option is set (True), data for regions is
                         exported in the form of a tree. Otherwise, all regions
                         are exported in plain list. [default: False]

+ 3 - 3
mainline/tests/general/test_basic/test_help_info_default_stdout.gold.txt

@@ -2,15 +2,15 @@ Usage: metrixpp.py info [options] -- [path 1] ... [path N]
 
 Options:
   -h, --help            show this help message and exit
-  --general.log-level=GENERAL.LOG_LEVEL
+  --log-level=LOG_LEVEL, --ll=LOG_LEVEL
                         Defines log level. Possible values are
                         'DEBUG','INFO','WARNING' or 'ERROR'. Default value is
                         inherited from environment variable
                         'METRIXPLUSPLUS_LOG_LEVEL' if set. [default: INFO]
-  --general.db-file=GENERAL.DB_FILE
+  --db-file=DB_FILE, --dbf=DB_FILE
                         Primary database file to write (by the collector) and
                         post-process (by other tools) [default: ./metrixpp.db]
-  --general.db-file-prev=GENERAL.DB_FILE_PREV
+  --db-file-prev=DB_FILE_PREV, --dbfp=DB_FILE_PREV
                         Database file with data collected for the
                         past/previous revision. If it is set for the collector
                         tool to perform an incremental/iterative collection,

+ 7 - 7
mainline/tests/general/test_basic/test_help_limit_default_stdout.gold.txt

@@ -2,28 +2,28 @@ Usage: metrixpp.py limit [options] -- [path 1] ... [path N]
 
 Options:
   -h, --help            show this help message and exit
-  --general.log-level=GENERAL.LOG_LEVEL
+  --log-level=LOG_LEVEL, --ll=LOG_LEVEL
                         Defines log level. Possible values are
                         'DEBUG','INFO','WARNING' or 'ERROR'. Default value is
                         inherited from environment variable
                         'METRIXPLUSPLUS_LOG_LEVEL' if set. [default: INFO]
-  --general.db-file=GENERAL.DB_FILE
+  --db-file=DB_FILE, --dbf=DB_FILE
                         Primary database file to write (by the collector) and
                         post-process (by other tools) [default: ./metrixpp.db]
-  --general.db-file-prev=GENERAL.DB_FILE_PREV
+  --db-file-prev=DB_FILE_PREV, --dbfp=DB_FILE_PREV
                         Database file with data collected for the
                         past/previous revision. If it is set for the collector
                         tool to perform an incremental/iterative collection,
                         it may reduce the processing time significantly. Post-
                         processing tools use it in order to recognise/evaluate
                         change trends. [default: none].
-  --general.warn=GENERAL.WARN
+  --warn-mode=WARN_MODE, --wm=WARN_MODE
                         Defines the warnings mode. 'new' - warnings for new
                         regions only, 'trend' - warnings for new regions and
                         for bad trend of modified regions, 'touched' -
                         warnings for new regions and modified regions, 'all' -
                         all warnings active [default: all]
-  --general.min-limit=GENERAL.MIN_LIMIT
+  --min-limit=MIN_LIMIT, --min=MIN_LIMIT
                         A threshold per 'namespace:field' metric in order to
                         select regions, which have got metric value less than
                         the specified limit. This option can be specified
@@ -31,7 +31,7 @@ Options:
                         limits. Should be in the format: <namespace>:<field
                         >:<limit-value>, for example:
                         'std.code.complexity:cyclomatic:7'.
-  --general.max-limit=GENERAL.MAX_LIMIT
+  --max-limit=MAX_LIMIT, --max=MAX_LIMIT
                         A threshold per 'namespace:field' metric in order to
                         select regions, which have got metric value more than
                         the specified limit. This option can be specified
@@ -39,7 +39,7 @@ Options:
                         limits. Should be in the format: <namespace>:<field
                         >:<limit-value>, for example:
                         'std.code.complexity:cyclomatic:7'.
-  --general.hotspots=GENERAL.HOTSPOTS
+  --hotspots=HOTSPOTS, --hs=HOTSPOTS
                         If not set (none), all exceeded limits are printed. If
                         set, exceeded limits are sorted (the worst is the
                         first) and only first GENERAL.HOTSPOTS limits are

+ 6 - 7
mainline/tests/general/test_basic/test_help_view_default_stdout.gold.txt

@@ -2,31 +2,30 @@ Usage: metrixpp.py export [options] -- [path 1] ... [path N]
 
 Options:
   -h, --help            show this help message and exit
-  --general.log-level=GENERAL.LOG_LEVEL
+  --log-level=LOG_LEVEL, --ll=LOG_LEVEL
                         Defines log level. Possible values are
                         'DEBUG','INFO','WARNING' or 'ERROR'. Default value is
                         inherited from environment variable
                         'METRIXPLUSPLUS_LOG_LEVEL' if set. [default: INFO]
-  --general.db-file=GENERAL.DB_FILE
+  --db-file=DB_FILE, --dbf=DB_FILE
                         Primary database file to write (by the collector) and
                         post-process (by other tools) [default: ./metrixpp.db]
-  --general.db-file-prev=GENERAL.DB_FILE_PREV
+  --db-file-prev=DB_FILE_PREV, --dbfp=DB_FILE_PREV
                         Database file with data collected for the
                         past/previous revision. If it is set for the collector
                         tool to perform an incremental/iterative collection,
                         it may reduce the processing time significantly. Post-
                         processing tools use it in order to recognise/evaluate
                         change trends. [default: none].
-  --general.format=GENERAL.FORMAT
+  --format=FORMAT, --ft=FORMAT
                         Format of the output data. Possible values are 'xml',
                         'txt' or 'python' [default: xml]
-  --general.namespaces=GENERAL.NAMESPACES
+  --namespaces=NAMESPACES, --ns=NAMESPACES
                         Allows to enumerate namespaces of interest. If not
                         defined all namespaces available in database file will
                         be processed. Separate several namespaces by comma,
                         for example 'general,std.code.complexity' [default:
                         none]
-  --general.nest-regions
-                        If the option is set (True), data for regions is
+  --nest-regions, --nr  If the option is set (True), data for regions is
                         exported in the form of a tree. Otherwise, all regions
                         are exported in plain list. [default: False]

+ 3 - 3
mainline/tests/general/test_std_code_cpp.py

@@ -27,18 +27,18 @@ class Test(tests.common.TestCase):
 
     def test_parser(self):
         
-        runner = tests.common.ToolRunner('collect', ['--std.code.complexity.on'])
+        runner = tests.common.ToolRunner('collect', ['--std.code.complexity.cyclomatic'])
         self.assertExec(runner.run())
 
         runner = tests.common.ToolRunner('view')
         self.assertExec(runner.run())
         
         dirs_list = [os.path.join('.', each) for each in os.listdir(self.get_content_paths().cwd)]
-        runner = tests.common.ToolRunner('view', opts_list=['--general.format=txt'], dirs_list=dirs_list, prefix='files')
+        runner = tests.common.ToolRunner('view', opts_list=['--format=txt'], dirs_list=dirs_list, prefix='files')
         self.assertExec(runner.run())
 
         runner = tests.common.ToolRunner('limit',
-                                         ['--general.max-limit=std.code.complexity:cyclomatic:0'],
+                                         ['--max-limit=std.code.complexity:cyclomatic:0'],
                                          exit_code=12)
         self.assertExec(runner.run())
 

+ 4 - 4
mainline/tests/general/test_std_code_cs.py

@@ -27,21 +27,21 @@ class Test(tests.common.TestCase):
 
     def test_parser(self):
         
-        runner = tests.common.ToolRunner('collect', ['--std.code.complexity.on'])
+        runner = tests.common.ToolRunner('collect', ['--std.code.complexity.cyclomatic'])
         self.assertExec(runner.run())
 
-        runner = tests.common.ToolRunner('view', ['--general.nest-regions', '--general.format=xml'])
+        runner = tests.common.ToolRunner('view', ['--nest-regions', '--format=xml'])
         self.assertExec(runner.run())
 
         dirs_list = [os.path.join('.', each) for each in os.listdir(self.get_content_paths().cwd)]
         runner = tests.common.ToolRunner('view',
-                                         opts_list=['--general.nest-regions', '--general.format=txt'],
+                                         opts_list=['--nest-regions', '--format=txt'],
                                          dirs_list=dirs_list,
                                          prefix='files')
         self.assertExec(runner.run())
 
         runner = tests.common.ToolRunner('limit',
-                                         ['--general.max-limit=std.code.complexity:cyclomatic:0'],
+                                         ['--max-limit=std.code.complexity:cyclomatic:0'],
                                          exit_code=16)
         self.assertExec(runner.run())
 

+ 4 - 4
mainline/tests/general/test_std_code_java.py

@@ -27,21 +27,21 @@ class Test(tests.common.TestCase):
 
     def test_parser(self):
         
-        runner = tests.common.ToolRunner('collect', ['--std.code.complexity.on'])
+        runner = tests.common.ToolRunner('collect', ['--std.code.complexity.cyclomatic'])
         self.assertExec(runner.run())
 
-        runner = tests.common.ToolRunner('view', ['--general.nest-regions', '--general.format=xml'])
+        runner = tests.common.ToolRunner('view', ['--nest-regions', '--format=xml'])
         self.assertExec(runner.run())
 
         dirs_list = [os.path.join('.', each) for each in os.listdir(self.get_content_paths().cwd)]
         runner = tests.common.ToolRunner('view',
-                                         opts_list=['--general.nest-regions', '--general.format=txt'],
+                                         opts_list=['--nest-regions', '--format=txt'],
                                          dirs_list=dirs_list,
                                          prefix='files')
         self.assertExec(runner.run())
 
         runner = tests.common.ToolRunner('limit',
-                                         ['--general.max-limit=std.code.complexity:cyclomatic:5'],
+                                         ['--max-limit=std.code.complexity:cyclomatic:5'],
                                          exit_code=6)
         self.assertExec(runner.run())
 

+ 2 - 2
mainline/tools/debug.py

@@ -38,7 +38,7 @@ def main(tool_args):
     parser = core.cmdparser.MultiOptionParser(usage="Usage: %prog debug [options] -- [path 1] ... [path N]")
     log_plugin.declare_configuration(parser)
     db_plugin.declare_configuration(parser)
-    parser.add_option("-m", "--general.mode", default='dumphtml', choices=['dumphtml'],
+    parser.add_option("-m", "--mode", default='dumphtml', choices=['dumphtml'],
                          help="'dumphtml' - prints html code with code highlights for each given path [default: %default]")
 
     (options, args) = parser.parse_args(tool_args)
@@ -48,7 +48,7 @@ def main(tool_args):
     loader = core.db.loader.Loader()
     loader.open_database(db_plugin.dbfile)
 
-    if options.__dict__['general.mode'] == 'dumphtml':
+    if options.__dict__['mode'] == 'dumphtml':
         return dumphtml(args, loader)
     
     assert(False)    

+ 7 - 7
mainline/tools/export.py

@@ -42,24 +42,24 @@ def main(tool_args):
     parser = core.cmdparser.MultiOptionParser(usage="Usage: %prog export [options] -- [path 1] ... [path N]")
     log_plugin.declare_configuration(parser)
     db_plugin.declare_configuration(parser)
-    parser.add_option("--general.format", default='xml', choices=['txt', 'xml', 'python'], help="Format of the output data. "
+    parser.add_option("--format", "--ft", default='xml', choices=['txt', 'xml', 'python'], help="Format of the output data. "
                       "Possible values are 'xml', 'txt' or 'python' [default: %default]")
-    parser.add_option("--general.namespaces", default=None, help="Allows to enumerate namespaces of interest."
+    parser.add_option("--namespaces", "--ns", default=None, help="Allows to enumerate namespaces of interest."
                       " If not defined all namespaces available in database file will be processed."
                       " Separate several namespaces by comma, for example 'general,std.code.complexity'"
                       " [default: %default]")
-    parser.add_option("--general.nest-regions", action="store_true", default=False,
+    parser.add_option("--nest-regions", "--nr", action="store_true", default=False,
                       help="If the option is set (True), data for regions is exported in the form of a tree. "
                       "Otherwise, all regions are exported in plain list. [default: %default]")
 
     (options, args) = parser.parse_args(tool_args)
     log_plugin.configure(options)
     db_plugin.configure(options)
-    out_format = options.__dict__['general.format']
-    nest_regions = options.__dict__['general.nest_regions']
+    out_format = options.__dict__['format']
+    nest_regions = options.__dict__['nest_regions']
     namespaces = None
-    if options.__dict__['general.namespaces'] != None:
-        namespaces = re.split(',', options.__dict__['general.namespaces'])
+    if options.__dict__['namespaces'] != None:
+        namespaces = re.split(',', options.__dict__['namespaces'])
 
     loader_prev = core.db.loader.Loader()
     if db_plugin.dbfile_prev != None:

+ 2 - 2
mainline/tools/limit.py

@@ -44,7 +44,7 @@ def main(tool_args):
     log_plugin.declare_configuration(parser)
     db_plugin.declare_configuration(parser)
     warn_plugin.declare_configuration(parser)
-    parser.add_option("--general.hotspots", default=None, help="If not set (none), all exceeded limits are printed."
+    parser.add_option("--hotspots", "--hs", default=None, help="If not set (none), all exceeded limits are printed."
                       " If set, exceeded limits are sorted (the worst is the first) and only first GENERAL.HOTSPOTS limits are printed."
                       " [default: %default]", type=int)
 
@@ -52,7 +52,7 @@ def main(tool_args):
     log_plugin.configure(options)
     db_plugin.configure(options)
     warn_plugin.configure(options)
-    hotspots = options.__dict__['general.hotspots']
+    hotspots = options.__dict__['hotspots']
 
     loader_prev = core.db.loader.Loader()
     if db_plugin.dbfile_prev != None:

+ 2 - 2
mainline/tools/test.py

@@ -36,13 +36,13 @@ def main(tool_args):
 
     parser = core.cmdparser.MultiOptionParser(usage="Usage: %prog test [options] -- [testgroup-dir-path-1[/testsuite-file-path-1]] ... [...path-N]")
     log_plugin.declare_configuration(parser, default_value='ERROR')
-    parser.add_option("-g", "--general.generate-golds", action="store_true", default=False,
+    parser.add_option("-g", "--generate-golds", "--gg", action="store_true", default=False,
                          help="If the option is set (True), new gold files are generated (replacing existing) [default: %default]")
 
     (options, args) = parser.parse_args(tool_args)
     log_plugin.configure(options)
     
-    os.environ['METRIXPLUSPLUS_TEST_GENERATE_GOLDS'] = str(options.__dict__['general.generate_golds'])
+    os.environ['METRIXPLUSPLUS_TEST_GENERATE_GOLDS'] = str(options.__dict__['generate_golds'])
     
     tests_dir = os.path.join(os.environ['METRIXPLUSPLUS_INSTALL_DIR'], 'tests')
     process_data= ["python", "-m", "unittest", "discover", "-v", "-s"]

+ 7 - 7
mainline/tools/view.py

@@ -42,24 +42,24 @@ def main(tool_args):
     parser = core.cmdparser.MultiOptionParser(usage="Usage: %prog export [options] -- [path 1] ... [path N]")
     log_plugin.declare_configuration(parser)
     db_plugin.declare_configuration(parser)
-    parser.add_option("--general.format", default='xml', choices=['txt', 'xml', 'python'], help="Format of the output data. "
+    parser.add_option("--format", "--ft", default='xml', choices=['txt', 'xml', 'python'], help="Format of the output data. "
                       "Possible values are 'xml', 'txt' or 'python' [default: %default]")
-    parser.add_option("--general.namespaces", default=None, help="Allows to enumerate namespaces of interest."
+    parser.add_option("--namespaces", "--ns", default=None, help="Allows to enumerate namespaces of interest."
                       " If not defined all namespaces available in database file will be processed."
                       " Separate several namespaces by comma, for example 'general,std.code.complexity'"
                       " [default: %default]")
-    parser.add_option("--general.nest-regions", action="store_true", default=False,
+    parser.add_option("--nest-regions", "--nr", action="store_true", default=False,
                       help="If the option is set (True), data for regions is exported in the form of a tree. "
                       "Otherwise, all regions are exported in plain list. [default: %default]")
 
     (options, args) = parser.parse_args(tool_args)
     log_plugin.configure(options)
     db_plugin.configure(options)
-    out_format = options.__dict__['general.format']
-    nest_regions = options.__dict__['general.nest_regions']
+    out_format = options.__dict__['format']
+    nest_regions = options.__dict__['nest_regions']
     namespaces = None
-    if options.__dict__['general.namespaces'] != None:
-        namespaces = re.split(',', options.__dict__['general.namespaces'])
+    if options.__dict__['namespaces'] != None:
+        namespaces = re.split(',', options.__dict__['namespaces'])
 
     loader_prev = core.db.loader.Loader()
     if db_plugin.dbfile_prev != None: