From a8191f41ad52582661bc9600d700012651244258 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Thu, 23 Apr 2020 14:40:07 +0530 Subject: [PATCH] remix-analyzer readme updated --- remix-analyzer/README.md | 63 ++++++++++++++++++++++++++++--------- remix-analyzer/package.json | 4 +-- 2 files changed, 51 insertions(+), 16 deletions(-) diff --git a/remix-analyzer/README.md b/remix-analyzer/README.md index 079f33f240..7987ebc382 100644 --- a/remix-analyzer/README.md +++ b/remix-analyzer/README.md @@ -1,26 +1,61 @@ -# Remix Analyzer +## Remix Analyzer +[![npm version](https://badge.fury.io/js/remix-analyzer.svg)](https://www.npmjs.com/package/remix-analyzer) +[![npm](https://img.shields.io/npm/dt/remix-analyzer.svg?label=Total%20Downloads)](https://www.npmjs.com/package/remix-analyzer) +[![npm](https://img.shields.io/npm/dw/remix-analyzer.svg)](https://www.npmjs.com/package/remix-analyzer) +[![GitHub](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/ethereum/remix/tree/master/remix-analyzer) +[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/ethereum/remix/issues) -## Install +`remix-analyzer` is a tool to perform static analysis on Solidity smart contracts to check security vulnerabilities and bad development practices. It works underneath Remix IDE plugin "SOLIDITY STATIC ANALYSIS" which is used to run analysis for a compiled contract according to selected modules. -```sh -npm i remix-analyzer -``` - -## Contribute +### Installation +`remix-analyzer` is an NPM package and can be installed using NPM as: -We need some better documentation. Besides that, we are always open to new features or bug reports. Open an issue or a pull request. +`npm install remix-analyzer` -### Tests +### How to use -Make sure that you add test cases. +`remix-analyzer` exports below interface: -```sh -npm run test ``` +import { CompilationResult, AnalyzerModule, AnalysisReport } from 'types'; +declare type ModuleObj = { + name: string; + mod: AnalyzerModule; +}; +export default class staticAnalysisRunner { + /** + * Run analysis (Used by IDE) + * @param compilationResult contract compilation result + * @param toRun module indexes (compiled from remix IDE) + * @param callback callback + */ + run(compilationResult: CompilationResult, toRun: number[], callback: ((reports: AnalysisReport[]) => void)): void; + + /** + * Run analysis passing list of modules to run + * @param compilationResult contract compilation result + * @param modules analysis module + * @param callback callback + */ + runWithModuleList(compilationResult: CompilationResult, modules: ModuleObj[], callback: ((reports: AnalysisReport[]) => void)): void; + + /** + * Get list of all analysis modules + */ + modules(): any[]; +} +``` +One can import the module and use the available methods to run analysis. Related type descriptions can be seen [here](https://github.com/ethereum/remix/blob/master/remix-analyzer/src/types.ts). + +Details of modules are explained in [official remix-ide documentation](https://remix-ide.readthedocs.io/en/latest/static_analysis.html). + +## Contribute + +We are always open to new features or bug reports. Please feel free to open an issue or a pull request. -The code style should conform to standard; make sure to your lint your code before submitting a PR. +In case you want to add some code, do have a look to our contribution guidelnes [here](https://github.com/ethereum/remix/blob/master/CONTRIBUTING.md). Reach us in [Gitter](https://gitter.im/ethereum/remix) in case of any queries. ## License -MIT (c) 2018 Remix Team +MIT © 2018-20 Remix Team diff --git a/remix-analyzer/package.json b/remix-analyzer/package.json index 328d2a2952..03be790953 100644 --- a/remix-analyzer/package.json +++ b/remix-analyzer/package.json @@ -1,7 +1,7 @@ { "name": "remix-analyzer", "version": "0.5.0-beta.2", - "description": "Remix Analyzer", + "description": "Tool to perform static analysis on Solidity smart contracts", "main": "./dist/index.js", "types": "./dist/index.d.ts", "contributors": [ @@ -36,7 +36,7 @@ }, "author": "Remix Team", "license": "MIT", - "homepage": "https://github.com/ethereum/remix#readme", + "homepage": "https://github.com/ethereum/remix/tree/master/remix-analyzer#readme", "devDependencies": { "@types/node": "^13.7.0", "babel-eslint": "^7.1.1",