# NOTE: This is an edited version of multimetric, that allows you use this module in a programmatically way, it's not intended to replace the original CLI module, and I won't update more this package. For more info, see the original package
### Usage
```
from multimetricprog import calculator
calculator.calculate('''
print("your python code")
''')
```
returns
```
{
"files": {
"fp.py": {
"comment_ratio": 0.0,
"cyclomatic_complexity": 2,
"fanout_external": 0,
"fanout_internal": 0,
"halstead_bugprop": 0.004643856189774725,
"halstead_difficulty": 1.3333333333333333,
"halstead_effort": 18.575424759098897,
"halstead_timerequired": 1.0319680421721609,
"halstead_volume": 13.931568569324174,
"lang": [
"Python"
],
"loc": 1,
"operands_sum": 4,
"operands_uniq": 3,
"operators_sum": 2,
"operators_uniq": 2
}
},
"overall": {
"comment_ratio": 0.0,
"cyclomatic_complexity": 2,
"fanout_external": 0,
"fanout_internal": 0,
"halstead_bugprop": 0.004643856189774725,
"halstead_difficulty": 1.3333333333333333,
"halstead_effort": 18.575424759098897,
"halstead_timerequired": 1.0319680421721609,
"halstead_volume": 13.931568569324174,
"loc": 1,
"maintainability_index": 100,
"operands_sum": 4,
"operands_uniq": 3,
"operators_sum": 2,
"operators_uniq": 2,
"pylint": 100.0,
"tiobe": 99.32835820895522,
"tiobe_compiler": 100.0,
"tiobe_complexity": 95.5223880597015,
"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": 0.0,
"cyclomatic_complexity": 2,
"fanout_external": 0,
"fanout_internal": 0,
"halstead_bugprop": 0.004643856189774725,
"halstead_difficulty": 1.3333333333333333,
"halstead_effort": 18.575424759098897,
"halstead_timerequired": 1.0319680421721609,
"halstead_volume": 13.931568569324174,
"loc": 1,
"operands_sum": 4,
"operands_uniq": 3,
"operators_sum": 2,
"operators_uniq": 2
},
"mean": {
"comment_ratio": 0.0,
"cyclomatic_complexity": 2,
"fanout_external": 0,
"fanout_internal": 0,
"halstead_bugprop": 0.004643856189774725,
"halstead_difficulty": 1.3333333333333333,
"halstead_effort": 18.575424759098897,
"halstead_timerequired": 1.0319680421721609,
"halstead_volume": 13.931568569324174,
"loc": 1,
"operands_sum": 4,
"operands_uniq": 3,
"operators_sum": 2,
"operators_uniq": 2
},
"median": {
"comment_ratio": 0.0,
"cyclomatic_complexity": 2,
"fanout_external": 0,
"fanout_internal": 0,
"halstead_bugprop": 0.004643856189774725,
"halstead_difficulty": 1.3333333333333333,
"halstead_effort": 18.575424759098897,
"halstead_timerequired": 1.0319680421721609,
"halstead_volume": 13.931568569324174,
"loc": 1,
"operands_sum": 4,
"operands_uniq": 3,
"operators_sum": 2,
"operators_uniq": 2
},
"min": {
"comment_ratio": 0.0,
"cyclomatic_complexity": 2,
"fanout_external": 0,
"fanout_internal": 0,
"halstead_bugprop": 0.004643856189774725,
"halstead_difficulty": 1.3333333333333333,
"halstead_effort": 18.575424759098897,
"halstead_timerequired": 1.0319680421721609,
"halstead_volume": 13.931568569324174,
"loc": 1,
"operands_sum": 4,
"operands_uniq": 3,
"operators_sum": 2,
"operators_uniq": 2
}
}
}
```
### Notes
By default, the filename "fp.py" is hardcoded in order to make the module work, if you're interested, you can fork this and make a better version for this module (also, a better README.md).
#### Item structure
| item | description | range | recommendation |
| --------------------- | ---------------------------------------------- | -------- | -------------- |
| comment_ratio | Comment to Code percentage | 0..100 | > 30.0 |
| cyclomatic_complexity | Cyclomatic complexity according to McCabe | 0..(inf) | < 10 |
| fanout_external | Number imports from out of tree modules | 0..(inf) | |
| fanout_internal | Number imports from same source tree modules | 0..(inf) | |
| halstead_bugprop | Number of delivered bugs according to Halstead | 0..(inf) | < 0.05 |
| halstead_difficulty | Difficulty according to Halstead | 0..(inf) | |
| halstead_effort | Effort according to Halstead | 0..(inf) | |
| halstead_timerequired | Time required to program according to Halstead | 0..(inf) | |
| halstead_volume | Volume according to Halstead | 0..(inf) | |
| lang | list of identified programming languages | list | |
| loc | Lines of code | 1..(inf) | |
| maintainability_index | Maintainability index | 0..100 | > 80.0 |
| operands_sum | Number of used operands | 1..(inf) | |
| operands_uniq | Number of unique used operands | 1..(inf) | |
| operators_sum | Number of used operators | 1..(inf) | |
| operators_uniq | Number of unique used operators | 1..(inf) | |
| pylint | General quality score according to pylint | 0..100 | > 80.0 |
| tiobe_compiler | Compiler warnings score according to TIOBE | 0..100 | > 90.0 |
| tiobe_complexity | Complexity according to TIOBE | 0..100 | > 80.0 |
| tiobe_coverage | Coverage according to TIOBE | 0..100 | > 80.0 |
| tiobe_duplication | Code duplications score according to TIOBE | 0..100 | > 80.0 |
| tiobe_fanout | Fan-Out score according to TIOBE | 0..100 | > 80.0 |
| tiobe_functional | Functional defect score according to TIOBE | 0..100 | > 90.0 |
| tiobe_security | Security score according to TIOBE | 0..100 | > 90.0 |
| tiobe_standard | Language standard score according to TIOBE | 0..100 | > 80.0 |
| tiobe | General quality score according to TIOBE | 0..100 | > 80.0 |
#### Statistics
The item `stats` contains in addition to the above mentioned the following items, which by themselves contain all the items mentioned at [Item structure](#item-structure)
* `max` = the maximum value of all items of the metric
* `mean` = statistical mean over all items of the metric
* `median` = statistical median over all items of the metric
* `min` = the minimum value of all items of the metric
* `sd` = standard deviation over all items of the metric
## Further reading
* [Pygments](http://pygments.org/)
## Bugs & Contribution
Feel free to create issues or pull requests
Raw data
{
"_id": null,
"home_page": "https://github.com/VadokDev/multimetric-programmatically",
"name": "multimetricprog",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "",
"author": "Konrad Weihmann",
"author_email": "Gonzalo Fern\u00e1ndez <gonzalo.fdez06@gmail.com>, Konrad Weihmann <kweihmann@outlook.com>",
"download_url": "https://files.pythonhosted.org/packages/25/dd/ea78c9a2e1269f59d4d6fa5ef85f8e206abad3be16e472ffca69b60d2121/multimetricprog-0.0.5.tar.gz",
"platform": null,
"description": "\r\n# NOTE: This is an edited version of multimetric, that allows you use this module in a programmatically way, it's not intended to replace the original CLI module, and I won't update more this package. For more info, see the original package\r\n\r\n### Usage\r\n\r\n```\r\nfrom multimetricprog import calculator\r\n\r\ncalculator.calculate('''\r\nprint(\"your python code\")\r\n''')\r\n\r\n```\r\n\r\nreturns\r\n\r\n```\r\n{\r\n \"files\": {\r\n \"fp.py\": {\r\n \"comment_ratio\": 0.0,\r\n \"cyclomatic_complexity\": 2,\r\n \"fanout_external\": 0,\r\n \"fanout_internal\": 0,\r\n \"halstead_bugprop\": 0.004643856189774725,\r\n \"halstead_difficulty\": 1.3333333333333333,\r\n \"halstead_effort\": 18.575424759098897,\r\n \"halstead_timerequired\": 1.0319680421721609,\r\n \"halstead_volume\": 13.931568569324174,\r\n \"lang\": [\r\n \"Python\"\r\n ],\r\n \"loc\": 1,\r\n \"operands_sum\": 4,\r\n \"operands_uniq\": 3,\r\n \"operators_sum\": 2,\r\n \"operators_uniq\": 2\r\n }\r\n },\r\n \"overall\": {\r\n \"comment_ratio\": 0.0,\r\n \"cyclomatic_complexity\": 2,\r\n \"fanout_external\": 0,\r\n \"fanout_internal\": 0,\r\n \"halstead_bugprop\": 0.004643856189774725,\r\n \"halstead_difficulty\": 1.3333333333333333,\r\n \"halstead_effort\": 18.575424759098897,\r\n \"halstead_timerequired\": 1.0319680421721609,\r\n \"halstead_volume\": 13.931568569324174,\r\n \"loc\": 1,\r\n \"maintainability_index\": 100,\r\n \"operands_sum\": 4,\r\n \"operands_uniq\": 3,\r\n \"operators_sum\": 2,\r\n \"operators_uniq\": 2,\r\n \"pylint\": 100.0,\r\n \"tiobe\": 99.32835820895522,\r\n \"tiobe_compiler\": 100.0,\r\n \"tiobe_complexity\": 95.5223880597015,\r\n \"tiobe_coverage\": 100.0,\r\n \"tiobe_duplication\": 100.0,\r\n \"tiobe_fanout\": 100.0,\r\n \"tiobe_functional\": 100.0,\r\n \"tiobe_security\": 100.0,\r\n \"tiobe_standard\": 100.0\r\n },\r\n \"stats\": {\r\n \"max\": {\r\n \"comment_ratio\": 0.0,\r\n \"cyclomatic_complexity\": 2,\r\n \"fanout_external\": 0,\r\n \"fanout_internal\": 0,\r\n \"halstead_bugprop\": 0.004643856189774725,\r\n \"halstead_difficulty\": 1.3333333333333333,\r\n \"halstead_effort\": 18.575424759098897,\r\n \"halstead_timerequired\": 1.0319680421721609,\r\n \"halstead_volume\": 13.931568569324174,\r\n \"loc\": 1,\r\n \"operands_sum\": 4,\r\n \"operands_uniq\": 3,\r\n \"operators_sum\": 2,\r\n \"operators_uniq\": 2\r\n },\r\n \"mean\": {\r\n \"comment_ratio\": 0.0,\r\n \"cyclomatic_complexity\": 2,\r\n \"fanout_external\": 0,\r\n \"fanout_internal\": 0,\r\n \"halstead_bugprop\": 0.004643856189774725,\r\n \"halstead_difficulty\": 1.3333333333333333,\r\n \"halstead_effort\": 18.575424759098897,\r\n \"halstead_timerequired\": 1.0319680421721609,\r\n \"halstead_volume\": 13.931568569324174,\r\n \"loc\": 1,\r\n \"operands_sum\": 4,\r\n \"operands_uniq\": 3,\r\n \"operators_sum\": 2,\r\n \"operators_uniq\": 2\r\n },\r\n \"median\": {\r\n \"comment_ratio\": 0.0,\r\n \"cyclomatic_complexity\": 2,\r\n \"fanout_external\": 0,\r\n \"fanout_internal\": 0,\r\n \"halstead_bugprop\": 0.004643856189774725,\r\n \"halstead_difficulty\": 1.3333333333333333,\r\n \"halstead_effort\": 18.575424759098897,\r\n \"halstead_timerequired\": 1.0319680421721609,\r\n \"halstead_volume\": 13.931568569324174,\r\n \"loc\": 1,\r\n \"operands_sum\": 4,\r\n \"operands_uniq\": 3,\r\n \"operators_sum\": 2,\r\n \"operators_uniq\": 2\r\n },\r\n \"min\": {\r\n \"comment_ratio\": 0.0,\r\n \"cyclomatic_complexity\": 2,\r\n \"fanout_external\": 0,\r\n \"fanout_internal\": 0,\r\n \"halstead_bugprop\": 0.004643856189774725,\r\n \"halstead_difficulty\": 1.3333333333333333,\r\n \"halstead_effort\": 18.575424759098897,\r\n \"halstead_timerequired\": 1.0319680421721609,\r\n \"halstead_volume\": 13.931568569324174,\r\n \"loc\": 1,\r\n \"operands_sum\": 4,\r\n \"operands_uniq\": 3,\r\n \"operators_sum\": 2,\r\n \"operators_uniq\": 2\r\n }\r\n }\r\n}\r\n```\r\n\r\n### Notes\r\n\r\nBy default, the filename \"fp.py\" is hardcoded in order to make the module work, if you're interested, you can fork this and make a better version for this module (also, a better README.md).\r\n\r\n#### Item structure\r\n\r\n| item | description | range | recommendation |\r\n| --------------------- | ---------------------------------------------- | -------- | -------------- |\r\n| comment_ratio | Comment to Code percentage | 0..100 | > 30.0 |\r\n| cyclomatic_complexity | Cyclomatic complexity according to McCabe | 0..(inf) | < 10 |\r\n| fanout_external | Number imports from out of tree modules | 0..(inf) | |\r\n| fanout_internal | Number imports from same source tree modules | 0..(inf) | |\r\n| halstead_bugprop | Number of delivered bugs according to Halstead | 0..(inf) | < 0.05 |\r\n| halstead_difficulty | Difficulty according to Halstead | 0..(inf) | |\r\n| halstead_effort | Effort according to Halstead | 0..(inf) | |\r\n| halstead_timerequired | Time required to program according to Halstead | 0..(inf) | |\r\n| halstead_volume | Volume according to Halstead | 0..(inf) | |\r\n| lang | list of identified programming languages | list | |\r\n| loc | Lines of code | 1..(inf) | |\r\n| maintainability_index | Maintainability index | 0..100 | > 80.0 |\r\n| operands_sum | Number of used operands | 1..(inf) | |\r\n| operands_uniq | Number of unique used operands | 1..(inf) | |\r\n| operators_sum | Number of used operators | 1..(inf) | |\r\n| operators_uniq | Number of unique used operators | 1..(inf) | |\r\n| pylint | General quality score according to pylint | 0..100 | > 80.0 |\r\n| tiobe_compiler | Compiler warnings score according to TIOBE | 0..100 | > 90.0 |\r\n| tiobe_complexity | Complexity according to TIOBE | 0..100 | > 80.0 |\r\n| tiobe_coverage | Coverage according to TIOBE | 0..100 | > 80.0 |\r\n| tiobe_duplication | Code duplications score according to TIOBE | 0..100 | > 80.0 |\r\n| tiobe_fanout | Fan-Out score according to TIOBE | 0..100 | > 80.0 |\r\n| tiobe_functional | Functional defect score according to TIOBE | 0..100 | > 90.0 |\r\n| tiobe_security | Security score according to TIOBE | 0..100 | > 90.0 |\r\n| tiobe_standard | Language standard score according to TIOBE | 0..100 | > 80.0 |\r\n| tiobe | General quality score according to TIOBE | 0..100 | > 80.0 |\r\n\r\n#### Statistics\r\n\r\nThe item `stats` contains in addition to the above mentioned the following items, which by themselves contain all the items mentioned at [Item structure](#item-structure)\r\n\r\n* `max` = the maximum value of all items of the metric\r\n* `mean` = statistical mean over all items of the metric\r\n* `median` = statistical median over all items of the metric\r\n* `min` = the minimum value of all items of the metric\r\n* `sd` = standard deviation over all items of the metric\r\n\r\n## Further reading\r\n\r\n* [Pygments](http://pygments.org/)\r\n\r\n## Bugs & Contribution\r\n\r\nFeel free to create issues or pull requests\r\n",
"bugtrack_url": null,
"license": "",
"summary": "Calculate code metrics in various languages",
"version": "0.0.5",
"project_urls": {
"Bug Tracker": "https://github.com/VadokDev/multimetric-programmatically/issues",
"Homepage": "https://github.com/VadokDev/multimetric-programmatically"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "900c37e720b2e0707d0f5ef8ccb3a68c9487d281a2d211ad7c81c74161f0c739",
"md5": "f5c6f17d155d42ec375559aad5631c41",
"sha256": "7d5ec7e6178cb410c8c7a5d5490aaeeec28927e6da85adfa80269d5f5bb56c57"
},
"downloads": -1,
"filename": "multimetricprog-0.0.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f5c6f17d155d42ec375559aad5631c41",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 20808,
"upload_time": "2023-05-05T03:28:27",
"upload_time_iso_8601": "2023-05-05T03:28:27.002571Z",
"url": "https://files.pythonhosted.org/packages/90/0c/37e720b2e0707d0f5ef8ccb3a68c9487d281a2d211ad7c81c74161f0c739/multimetricprog-0.0.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "25ddea78c9a2e1269f59d4d6fa5ef85f8e206abad3be16e472ffca69b60d2121",
"md5": "73e0cfd1b77dc4f5a0aa94eeb6eb0b10",
"sha256": "0ee464aa87ea947012d377c601e1bc2db4f1259786281621fbb4d9b5fe141804"
},
"downloads": -1,
"filename": "multimetricprog-0.0.5.tar.gz",
"has_sig": false,
"md5_digest": "73e0cfd1b77dc4f5a0aa94eeb6eb0b10",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 15323,
"upload_time": "2023-05-05T03:28:28",
"upload_time_iso_8601": "2023-05-05T03:28:28.767541Z",
"url": "https://files.pythonhosted.org/packages/25/dd/ea78c9a2e1269f59d4d6fa5ef85f8e206abad3be16e472ffca69b60d2121/multimetricprog-0.0.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-05-05 03:28:28",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "VadokDev",
"github_project": "multimetric-programmatically",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "multimetricprog"
}