Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems With Solhint Plugins #169

Open
Jaime-Iglesias opened this issue Apr 1, 2020 · 23 comments
Open

Problems With Solhint Plugins #169

Jaime-Iglesias opened this issue Apr 1, 2020 · 23 comments

Comments

@Jaime-Iglesias
Copy link

Jaime-Iglesias commented Apr 1, 2020

I'm trying to use the rules on a custom solhint plugin by changing the .solhint.json configuration file.
The rules themselves work as I can lint the file manually using the terminal and I get the expected errors, but I cannot manage to make the Solidity plugin itself detect these custom rules.

I have changed the settings to explicitly use solhint as per the documentation i.e

"solidity.linter": "solhint",
"solidity.solhintRules": {
  "avoid-sha3": "warn"
}

And I have changed the .solhint.json as per the Solhint docs too.

Any idea of what I am doing wrong?

@juanfranblanco
Copy link
Owner

@Jaime-Iglesias is the .solhint.json file at root?

@Jaime-Iglesias
Copy link
Author

@juanfranblanco yep

structure

@juanfranblanco
Copy link
Owner

@Jaime-Iglesias First test without .solhint.json:
image
image

@Jaime-Iglesias
Copy link
Author

@juanfranblanco without the .solhint.json and with it, the rules in the settings work just fine

test

test

@juanfranblanco
Copy link
Owner

Ok I have tested it again with a file:

image

image

image

@juanfranblanco
Copy link
Owner

juanfranblanco commented Apr 1, 2020

And to make sure it just works with the file:

image

image
image

What it may have happened is that you need to restart vscode due to a problem before. Try again by adding the file. A syntax error might have caused a crash.

@Jaime-Iglesias
Copy link
Author

Jaime-Iglesias commented Apr 1, 2020

hmmm, the problem does not seem to be with the file but with the extension not being able to detect the solhint plugin since it's clear that the rules in the .solhint.json that do not belong to the custom plugin are being enforced

test

test

test

@juanfranblanco
Copy link
Owner

Ahh I got you, yes the extension does not recognize plugins, where do you host your plugins?

@Jaime-Iglesias
Copy link
Author

Ahh I got you, yes the extension does not recognize plugins, where do you host your plugins?

What do you mean where I host ? I install them locally after publishing them (as per the solhint docs), hope that answers the question haha

@juanfranblanco
Copy link
Owner

Yes if you install them locally the extension might not be able to find them. I do need to do some research on this, or raise it with the solium guys.

@Jaime-Iglesias
Copy link
Author

Yes if you install them locally the extension might not be able to find them. I do need to do some research on this, or raise it with the solium guys.

So if they are globally installed they do work ? (haven't tried that option yet) also thank you

@juanfranblanco
Copy link
Owner

At the moment the extension does not load the plugins section, i can add that and check it globally.

@Jaime-Iglesias
Copy link
Author

At the moment the extension does not load the plugins section, i can add that and check it globally.

That would be great!

Ofc, ideally, loading them locally would be huge but progress is progress, thx again.

@juanfranblanco
Copy link
Owner

@Jaime-Iglesias quick test, it does not work i have added the no-foos rules install your package globally and nothing, it will have to be find and loaded dynamically by the extension into solhint, similar to prettier.

@Jaime-Iglesias
Copy link
Author

Jaime-Iglesias commented Apr 1, 2020

@Jaime-Iglesias quick test, it does not work i have added the no-foos rules install your package globally and nothing, it will have to be find and loaded dynamically by the extension into solhint, similar to prettier.

@juanfranblanco I just tried it myself too but no luck either, it's weird since solhint supports plugins out of the box, I guess it's causde by how the Extension itself manages all these packages

@juanfranblanco
Copy link
Owner

juanfranblanco commented Apr 1, 2020

@Jaime-Iglesias looking at the source would have been faster https://github.com/protofire/solhint/blob/32ec781509c9b76db325d0c2db91c8c478441d6a/lib/rules/index.js#L53

there is a require there, which won't be triggered as the extensions cannot access those. Prettier provides a path setting that allows for the discovery of plugins, something they could implement.

@Jaime-Iglesias
Copy link
Author

Jaime-Iglesias commented Apr 1, 2020

@Jaime-Iglesias looking at the source would have been faster https://github.com/protofire/solhint/blob/32ec781509c9b76db325d0c2db91c8c478441d6a/lib/rules/index.js#L53

there is a require there, which won't be triggered as the extensions cannot access those. Prettier provides a path setting that allows for the discovery of plugins, something they could implement.

I see, so it's a solhint problem after all - I wonder if they will manage to fix it, I don't know how active the project is.

@juanfranblanco
Copy link
Owner

@Jaime-Iglesias I have added an issue for this protofire/solhint#206

@Jaime-Iglesias
Copy link
Author

@Jaime-Iglesias I have added an issue for this protofire/solhint#206

@juanfranblanco much appreciated, hopefully they will be able to support this, as I think it defenitely can bring a lot of value for both projects.

@Jaime-Iglesias
Copy link
Author

Hey @juanfranblanco I hope you are doing well,

Is there any update regarding this issue and #170 ?

stay safe !

@Jaime-Iglesias
Copy link
Author

friendly ping @juanfranblanco

@juanfranblanco
Copy link
Owner

juanfranblanco commented Apr 20, 2020

@Jaime-Iglesias thanks for the ping!! I do need this as sometimes notifications get lost (you can find me in the Nethereum gitter if you need anything). The issue is still open with the solhint guys / gals, the best way is to chase that issue there, once is fixed on their side it could be integrated here.

@Jaime-Iglesias
Copy link
Author

@Jaime-Iglesias thanks for the ping!! I do need this as sometimes notifications get lost (you can find me in the Nethereum gitter if you need anything). The issue is still open with the solhint guys / gals, the best way is to chase that issue there, once is fixed on their side it could be integrated here.

Ah I see, I thought it was depending on you - sorry about that hahaha! Thanks and stay safe !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants