sharpshot


Namesharpshot JSON
Version 1.0.2 PyPI version JSON
download
home_pagehttps://github.com/openutx
SummarySharpshot will help you tests more easily! Created: Lijiawei. Version 1.0.2
upload_time2024-12-16 11:16:02
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/9f/78/bf90809134d05011199fc855f29b3939f908d4bab85572b81655d455c017/sharpshot-1.0.2.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.2",
    "version": "1.0.2",
    "project_urls": {
        "Homepage": "https://github.com/openutx"
    },
    "split_keywords": [
        "sharpshot",
        " test",
        " static-code-analysis",
        " tools"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "04be368df7d1bfac8036ed3ba88f69a68d5f8f914dd7cdbada147bc309fbd893",
                "md5": "3208623cfbe1cba351b5bc3292f88f2e",
                "sha256": "a377cc49495c65146f9747d522b50e8a5da73ec5ec91d646144108a4a35f5369"
            },
            "downloads": -1,
            "filename": "sharpshot-1.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3208623cfbe1cba351b5bc3292f88f2e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 64134,
            "upload_time": "2024-12-16T11:16:00",
            "upload_time_iso_8601": "2024-12-16T11:16:00.167176Z",
            "url": "https://files.pythonhosted.org/packages/04/be/368df7d1bfac8036ed3ba88f69a68d5f8f914dd7cdbada147bc309fbd893/sharpshot-1.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9f78bf90809134d05011199fc855f29b3939f908d4bab85572b81655d455c017",
                "md5": "62fdfe592c26bbc6b7840223724b0594",
                "sha256": "af8d60dcb6c26d4d9c4af609dc28c3c0bdd93a82b570c808a86313cba9f1f12b"
            },
            "downloads": -1,
            "filename": "sharpshot-1.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "62fdfe592c26bbc6b7840223724b0594",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 62590,
            "upload_time": "2024-12-16T11:16:02",
            "upload_time_iso_8601": "2024-12-16T11:16:02.627124Z",
            "url": "https://files.pythonhosted.org/packages/9f/78/bf90809134d05011199fc855f29b3939f908d4bab85572b81655d455c017/sharpshot-1.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-16 11:16:02",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "sharpshot"
}
        
Elapsed time: 0.40851s