ZeroDivisionError for new xcode project
daogo opened this issue · comments
For example project it works fine, and I receive full report, but the problem starts when I try to use it with my own projects.
I am creating new empty xcode project, with name „TestRaport”, then I run in terminal : swift-code-metrics --source /Desktop/TestRaport --artifacts report --generate-graphs
And I am getting python error:
Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/bin/swift-code-metrics", line 11, in <module> sys.exit(main()) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/swift_code_metrics/scm.py", line 67, in main analyzer = Inspector(directory, artifacts, default_tests_paths, exclude) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/swift_code_metrics/_analyzer.py", line 18, in init self._save_report(artifacts) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/swift_code_metrics/_analyzer.py", line 43, in _save_report json.dump(self.report.as_dict, fp, indent=4) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/swift_code_metrics/_analyzer.py", line 218, in as_dict self.non_test_frameworks_key: self.non_test_framework_aggregate.as_dict, File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/swift_code_metrics/_analyzer.py", line 187, in as_dict "poc": ReportingHelpers.decimal_format(self.poc) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/swift_code_metrics/_analyzer.py", line 175, in poc return Metrics.percentage_of_comments(self.noc, self.loc) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/swift_code_metrics/_metrics.py", line 117, in percentage_of_comments return 100 * noc / (noc + loc) ZeroDivisionError: division by zero
Fixed in #6