sharpshot


Namesharpshot JSON
Version 1.0.1 PyPI version JSON
download
home_pagehttps://github.com/openutx
SummarySharpshot will help you tests more easily! Created: Lijiawei. Version 1.0.1
upload_time2024-08-29 12:16:45
maintainerNone
docs_urlNone
authorlijiawei
requires_pythonNone
licenseApache License 2.0
keywords sharpshot test static-code-analysis tools
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ## 精准测试
![SharpShot](https://github.com/openutx/sharpshot/blob/main/images/logo100x100.png)
### SharpShot 
一个专注于精准测试的工具,旨在提供一套强大而灵活的工具集,帮助开发人员和测试人员进行精细化、全面化的测试。该工具集结合了高效的测试技术和先进的分析功能,使用户能够快速、准确地识别和解决软件系统中的问题。

### 介绍

分析 java 项目的两次 git 提交差异对项目的影响,精准定位受影响的接口 并生成调用链数据。

### 实现效果
![效果图](https://github.com/openutx/sharpshot/blob/main/images/img.png)

### 原理
1. 通过代码改动定位代码影响,并不断遍历受影响的类和方法直至找到最上层的controller层
2. 通过javalang语法解析获取每个Java文件的import class extends implements declarators methods 等信息
3. 通过unidiff 解析git diff信息(diff file, added_line_num, removed_lin_num)
4. 然后根据文件增删的代码行去判断影响了哪些类和方法,不断遍历受影响的类和方法直至找到最上层的controller层
5. 分析出两次commit id之间代码改动所带来的影响,输出受影响的接口 并生成调用链路图。

### 环境部署
>要求python >= 3.9
    
```shell
pip install sharpshot
```
### 使用说明
1. 首先获取 gitlab 的 access_token
>https://git.openutx.com/-/profile/personal_access_tokens
2. 运行
```shell
sharpshot pr=https://git.openutx.com/utx/utx-im/-/merge_requests/370 username=utxuser access_token=xxxx
```
>pr 为 merge request 的地址,username 为 gitlab 用户名,access_token 为 gitlab 的 access_token

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/openutx",
    "name": "sharpshot",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "sharpshot, test, static-code-analysis, tools",
    "author": "lijiawei",
    "author_email": "jiawei.li2@qq.com",
    "download_url": "https://files.pythonhosted.org/packages/68/42/2096a9757985e6dd6597ae1465f79098a9b002b642c9cd4a7986b02d4cb2/sharpshot-1.0.1.tar.gz",
    "platform": "any",
    "description": "## \u7cbe\u51c6\u6d4b\u8bd5\n![SharpShot](https://github.com/openutx/sharpshot/blob/main/images/logo100x100.png)\n### SharpShot \n\u4e00\u4e2a\u4e13\u6ce8\u4e8e\u7cbe\u51c6\u6d4b\u8bd5\u7684\u5de5\u5177\uff0c\u65e8\u5728\u63d0\u4f9b\u4e00\u5957\u5f3a\u5927\u800c\u7075\u6d3b\u7684\u5de5\u5177\u96c6\uff0c\u5e2e\u52a9\u5f00\u53d1\u4eba\u5458\u548c\u6d4b\u8bd5\u4eba\u5458\u8fdb\u884c\u7cbe\u7ec6\u5316\u3001\u5168\u9762\u5316\u7684\u6d4b\u8bd5\u3002\u8be5\u5de5\u5177\u96c6\u7ed3\u5408\u4e86\u9ad8\u6548\u7684\u6d4b\u8bd5\u6280\u672f\u548c\u5148\u8fdb\u7684\u5206\u6790\u529f\u80fd\uff0c\u4f7f\u7528\u6237\u80fd\u591f\u5feb\u901f\u3001\u51c6\u786e\u5730\u8bc6\u522b\u548c\u89e3\u51b3\u8f6f\u4ef6\u7cfb\u7edf\u4e2d\u7684\u95ee\u9898\u3002\n\n### \u4ecb\u7ecd\n\n\u5206\u6790 java \u9879\u76ee\u7684\u4e24\u6b21 git \u63d0\u4ea4\u5dee\u5f02\u5bf9\u9879\u76ee\u7684\u5f71\u54cd\uff0c\u7cbe\u51c6\u5b9a\u4f4d\u53d7\u5f71\u54cd\u7684\u63a5\u53e3 \u5e76\u751f\u6210\u8c03\u7528\u94fe\u6570\u636e\u3002\n\n### \u5b9e\u73b0\u6548\u679c\n![\u6548\u679c\u56fe](https://github.com/openutx/sharpshot/blob/main/images/img.png)\n\n### \u539f\u7406\n1. \u901a\u8fc7\u4ee3\u7801\u6539\u52a8\u5b9a\u4f4d\u4ee3\u7801\u5f71\u54cd\uff0c\u5e76\u4e0d\u65ad\u904d\u5386\u53d7\u5f71\u54cd\u7684\u7c7b\u548c\u65b9\u6cd5\u76f4\u81f3\u627e\u5230\u6700\u4e0a\u5c42\u7684controller\u5c42\n2. \u901a\u8fc7javalang\u8bed\u6cd5\u89e3\u6790\u83b7\u53d6\u6bcf\u4e2aJava\u6587\u4ef6\u7684import class extends implements declarators methods \u7b49\u4fe1\u606f\n3. \u901a\u8fc7unidiff \u89e3\u6790git diff\u4fe1\u606f\uff08diff file, added_line_num, removed_lin_num)\n4. \u7136\u540e\u6839\u636e\u6587\u4ef6\u589e\u5220\u7684\u4ee3\u7801\u884c\u53bb\u5224\u65ad\u5f71\u54cd\u4e86\u54ea\u4e9b\u7c7b\u548c\u65b9\u6cd5\uff0c\u4e0d\u65ad\u904d\u5386\u53d7\u5f71\u54cd\u7684\u7c7b\u548c\u65b9\u6cd5\u76f4\u81f3\u627e\u5230\u6700\u4e0a\u5c42\u7684controller\u5c42\n5. \u5206\u6790\u51fa\u4e24\u6b21commit id\u4e4b\u95f4\u4ee3\u7801\u6539\u52a8\u6240\u5e26\u6765\u7684\u5f71\u54cd\uff0c\u8f93\u51fa\u53d7\u5f71\u54cd\u7684\u63a5\u53e3 \u5e76\u751f\u6210\u8c03\u7528\u94fe\u8def\u56fe\u3002\n\n### \u73af\u5883\u90e8\u7f72\n>\u8981\u6c42python >= 3.9\n    \n```shell\npip install sharpshot\n```\n### \u4f7f\u7528\u8bf4\u660e\n1. \u9996\u5148\u83b7\u53d6 gitlab \u7684 access_token\n>https://git.openutx.com/-/profile/personal_access_tokens\n2. \u8fd0\u884c\n```shell\nsharpshot pr=https://git.openutx.com/utx/utx-im/-/merge_requests/370 username=utxuser access_token=xxxx\n```\n>pr \u4e3a merge request \u7684\u5730\u5740\uff0cusername \u4e3a gitlab \u7528\u6237\u540d\uff0caccess_token \u4e3a gitlab \u7684 access_token\n",
    "bugtrack_url": null,
    "license": "Apache License 2.0",
    "summary": "Sharpshot will help you tests more easily! Created: Lijiawei. Version 1.0.1",
    "version": "1.0.1",
    "project_urls": {
        "Homepage": "https://github.com/openutx"
    },
    "split_keywords": [
        "sharpshot",
        " test",
        " static-code-analysis",
        " tools"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "152b5b2910ce8dcdacf76ca7da0ff1828148b2a403eedaf516076ccdb1eb3ecc",
                "md5": "6d3e7cb08de15bff09ab9b10a6efb8d2",
                "sha256": "43e0b1bab626ce046342f011ce79b4623221e53f9f21c3d4b557622e7a197d84"
            },
            "downloads": -1,
            "filename": "sharpshot-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6d3e7cb08de15bff09ab9b10a6efb8d2",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 63358,
            "upload_time": "2024-08-29T12:16:44",
            "upload_time_iso_8601": "2024-08-29T12:16:44.541397Z",
            "url": "https://files.pythonhosted.org/packages/15/2b/5b2910ce8dcdacf76ca7da0ff1828148b2a403eedaf516076ccdb1eb3ecc/sharpshot-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "68422096a9757985e6dd6597ae1465f79098a9b002b642c9cd4a7986b02d4cb2",
                "md5": "ce049d26cad124b47704d59cd52f64aa",
                "sha256": "a2f0b2c51a2ecd78b381eea7a114e8eb66d3cbc999f663ad7d826b84fa2eeb5e"
            },
            "downloads": -1,
            "filename": "sharpshot-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "ce049d26cad124b47704d59cd52f64aa",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 62216,
            "upload_time": "2024-08-29T12:16:45",
            "upload_time_iso_8601": "2024-08-29T12:16:45.563171Z",
            "url": "https://files.pythonhosted.org/packages/68/42/2096a9757985e6dd6597ae1465f79098a9b002b642c9cd4a7986b02d4cb2/sharpshot-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-29 12:16:45",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "sharpshot"
}
        
Elapsed time: 0.82089s