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

Improve documentation #226

Closed
wants to merge 1 commit into from
Closed

Improve documentation #226

wants to merge 1 commit into from

Conversation

molant
Copy link
Member

@molant molant commented May 23, 2017

Fix #162
Work on #225

@molant molant requested review from alrra and sarvaje May 23, 2017 04:44
Copy link
Contributor

@alrra alrra left a 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:
Copy link
Contributor

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,
Copy link
Contributor

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/),
Copy link
Contributor

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.
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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.
Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reach -> see

@alrra alrra closed this in 02ee8af May 23, 2017
@@ -1,5 +1,7 @@
# Rules

> The rules should be groupped by category
Copy link
Contributor

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!!
Copy link
Contributor

@alrra alrra May 23, 2017

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.

Copy link
Member Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 687692b.

@molant molant deleted the documentation branch May 24, 2017 16:41
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

Successfully merging this pull request may close these issues.

2 participants