-
Notifications
You must be signed in to change notification settings - Fork 42
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
Remote configs #93
Remote configs #93
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. I left few comments. By the way, the idea of the remote configs(rules) was sliiiiightly another, however fetching them via http should work too.
@@ -109,10 +126,10 @@ example.go:5:10: !(v1 != v2) | |||
|
|||
It automatically inserts `Report("$$")` into the specified pattern. | |||
|
|||
## How does it work? | |||
## How it works |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My linter told me to do so. Namely, it is MD026 check. My motivation is that this is not an FAQ section, so you should answer questions, not to ask them. Also, Betteridge's law of headlines is a bit related as an example of why you should avoid question mark in headlines.
And as the last piece of motivation let's use crowd intelligence:
- https://github.com/search?q=%22How+it+works%22 (2 323 matches)
- https://github.com/search?q=%22How+does+it+work%22 (103 matches)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol, interesting
@@ -0,0 +1,17 @@ | |||
// This package tests rules specified in `rules.go` of ruleguard itself. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we reuse another rules and not create new?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean? This file exists because there are no tests for the root rules.go
yet. However, it's good to test them.
``` | ||
|
||
|
||
Create a test `example.go` target file: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what was the point to change this part of the README? 👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was not changed but rearranged. The text remains the same, git is bad at showing moved things. The motivation is to simplify the quick start.
Before:
- Quick start
- create example code
- create example rules
- run ruleguard using the created rules file
Now:
- Quick start
- create example code
- run ruleguard using remote rules
- Using custom rules
- create example rules
- run ruleguard using local rules
Do you mean distributing plugins as go packages? Yes, @quasilyte told me about it a bit, this is another good idea and it would be cool to have it eventually implemented. However, this network-based implementation has the advantage of zero-configuration allowing a faster start and easier reusing of rules between different projects. This is how shared configs are implemented in flakehell, for instance. |
I'm skeptical of raw http configs. |
💔 |
In a long run, it's always better to keep all the checks in your environment, sure. However, remote configs support opens a door for a faster start in both using ruleguard as a linter and distributing your own rules. Also, it solves the licensing question. Since |
via DSL it will be almost the same, but instead of a url, there will be an import. Regarding |
All review comments are addressed. |
Feel free to re-open if you change your mind |
Allow
-rules
option to be a remote URL. This makes ruleguard suitable to be used as a zero-configuration linter.[x] Tests included. They check a small file with a local and remote copy of
rules.go
. Later, this file should be duplicated to make it possible to test new checks that weren't introduced in themaster
branch yet.[x] README updated.
Minor changes:
if flagRules == ""
. Theif
body statement is unreachable.rules.go
right from the stream without reading it from the stream and then converting it into a stream again. It makes file reading a bit faster and memory-friendly.