Giter Site home page Giter Site logo

opencollective / ethlint Goto Github PK

View Code? Open in Web Editor NEW

This project forked from duaraghav8/ethlint

1.0 4.0 0.0 1.47 MB

(Formerly Solium) Linter to identify and fix style & security issues in Solidity

Home Page: https://www.ethlint.com/

License: MIT License

JavaScript 100.00%

ethlint's Introduction


Build Status Gitter chat

Ethlint (Formerly Solium) analyzes your Solidity code for style & security issues and fixes them.

See Documentation, Changelog and upcoming releases.

Before beginning to work on a contribution, please read the Guidelines.

Install

npm install -g ethlint
solium -V

For backward-compatibility, you can still use npm install -g solium.

If you're currently using the solium package for npm install, it is highly recommended that you move to ethlint. The solium package will not receive updates after April, 2019. There are no differences between the updates pushed to ethlint and solium packages.

Usage

In the root directory of your DApp:

solium --init

This creates 2 files for you:

  • .soliumignore - contains names of files and directories to ignore while linting
  • .soliumrc.json - contains configuration that tells Solium how to lint your project. You should modify this file to configure rules, plugins and sharable configs.

.soliumrc.json looks like:

{
  "extends": "solium:recommended",
  "plugins": ["security"],
  "rules": {
    "quotes": ["error", "double"],
    "indentation": ["error", 4],
    "linebreak-style": ["error", "unix"]
  }
}

To know which lint rules Solium applies for you, see Style rules and Security rules.


NOTE

Solium does not strictly adhere to Solidity Style Guide. It aims to promote coding practices agreed upon by the community at large.


Lint

solium -f foobar.sol
solium -d contracts/

Configure with comments

Comment Directives can be used to configure Solium to ignore specific pieces of code. They follow the pattern solium-disable<optional suffix>.

If you only use the directive, Solium disables all rules for the marked code. If that's not desirable, specify the rules to disable after the directive, separated by comma.

  • Disable linting on a specific line
contract Foo {
	/* solium-disable-next-line */
	function() {
		bytes32 bar = 'Hello world';	// solium-disable-line quotes

		// solium-disable-next-line security/no-throw, indentation
						throw;
	}
}
  • Disable linting on entire file
/* solium-disable */

contract Foo {
	...
}

Fix

Solium automatically fixes your code to resolve whatever issues it can.

solium -d contracts/ --fix

Our supporters

Ethereum Augur    Gitcoin

If Ethlint helped make your life simpler, please consider donating ETH to 0xacc661A56af9793a4437876a52F4Ad3fc3C443d6

ethlint's People

Contributors

alonski avatar cgewecke avatar chihchengliang avatar cisplatin avatar come-maiz avatar federicobond avatar fvictorio avatar gabrielalacchi avatar jooray avatar mushketyk avatar nemani avatar nuevoalex avatar romaric-juniet avatar sohkai avatar utkarsh23 avatar zzq0826 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.