Metrinome is an all-purpose tool for working with code complexity metrics.

Overview

Lint and Test codecov License: GPL v3 Python 3.9

Overview

Metrinome is an all-purpose tool for working with code complexity metrics. It can be used as both a REPL and API, and includes:

  • Converters to turn C++, Java, and Python code to Control Flow Graphs
  • Metric calculators for NPath, Cyclomatic, and Path Complexity
  • KLEE utilities to automatically analyze C++ code

To get started, follow the guide in the wiki to pull the docker image and jump directly into the REPL.

Links

Comments
  • Unable to convert

    Unable to convert

    Hello, I am having trouble using the convert command. I am simply trying to convert the python example given (for starters) but it keeps saying "Could not get files from: test.py". I am probably missing a trick here. Do you have an idea?

    opened by UsmanGohar 11
  • Converting Java files in a directory

    Converting Java files in a directory

    Describe the bug When running "convert <path_to_directory>", only the filename is passed from do_convert(...) in core/command.py to to_graph(...) in lang_to_cfg/java.py, so "javac <file_name> -d <directory_path>" in to_graph(...) incorrectly searches the user's current directory for the file instead of <path_to_directory>.

    To Reproduce Steps to reproduce the behavior:

    1. Make a directory with Java files in src
    2. Run the REPL
    3. Execute "convert <path_to_directory>"

    Temporary fix In do_convert(...) in core/command.py, I concatenated the path with the filename to to_graph(...) in lang_to_cfg/java.py which fixes this issue, although I am not sure if it creates other issues.

    Screenshots Before: Screen Shot 2021-06-04 at 11 04 26 AM

    After: Screen Shot 2021-06-04 at 11 04 59 AM

    bug 
    opened by desparza22 3
  • Converted graphs not showing

    Converted graphs not showing

    Thank you for sharing this project! I didn't list this as a bug because I wasn't sure if maybe I was doing something wrong. I seem to run into trouble inside of the Path Complexity REPL. I was able to convert the first file I tried (a Java file), but I noticed the graph said "Lines of code: None", so I decided to try a second to see if maybe there was an issue with the first. Converting the second file resulted in "Converted Successfully", but then unlike the first, no name for the graph was printed to the terminal. I tried "list graphs", and got "No graphs available". The same thing happened when I quit and tried again. Maybe it is an issue with the file itself, but it is a very simple file in terms of structure, and very similar to the first which converted successfully. The only difference between the two is that the first calls static functions whereas the second creates an object and calls functions on the object. All functions and variables in each file are contained within a single object. Thank you for your help! Let me know if I can further explain any of these issues.

    opened by desparza22 2
  • show metrics displays a table

    show metrics displays a table

    "show metrics" displays a table similar to the table when "metrics" is called. NOTE: cannot display time since runtime of each complexity eval is not stored

    opened by sdev49 1
  • Bump numpy from 1.19.4 to 1.22.0

    Bump numpy from 1.19.4 to 1.22.0

    Bumps numpy from 1.19.4 to 1.22.0.

    Release notes

    Sourced from numpy's releases.

    v1.22.0

    NumPy 1.22.0 Release Notes

    NumPy 1.22.0 is a big release featuring the work of 153 contributors spread over 609 pull requests. There have been many improvements, highlights are:

    • Annotations of the main namespace are essentially complete. Upstream is a moving target, so there will likely be further improvements, but the major work is done. This is probably the most user visible enhancement in this release.
    • A preliminary version of the proposed Array-API is provided. This is a step in creating a standard collection of functions that can be used across application such as CuPy and JAX.
    • NumPy now has a DLPack backend. DLPack provides a common interchange format for array (tensor) data.
    • New methods for quantile, percentile, and related functions. The new methods provide a complete set of the methods commonly found in the literature.
    • A new configurable allocator for use by downstream projects.

    These are in addition to the ongoing work to provide SIMD support for commonly used functions, improvements to F2PY, and better documentation.

    The Python versions supported in this release are 3.8-3.10, Python 3.7 has been dropped. Note that 32 bit wheels are only provided for Python 3.8 and 3.9 on Windows, all other wheels are 64 bits on account of Ubuntu, Fedora, and other Linux distributions dropping 32 bit support. All 64 bit wheels are also linked with 64 bit integer OpenBLAS, which should fix the occasional problems encountered by folks using truly huge arrays.

    Expired deprecations

    Deprecated numeric style dtype strings have been removed

    Using the strings "Bytes0", "Datetime64", "Str0", "Uint32", and "Uint64" as a dtype will now raise a TypeError.

    (gh-19539)

    Expired deprecations for loads, ndfromtxt, and mafromtxt in npyio

    numpy.loads was deprecated in v1.15, with the recommendation that users use pickle.loads instead. ndfromtxt and mafromtxt were both deprecated in v1.17 - users should use numpy.genfromtxt instead with the appropriate value for the usemask parameter.

    (gh-19615)

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Getting the message

    Getting the message "Converted without errors, but no graphs created"

    /app/code > convert /app/Simple2.java

    processing /app/Simple2.java ~~~ CONVERTED SUCCESSFULLY ~~~ Converted without errors, but no graphs created.

    I am getting the following message on trying to convert a simple Java program into the control flow graph.

    Following is the program itself

    public class Simple2 {  
        static void p(){  
              System.out.println("hello");  
              p();  
        }  
      
        public static void main(String[] args) {  
              p();  
        }  
    }  
    
    

    What am I missing ?

    opened by rahulsee 0
Releases(1.1.0)
  • 1.1.0(Jan 9, 2021)

    Updated coverage status checks

    Added tests & improved existing tests

    Refactored graphs and split up into multiple subtypes

    • Created a GenericGraph parent class as well as a Graph interface, which are inherited and implemented by EdgeListGraph, AdjListGraph, and AdjMatGraph.

    Cleaned up klee experiment scripts, creating KleeExperimentHandler for easier experiment modification and creation in the future.

    Source code(tar.gz)
    Source code(zip)
  • 1.0.0(Dec 7, 2020)

  • 0.0.1(Sep 26, 2020)

Owner
null
Robocop is a tool that performs static code analysis of Robot Framework code.

Robocop Introduction Documentation Values Requirements Installation Usage Example Robotidy FAQ Watch our talk from RoboCon 2021 about Robocop and Robo

marketsquare 132 Dec 29, 2022
Collects all accepted (partial and full scored) codes submitted within the given timeframe and saves them locally for plagiarism check.

Collects all accepted (partial and full scored) codes submitted within the given timeframe of any contest.

ARITRA BELEL 2 Dec 28, 2021
Code audit tool for python.

Pylama Code audit tool for Python and JavaScript. Pylama wraps these tools: pycodestyle (formerly pep8) © 2012-2013, Florent Xicluna; pydocstyle (form

Kirill Klenov 966 Dec 29, 2022
CodeAnalysis - Static Code Analysis: a code comprehensive analysis platform

TCA, Tencent Cloud Code Analysis English | 简体中文 What is TCA Tencent Cloud Code A

Tencent 1.3k Jan 7, 2023
A static analysis tool for Python

pyanalyze Pyanalyze is a tool for programmatically detecting common mistakes in Python code, such as references to undefined variables and some catego

Quora 212 Jan 7, 2023
TidyPy is a tool that encapsulates a number of other static analysis tools and makes it easy to configure, execute, and review their results.

TidyPy Contents Overview Features Usage Docker Configuration Ignoring Issues Included Tools Included Reporters Included Integrations Extending TidyPy

Jason Simeone 33 Nov 27, 2022
Alarmer is a tool focus on error reporting for your application.

alarmer Alarmer is a tool focus on error reporting for your application. Installation pip install alarmer Usage It's simple to integrate alarmer in yo

long2ice 20 Jul 3, 2022
Pymwp is a tool for automatically performing static analysis on programs written in C

pymwp: MWP analysis in Python pymwp is a tool for automatically performing static analysis on programs written in C, inspired by "A Flow Calculus of m

Static Analyses of Program Flows: Types and Certificate for Complexity 2 Dec 2, 2022
Turn your Python and Javascript code into DOT flowcharts

Notes from 2017 This is an older project which I am no longer working on. It was built before ES6 existed and before Python 3 had much usage. While it

Scott Rogowski 3k Jan 9, 2023
Find dead Python code

Vulture - Find dead code Vulture finds unused code in Python programs. This is useful for cleaning up and finding errors in large code bases. If you r

Jendrik Seipp 2.4k Jan 3, 2023
The uncompromising Python code formatter

The Uncompromising Code Formatter “Any color you like.” Black is the uncompromising Python code formatter. By using it, you agree to cede control over

Python Software Foundation 30.7k Dec 28, 2022
A static type analyzer for Python code

pytype - ? ✔ Pytype checks and infers types for your Python code - without requiring type annotations. Pytype can: Lint plain Python code, flagging c

Google 4k Dec 31, 2022
Guesslang detects the programming language of a given source code

Detect the programming language of a source code

Y. SOMDA 618 Dec 29, 2022
Learning source code review, spot vulnerability, find some ways how to fix it.

Learn Source Code Review Learning source code review, spot vulnerability, find some ways how to fix it. WordPress Plugin Authenticated Stored XSS on C

Shan 24 Dec 31, 2022
Print a directory tree structure in your Python code.

directory-structure Print a directory tree structure in your Python code. Download You can simply: pip install directory-structure Or you can also: Cl

Gabriel Stork 45 Dec 19, 2022
An app to show the total number of lines of code written by an user.

Lines of code Have you ever wondered how many lines of code you wrote in github? This tool will calculate it for you! To calculate the total number of

B.Jothin kumar 10 Jan 26, 2022
Python package to parse and generate C/C++ code as context aware preprocessor.

Devana Devana is a python tool that make it easy to parsing, format, transform and generate C++ (or C) code. This tool uses libclang to parse the code

null 5 Dec 28, 2022
Find usage statistics (imports, function calls, attribute access) for Python code-bases

Python Library stats This is a small library that allows you to query some useful statistics for Python code-bases. We currently report library import

Francisco Massa 13 May 2, 2022
A very minimalistic python module that lets you track the time your code snippets take to run.

Clock Keeper A very minimalistic python module that lets you track the time your code snippets take to run. This package is available on PyPI! Run the

Rajdeep Biswas 1 Jan 19, 2022