-
Notifications
You must be signed in to change notification settings - Fork 717
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
Improve documentation #226
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.
Merged with some modifications.
@@ -1 +1,22 @@ | |||
# Developer guide | |||
|
|||
Sonar was designed with extensibility in mind. There are 3 main concepts that a | |||
sonar developer needs to know about: |
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.
Let's just use developer
instead of sonar developer
.
Sonar was designed with extensibility in mind. There are 3 main concepts that a | ||
sonar developer needs to know about: | ||
|
||
* `rule`: It is a test that is run on an asset (website, HTML file, image, |
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 is a test
=> Is a test
use them without having to do a Pull Request to the main project. They can even | ||
be distributed as `npm` packages. | ||
|
||
Even though sonar is developed using [TypeScript](http://www.typescriptlang.org/), |
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.
httpS
|
||
Any developer can create their own `rule`s, `collector`s, and/or `formatter`s and | ||
use them without having to do a Pull Request to the main project. They can even | ||
be distributed as `npm` packages. |
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.
[`npm`](https://www.npmjs.com/)
|
||
To create a new rule you just need to: | ||
|
||
* Create a `new-rule.ts` file in a folder with the same name of the rule |
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.
Let's use <rule_name>.ts
Getting started with sonar's CLI is really easy. First you need to install it: | ||
|
||
```bash | ||
npm install -g sonarwhal@sonar |
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.
@sonarwhal/sonar
``` | ||
|
||
This command will start a wizard that will ask you a series of questions (what | ||
collector to use, what formatter, what rules, etc.). Answer them and you will |
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.
which rules
[rules documentation](./rules/). | ||
|
||
Sometimes you want to enable a rule but not for all the domains a website | ||
depends on. For example, if your website loads some external library from a cdn |
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.
CDN
The value of the property has to be an array of strings where the strings can be: | ||
|
||
* `*` if you want to ignore all rules for the given domain. | ||
* A rule id with the rules to ignore. |
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.
the ID of the rule to be ignored
A `formatter` takes the results of executing all the rules and transforms them to | ||
be consumed by the user. A `formatter` can output the results via the `console` in | ||
different formats, a `JSON` file, `XML`, etc. | ||
Please reach [the current list of supported `formatter`s](./formatters/) to know |
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.
reach -> see
@@ -1,5 +1,7 @@ | |||
# Rules | |||
|
|||
> The rules should be groupped by category |
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.
Done in eb58ba6.
* `json`: Will do a `JSON.stringify()` of the results so the output will not be | ||
user friendly: | ||
|
||
> PICTURE WITH THE OUTPUT HERE!! |
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.
@molant Added text output for now. We can also add images, but using text is easier to update, also more accessible I guess, etc.
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.
But we will miss the colors and formatting. We should use alt for accessibility.
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.
Done in 687692b.
Fix #162
Work on #225