cds-contract

所属分类:自动编程
开发工具:Python
文件大小:12344KB
下载次数:0
上传日期:2023-05-23 16:54:37
上 传 者sh-1993
说明:  一致性辩论系统-代码审查的去中心化方法
(Consistent Debate System - A descentralized approach to code review)

文件列表:
.vscode (0, 2023-05-24)
.vscode\launch.json (496, 2023-05-24)
.vscode\settings.json (92, 2023-05-24)
branchOperators.json (31, 2023-05-24)
examples (0, 2023-05-24)
examples\1.java (1409, 2023-05-24)
examples\2.java (208, 2023-05-24)
examples\3.java (361, 2023-05-24)
examples\kalilo.java (8152, 2023-05-24)
halstead_cyclomatic (0, 2023-05-24)
halstead_cyclomatic\__init__.py (0, 2023-05-24)
halstead_cyclomatic\__main__.py (7398, 2023-05-24)
halstead_cyclomatic\__pycache__ (0, 2023-05-24)
halstead_cyclomatic\__pycache__\__init__.cpython-310.pyc (204, 2023-05-24)
halstead_cyclomatic\__pycache__\__main__.cpython-310.pyc (1988, 2023-05-24)
halstead_cyclomatic\__pycache__\cyclomatic.cpython-310.pyc (945, 2023-05-24)
halstead_cyclomatic\__pycache__\get_operators_operands_count.cpython-310.pyc (1079, 2023-05-24)
halstead_cyclomatic\__pycache__\halstead.cpython-310.pyc (714, 2023-05-24)
halstead_cyclomatic\cyclomatic.py (536, 2023-05-24)
halstead_cyclomatic\get_operators_operands_count.py (864, 2023-05-24)
halstead_cyclomatic\halstead.py (694, 2023-05-24)
operands.json (251, 2023-05-24)
requirements.txt (254, 2023-05-24)
smart-contract (0, 2023-05-24)
smart-contract\newCDS.sol (10932, 2023-05-24)
venv (0, 2023-05-24)
venv\bin (0, 2023-05-24)
venv\bin\Activate.ps1 (9033, 2023-05-24)
venv\bin\activate (2051, 2023-05-24)
venv\bin\activate.csh (977, 2023-05-24)
venv\bin\activate.fish (2119, 2023-05-24)
venv\bin\autopep8 (321, 2023-05-24)
venv\bin\base58 (328, 2023-05-24)
venv\bin\epylint (332, 2023-05-24)
venv\bin\get_objgraph (1730, 2023-05-24)
venv\bin\isort (323, 2023-05-24)
venv\bin\isort-identify-imports (357, 2023-05-24)
... ...

# cds-contract Consistent Debate System - A descentralized approach to code review # Legacy Readme for complexity calculator(fix later): # Halstead Metric and Cyclomatic Complexity for java calculates Halstead Metric and Cyclomatic Complexity for a given java file ## installation ```bash python -m venv venv venv/bin/python -m pip install -r requirements.txt ``` ## args ```bash (venv) $ py -m halstead_cyclomatic -h ``` ```text usage: __main__.py [-h] JAVA_FILE outputs Halstead metrics and cyclomatic complexity for a given java file positional arguments: JAVA_FILE path to the java file options: -h, --help show this help message and exit ``` ## examples java examples can be found in the [examples](https://github.com/alompson/cds-contract/blob/master/examples/) folder ### 3.java #### Java ```java class Test2 { public static void main(String[] args) { int[][] a = { { 00, 01 }, { 10, 11 } }; int i = 99; try { a[val()][i = 1]++; } catch (Exception e) { System.out.println(e + ", i=" + i); } } static int val() throws Exception { throw new Exception("unimplemented"); } } ``` #### Output ```bash (venv) $ py -m halstead_cyclomatic examples/3.java ``` ```text ╒═══════════════════════╤═══╕ │ Cyclomatic complexity │ 1 │ ╘═══════════════════════╧═══╛ Halstead Metrics: ╒══════════════════════════════╤═════════════╕ │ Metric │ Value │ ╞══════════════════════════════╪═════════════╡ │ Number of Distinct Operators │ 22 │ ├──────────────────────────────┼─────────────┤ │ Number of Distinct Operands │ 20 │ ├──────────────────────────────┼─────────────┤ │ Number of Operators │ 67 │ ├──────────────────────────────┼─────────────┤ │ Number of Operands │ 27 │ ├──────────────────────────────┼─────────────┤ │ Program vocabulary │ 42 │ ├──────────────────────────────┼─────────────┤ │ Program length │ 94 │ ├──────────────────────────────┼─────────────┤ │ Estimated length │ 184.546 │ ├──────────────────────────────┼─────────────┤ │ Purity ratio │ 1.96326 │ ├──────────────────────────────┼─────────────┤ │ Volume │ 995.131 │ ├──────────────────────────────┼─────────────┤ │ Difficulty │ 14.85 │ ├──────────────────────────────┼─────────────┤ │ Program effort │ 14777.7 │ ├──────────────────────────────┼─────────────┤ │ Time required to program │ 820.***3 │ ├──────────────────────────────┼─────────────┤ │ Number of delivered bugs │ 0.33171 │ ╘══════════════════════════════╧═════════════╛ Operators: ╒════════════╤═════════╕ │ Operator │ Count │ ╞════════════╪═════════╡ │ class │ 1 │ ├────────────┼─────────┤ │ { │ 8 │ ├────────────┼─────────┤ │ public │ 1 │ ├────────────┼─────────┤ │ static │ 2 │ ├────────────┼─────────┤ │ void │ 1 │ ├────────────┼─────────┤ │ ( │ 6 │ ├────────────┼─────────┤ │ [ │ 5 │ ├────────────┼─────────┤ │ ] │ 5 │ ├────────────┼─────────┤ │ ) │ 6 │ ├────────────┼─────────┤ │ int │ 3 │ ├────────────┼─────────┤ │ = │ 3 │ ├────────────┼─────────┤ │ , │ 3 │ ├────────────┼─────────┤ │ } │ 8 │ ├────────────┼─────────┤ │ ; │ 5 │ ├────────────┼─────────┤ │ try │ 1 │ ├────────────┼─────────┤ │ ++ │ 1 │ ├────────────┼─────────┤ │ catch │ 1 │ ├────────────┼─────────┤ │ . │ 2 │ ├────────────┼─────────┤ │ + │ 2 │ ├────────────┼─────────┤ │ throws │ 1 │ ├────────────┼─────────┤ │ throw │ 1 │ ├────────────┼─────────┤ │ new │ 1 │ ╘════════════╧═════════╛ Operands: ╒═════════════════╤═════════╕ │ Operand │ Count │ ╞═════════════════╪═════════╡ │ Test2 │ 1 │ ├─────────────────┼─────────┤ │ main │ 1 │ ├─────────────────┼─────────┤ │ String │ 1 │ ├─────────────────┼─────────┤ │ args │ 1 │ ├─────────────────┼─────────┤ │ a │ 2 │ ├─────────────────┼─────────┤ │ 00 │ 1 │ ├─────────────────┼─────────┤ │ 01 │ 1 │ ├─────────────────┼─────────┤ │ 10 │ 1 │ ├─────────────────┼─────────┤ │ 11 │ 1 │ ├─────────────────┼─────────┤ │ i │ 3 │ ├─────────────────┼─────────┤ │ 99 │ 1 │ ├─────────────────┼─────────┤ │ val │ 2 │ ├─────────────────┼─────────┤ │ 1 │ 1 │ ├─────────────────┼─────────┤ │ Exception │ 3 │ ├─────────────────┼─────────┤ │ e │ 2 │ ├─────────────────┼─────────┤ │ System │ 1 │ ├─────────────────┼─────────┤ │ out │ 1 │ ├─────────────────┼─────────┤ │ println │ 1 │ ├─────────────────┼─────────┤ │ ", i=" │ 1 │ ├─────────────────┼─────────┤ │ "unimplemented" │ 1 │ ╘═════════════════╧═════════╛ ```

近期下载者

相关文件


收藏者