Skip to main content

EagleVision

Project description

EagleVision

Why use this tool

This tool will help in uncovering the details in a code repository. For example,

  • Patterns in the code

  • Type of asserts used in the test functions

  • Test functions with no assert / pattern analysed

  • Similarity in the source code/ test code functions

Note: Similarity analysis uses cosine algorithm, if the repo path given for root and repo size is relatively large, re consider to give sub-folders, Similarity analysis bound to take long time, since the computation is in memory if not provided with adequate size expect potential memory overflow

  • Cyclomatic complexity of functions

  • Repository statistics like, Type of file, LOC, Comments, Code etc.

Dependencies

  • python 3.8 : 64 bit

  • python packages (functiondefextractor, similarity-processor, lizard)

  • cloc package npm i -g cloc@2.6.0 https://www.npmjs.com/package/cloc Note: cloc has a dependency for pearl, if not installed please install pearl from https://www.perl.org/

  • third party packages [Ctags, grep]

Installation

Requirements are added in requirement.txt file

Python 3.8

python: install python for the respective OS at https://www.python.org/downloads/ Make sure to update the path variable to point to the python installation folder.

pip: (only if pip is not present by default) get get-pip.py from below link to your folder https://bootstrap.pypa.io/get-pip.py Open a command prompt and navigate to the folder containing get-pip.py. Run the following command:

cloc:

  • cloc package npm i -g cloc@2.6.0 https://www.npmjs.com/package/cloc

EagleVision:

pip install EagleVision

Other tools

Ctags: "https://en.wikipedia.org/wiki/Ctags"

  • Windows:

1.Download Ctags from "http://ctags.sourceforge.net/"

2.Select the right package(based on OS & architecture) and

extract the zip file to a folder

3.Update the system 'path' environment variable with the path to ctags executable

  • Linux:

apt-get install ctags

  • OS X:

brew install ctags

grep

1.Download grep "binaries and Dependencies"

from http://gnuwin32.sourceforge.net/packages/grep.htm

2.Extract the content to a folder

3.Copy and paste contents from \bin folder of Dependencies

to \bin folder of Binaries

4.Update the system 'path' environment variable with the path to "grep" executable

Usage

Commandline

>>>python -m eaglevision --p "path\to\input\json"
  • sample json input,
[
  {
    "path": "repo/path",
    "run_pattern_match":true,
    "run_similarity":true,
    "extraction_annotation": null,
    "extraction_delta": null,
    "extraction_exclude": "*/test_resource/*",
    "pattern_match": ["assert"],
    "pattern_seperator": ["("],
    "similarity_range": "70,100",
    "run_cloc_metric":true,
    "cloc_args": "--exclude-dir=src --exclude-ext=*.cpp,*.java",
    "run_cyclomatic_complexity":true,
    "cyclo_args": "-l java  -l python",
    "cyclo_exclude": ["*.cpp","*.java"],
    "report_folder": null
  }
]
  • Input Description,
    "path": Path of the repository to be analysed
    "run_pattern_match": On/OFF switch for running Pattern match
    "run_similarity": On/OFF switch for running Similarity check
    "extraction_annotation": Functions with this annotation will be
                             extracted else all functions
    "extraction_delta": If substring of annotation is given,
                        this input (integer value) will take number of
                        lines above and below the annotation to report,
    "extraction_exclude": Pattern to exclude for Similarity and Pattern check
    "pattern_match": Type of pattern to analyse in the source code
    "pattern_seperator": Seperator in the pattern, left side of which will
                         be used for pivot reporting
    "similarity_range": Range of similarity of interest example: "70,100",
    "run_cloc_metric": On/OFF switch for running Cloc / types of
                      files/number etc in the repo
    "cloc_args": Any additional args for Cloc tool
                 example:"--exclude-dir=src --exclude-ext=*.cpp,*.java",
    "run_cyclomatic_complexity":On/OFF switch for running cyclomatic complexity check,
    "cyclo_args": Any additional args for Lizard / cyclomatic complexity tool
                 example:"-l java  -l python"
    "cyclo_exclude": Pattern to exclude for cyclomatic complexity check
                     example: ["*.cpp","*.java"]
    "report_folder": Path where report to be placed, if null will be using the path of repo

Note:

All the inputs are taken from the json file

  1. Do not forget to have the json as list [...]

  2. Make sure pattern_match and pattern_seperator is of same length list if you are not interested in any pattern_seperator for s specific pattern_match , mark it null in pattern_seperator

  3. Make sure mark it null if a string or list parameter is not used

  4. Make sure mark it true/false for bool type

refer https://www.npmjs.com/package/cloc for cloc args
refer https://pypi.org/project/lizard/ for cyclo args
refer https://pypi.org/project/functiondefextractor/ for extraction_exclude
refer https://pypi.org/project/similarity-processor/ for similarity

Output

  • Output will be available in same folder as path given in json under EagleVisionReport

Contact

Brijesh Krishnan brijesh.krishnank@philips.com

License

The MIT License (MIT) Copyright © [2019] Koninklijke Philips N.V, https://www.philips.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

EagleVision-0.0.6.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

EagleVision-0.0.6-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file EagleVision-0.0.6.tar.gz.

File metadata

  • Download URL: EagleVision-0.0.6.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for EagleVision-0.0.6.tar.gz
Algorithm Hash digest
SHA256 b3f147be11694c6e084aad03d348d65acd0252313545a7b326d1d07a9c793e73
MD5 72f4d5638bbd226d87998f0a2f354369
BLAKE2b-256 bdac51e985cd7c03782b6df3c3a19e5daa8ad70a84b024a59c77ab212aba67af

See more details on using hashes here.

File details

Details for the file EagleVision-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: EagleVision-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 13.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for EagleVision-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 8791df0a55ee995ad4019943f34c6fcbf7333c905b57a1808ace46d089a445e1
MD5 9553c32deb225776921bcc7b680c8ca2
BLAKE2b-256 03a4b3510ccdee5dffa8ecd0424b64986fd2147fe1f030e9963b837dc2917acf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page