duaraghav8 / Ethlint

(Formerly Solium) Code quality & Security Linter for Solidity
https://ethlint.readthedocs.io/en/latest/
MIT License
927 stars 128 forks source link

Allow solium to `fix` whenever it can when the user saves #236

Closed jaycenhorton closed 6 years ago

jaycenhorton commented 6 years ago

It would be fantastic if solium allowed a user option that automatically runs --fix whenever the user saves. Ideally this would be consumable in the same way as Prettier

duaraghav8 commented 6 years ago

@jaycenhorton Are you currently using Solium as a command-line utility or as part of a text editor / IDE? If as part of an editor, then the editor's solium integration is responsible for invoking solium's --fix every time a user saves. In that case, this issue needs to be raised with that integration's developers.

Or is there some other way you're thinking about this?

jaycenhorton commented 6 years ago

Currently, I'm using it as both. I run --fix before pushing to github, and I use the solidity vscode plugin which is also relying on solium.

I suppose I brought up this issue as more of a feature request/discussion. But it seems if there is no active development on the IDE side, I would assume this would be best opened on that repo?

duaraghav8 commented 6 years ago

This feature is not possible inside the linter itself due to the nature of the application - it is a cli tool (a long-running background process could monitor your code and run fix automatically, but a cli tool needs to be invoked).

In IDEs, the plugin providing Solium's services is what should be monitoring code for changes and running --fix. For your CLI use case, I think you can automate --fix using Git's Pre-commit hook.

jaycenhorton commented 6 years ago

Thanks @duaraghav8 I'll close this here and perhaps link back where appropriate

duaraghav8 commented 6 years ago

Let me know in case you have any other issues