priv-kweihmann/multimetric

Not able to get the documentation

Closed this issue · 10 comments

Can you update the readme with proper documentation of what files should be taken for calculation and with syntax that should be used? I am in need of calculating Halstead metrics but not able to run the command. Please reply soon.

Hi, i mI honestly don't really know what you are referring to. What part of the documentation is unclear to you?
Currently there is the project readme and the help of the tool itself.

In theory you can pass any source code file to the tool which is supported by pygments. Currently tested it is with c/c++/python/ruby/php.

So please add an example what you are having as input and what do you expect to happen - and what actually happens. Thanks

Can you please share an example explaining the usage part and the file format part.
I've attached the part where I'm stuck and the error I'm getting while running.
Usage
Error

.

I guess that is connected to #12 - I'll fix that as soon as possible

Okay, but still can you share some sample syntax because I'm not getting where should I type the files and the proper syntax. It will be very helpful for my project.

Either you could try the latest release or you could simply workaround it by using python3 -m multimetric -h to get a working help - I still hope the help is self-explanatory

Now, this command has also stopped working: python3 -m multimetric -h
Can you please help me by sharing some sample syntax.
Help

pip3 install --user --upgrade multimetric
then
multimetric --help will give you

usage: multimetric [-h] [--warn_compiler WARN_COMPILER]
                   [--warn_duplication WARN_DUPLICATION]
                   [--warn_functional WARN_FUNCTIONAL]
                   [--warn_standard WARN_STANDARD]
                   [--warn_security WARN_SECURITY] [--coverage COVERAGE]
                   [--dump] [--jobs JOBS] [--bugpredict {old,new}]
                   [--maintindex {sei,classic,microsoft}]
                   files [files ...]

Calculate code metrics in various languages

positional arguments:
  files                 Files to parse

optional arguments:
  -h, --help            show this help message and exit
  --warn_compiler WARN_COMPILER
                        File(s) holding information about compiler warnings
  --warn_duplication WARN_DUPLICATION
                        File(s) holding information about code duplications
  --warn_functional WARN_FUNCTIONAL
                        File(s) holding information about static code analysis findings
  --warn_standard WARN_STANDARD
                        File(s) holding information about language standard violations
  --warn_security WARN_SECURITY
                        File(s) File(s) holding information about found security issue
  --coverage COVERAGE   File(s) with compiler warningsFile(s) holding information about testing coverage
  --dump                Just dump the token tree
  --jobs JOBS           Run x jobs in parallel
  --bugpredict {old,new}
                        Method how to calculate the bug prediction
  --maintindex {sei,classic,microsoft}
                        Method how to calculate the maintainability index

Currently you could import files of the following types for --warn_* or --coverage

Following information can be read

    <file> = full path to file
    <content> = either a string
    <severity> = optional severity

    Note: you could also add a single line, then <content>
        has to be a number reflecting to total number of findings

File formats

csv: CSV file of following line format
     <file>,<content>,<severity>

json: JSON file
     <file>: {
         "content": <content>,
         "severity": <severity>
     }

example usage

multimetric test.c will give you

{
  "files": {
    "/build/test.c": {
      "comment_ratio": 13.554987212276215,
      "cyclomatic_complexity": 0,
      "fanout_external": 2,
      "fanout_internal": 0,
      "halstead_bugprop": 0.17650664282296843,
      "halstead_difficulty": 19.82142857142857,
      "halstead_effort": 10495.84143929437,
      "halstead_timerequired": 583.1023021830206,
      "halstead_volume": 529.5199284689053,
      "lang": [
        "C"
      ],
      "loc": 21,
      "maintainability_index": 89.06448834511582,
      "operands_sum": 37,
      "operands_uniq": 14,
      "operators_sum": 72,
      "operators_uniq": 15,
      "pylint": 100.0,
      "tiobe": 99.76923076923077,
      "tiobe_compiler": 100.0,
      "tiobe_complexity": 98.46153846153847,
      "tiobe_coverage": 100.0,
      "tiobe_duplication": 100.0,
      "tiobe_fanout": 100.0,
      "tiobe_functional": 100.0,
      "tiobe_security": 100.0,
      "tiobe_standard": 100.0
    }
  },
  "overall": {
    "comment_ratio": 13.554987212276215,
    "cyclomatic_complexity": 0,
    "fanout_external": 2,
    "fanout_internal": 0,
    "halstead_bugprop": 0.17650664282296843,
    "halstead_difficulty": 19.82142857142857,
    "halstead_effort": 10495.84143929437,
    "halstead_timerequired": 583.1023021830206,
    "halstead_volume": 529.5199284689053,
    "lang": [
      "C"
    ],
    "loc": 21,
    "maintainability_index": 89.06448834511582,
    "operands_sum": 37,
    "operands_uniq": 14,
    "operators_sum": 72,
    "operators_uniq": 15,
    "pylint": 100.0,
    "tiobe": 99.76923076923077,
    "tiobe_compiler": 100.0,
    "tiobe_complexity": 98.46153846153847,
    "tiobe_coverage": 100.0,
    "tiobe_duplication": 100.0,
    "tiobe_fanout": 100.0,
    "tiobe_functional": 100.0,
    "tiobe_security": 100.0,
    "tiobe_standard": 100.0
  },
  "stats": {
    "max": {
      "comment_ratio": 13.554987212276215,
      "cyclomatic_complexity": 0,
      "fanout_external": 2,
      "fanout_internal": 0,
      "halstead_bugprop": 0.17650664282296843,
      "halstead_difficulty": 19.82142857142857,
      "halstead_effort": 10495.84143929437,
      "halstead_timerequired": 583.1023021830206,
      "halstead_volume": 529.5199284689053,
      "loc": 21,
      "maintainability_index": 89.06448834511582,
      "operands_sum": 37,
      "operands_uniq": 14,
      "operators_sum": 72,
      "operators_uniq": 15,
      "pylint": 100.0,
      "tiobe": 99.76923076923077,
      "tiobe_compiler": 100.0,
      "tiobe_complexity": 98.46153846153847,
      "tiobe_coverage": 100.0,
      "tiobe_duplication": 100.0,
      "tiobe_fanout": 100.0,
      "tiobe_functional": 100.0,
      "tiobe_security": 100.0,
      "tiobe_standard": 100.0
    },
    "mean": {
      "comment_ratio": 13.554987212276215,
      "cyclomatic_complexity": 0,
      "fanout_external": 2,
      "fanout_internal": 0,
      "halstead_bugprop": 0.17650664282296843,
      "halstead_difficulty": 19.82142857142857,
      "halstead_effort": 10495.84143929437,
      "halstead_timerequired": 583.1023021830206,
      "halstead_volume": 529.5199284689053,
      "loc": 21,
      "maintainability_index": 89.06448834511582,
      "operands_sum": 37,
      "operands_uniq": 14,
      "operators_sum": 72,
      "operators_uniq": 15,
      "pylint": 100.0,
      "tiobe": 99.76923076923077,
      "tiobe_compiler": 100.0,
      "tiobe_complexity": 98.46153846153847,
      "tiobe_coverage": 100.0,
      "tiobe_duplication": 100.0,
      "tiobe_fanout": 100.0,
      "tiobe_functional": 100.0,
      "tiobe_security": 100.0,
      "tiobe_standard": 100.0
    },
    "median": {
      "comment_ratio": 13.554987212276215,
      "cyclomatic_complexity": 0,
      "fanout_external": 2,
      "fanout_internal": 0,
      "halstead_bugprop": 0.17650664282296843,
      "halstead_difficulty": 19.82142857142857,
      "halstead_effort": 10495.84143929437,
      "halstead_timerequired": 583.1023021830206,
      "halstead_volume": 529.5199284689053,
      "loc": 21,
      "maintainability_index": 89.06448834511582,
      "operands_sum": 37,
      "operands_uniq": 14,
      "operators_sum": 72,
      "operators_uniq": 15,
      "pylint": 100.0,
      "tiobe": 99.76923076923077,
      "tiobe_compiler": 100.0,
      "tiobe_complexity": 98.46153846153847,
      "tiobe_coverage": 100.0,
      "tiobe_duplication": 100.0,
      "tiobe_fanout": 100.0,
      "tiobe_functional": 100.0,
      "tiobe_security": 100.0,
      "tiobe_standard": 100.0
    },
    "min": {
      "comment_ratio": 13.554987212276215,
      "cyclomatic_complexity": 0,
      "fanout_external": 2,
      "fanout_internal": 0,
      "halstead_bugprop": 0.17650664282296843,
      "halstead_difficulty": 19.82142857142857,
      "halstead_effort": 10495.84143929437,
      "halstead_timerequired": 583.1023021830206,
      "halstead_volume": 529.5199284689053,
      "loc": 21,
      "maintainability_index": 89.06448834511582,
      "operands_sum": 37,
      "operands_uniq": 14,
      "operators_sum": 72,
      "operators_uniq": 15,
      "pylint": 100.0,
      "tiobe": 99.76923076923077,
      "tiobe_compiler": 100.0,
      "tiobe_complexity": 98.46153846153847,
      "tiobe_coverage": 100.0,
      "tiobe_duplication": 100.0,
      "tiobe_fanout": 100.0,
      "tiobe_functional": 100.0,
      "tiobe_security": 100.0,
      "tiobe_standard": 100.0
    }
  }
}

Thank You for your help and support but I'm getting the same error after trying for 2 days. I'm stuck at the same point.
er

May I ask if you're trying to use the tool on Windows?
Windows isn't support at the moment - it's a Linux only tool.

What you could try is to use WSL in Windows that should work

Ohh yes I am using Windows. Thanks. I'll use WSL.