goodcheck 2.4.0 → 2.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +37 -37
- data/docusaurus/.dockerignore +2 -0
- data/docusaurus/.gitignore +12 -0
- data/docusaurus/Dockerfile +10 -0
- data/docusaurus/docker-compose.yml +18 -0
- data/docusaurus/docs/commands.md +69 -0
- data/docusaurus/docs/configuration.md +300 -0
- data/docusaurus/docs/development.md +15 -0
- data/docusaurus/docs/getstarted.md +46 -0
- data/docusaurus/docs/rules.md +79 -0
- data/docusaurus/website/README.md +193 -0
- data/docusaurus/website/core/Footer.js +100 -0
- data/docusaurus/website/package.json +14 -0
- data/docusaurus/website/pages/en/index.js +207 -0
- data/docusaurus/website/pages/en/versions.js +118 -0
- data/docusaurus/website/sidebars.json +11 -0
- data/docusaurus/website/siteConfig.js +171 -0
- data/docusaurus/website/static/css/code-block-buttons.css +39 -0
- data/docusaurus/website/static/css/custom.css +245 -0
- data/docusaurus/website/static/img/favicon.ico +0 -0
- data/docusaurus/website/static/js/code-block-buttons.js +47 -0
- data/docusaurus/website/versioned_docs/version-1.0.0/commands.md +70 -0
- data/docusaurus/website/versioned_docs/version-1.0.0/configuration.md +296 -0
- data/docusaurus/website/versioned_docs/version-1.0.0/development.md +16 -0
- data/docusaurus/website/versioned_docs/version-1.0.0/getstarted.md +47 -0
- data/docusaurus/website/versioned_docs/version-1.0.0/rules.md +81 -0
- data/docusaurus/website/versioned_docs/version-1.0.2/rules.md +79 -0
- data/docusaurus/website/versioned_docs/version-2.4.0/configuration.md +301 -0
- data/docusaurus/website/versioned_sidebars/version-1.0.0-sidebars.json +11 -0
- data/docusaurus/website/versioned_sidebars/version-1.0.2-sidebars.json +11 -0
- data/docusaurus/website/versioned_sidebars/version-2.4.0-sidebars.json +11 -0
- data/docusaurus/website/versions.json +6 -0
- data/docusaurus/website/yarn.lock +6674 -0
- data/goodcheck.gemspec +1 -1
- data/lib/goodcheck.rb +1 -0
- data/lib/goodcheck/version.rb +1 -1
- metadata +36 -4
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
id: development
|
3
|
+
title: Development
|
4
|
+
sidebar_label: Development
|
5
|
+
---
|
6
|
+
|
7
|
+
## Development
|
8
|
+
|
9
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
10
|
+
|
11
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
12
|
+
|
13
|
+
## Contributing
|
14
|
+
|
15
|
+
Bug reports and pull requests are welcome on [GitHub](https://github.com/sider/goodcheck).
|
@@ -0,0 +1,46 @@
|
|
1
|
+
---
|
2
|
+
id: getstarted
|
3
|
+
title: Getting Started
|
4
|
+
sidebar_label: Get Started
|
5
|
+
---
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
```bash
|
10
|
+
$ gem install goodcheck
|
11
|
+
```
|
12
|
+
|
13
|
+
Or you can use `bundler`!
|
14
|
+
|
15
|
+
If you would not like to install Goodcheck to system (e.g. you would not like to install Ruby 2.4 or higher), you can use a docker image. [See below](#docker-images).
|
16
|
+
|
17
|
+
## Docker Images
|
18
|
+
|
19
|
+
We provide Docker images of Goodcheck so that you can try Goodcheck without installing them.
|
20
|
+
|
21
|
+
- https://hub.docker.com/r/sider/goodcheck/
|
22
|
+
|
23
|
+
```bash
|
24
|
+
$ docker pull sider/goodcheck
|
25
|
+
$ docker run -t --rm -v "$(pwd):/work" sider/goodcheck check
|
26
|
+
```
|
27
|
+
|
28
|
+
The default `latest` tag points to the latest release of Goodcheck.
|
29
|
+
You can pick a version of Goodcheck from [tags page](https://hub.docker.com/r/sider/goodcheck/tags).
|
30
|
+
|
31
|
+
## Quickstart
|
32
|
+
|
33
|
+
```bash
|
34
|
+
$ goodcheck init
|
35
|
+
$ vim goodcheck.yml
|
36
|
+
$ goodcheck check
|
37
|
+
```
|
38
|
+
|
39
|
+
The `init` command generates a template of `goodcheck.yml` configuration file for you.
|
40
|
+
Edit the config file to define patterns you want to check.
|
41
|
+
Then run `check` command, and it will print matched texts.
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
|
@@ -0,0 +1,79 @@
|
|
1
|
+
---
|
2
|
+
id: rules
|
3
|
+
title: Rules
|
4
|
+
sidebar_label: Rules
|
5
|
+
---
|
6
|
+
|
7
|
+
|
8
|
+
## Rule: `"_blank"` Security Issue
|
9
|
+
|
10
|
+
When `target = "_blank"` is used, the opened page can access the original window object and potentially redirect the original page to a malicious URL. In this example, the rule will look for patterns of `"_blank"` and suggest to use `rel="noopener"` to prevent the opened page from having access.
|
11
|
+
|
12
|
+
```yaml
|
13
|
+
rules:
|
14
|
+
- id: security.link
|
15
|
+
pattern:
|
16
|
+
- token: 'target="_blank"'
|
17
|
+
- token: 'target: "_blank"'
|
18
|
+
message: |
|
19
|
+
Specify rel="noopener" for security reasons.
|
20
|
+
|
21
|
+
Opening new tab without rel="noopener" may cause a security issue.
|
22
|
+
It allows modifying original tab URLs from opened tabs.
|
23
|
+
justification:
|
24
|
+
- When opening a URL in our service
|
25
|
+
glob:
|
26
|
+
- "**/*.html"
|
27
|
+
- "**/*.html.erb"
|
28
|
+
fail:
|
29
|
+
- '<a href="https://github.com" target="_blank">GitHub</a>'
|
30
|
+
pass:
|
31
|
+
- '<a href="/signup">Signup</a>'
|
32
|
+
```
|
33
|
+
|
34
|
+
## Rule: Sign in
|
35
|
+
> Warning: This rule needs customization.
|
36
|
+
|
37
|
+
Keep wording consistent to provide a clear experience for users. In this example, the use of Log in or Log out would prompt the use of sign in / sign out instead.
|
38
|
+
|
39
|
+
```yaml
|
40
|
+
rules:
|
41
|
+
- id: wording.signin
|
42
|
+
pattern:
|
43
|
+
- token: Log in
|
44
|
+
case_sensitive: false
|
45
|
+
- token: Log out
|
46
|
+
case_sensitive: false
|
47
|
+
glob:
|
48
|
+
- "**/*.html.erb"
|
49
|
+
- "**/*.yml"
|
50
|
+
message: |
|
51
|
+
Please use “sign in”/“sign out”
|
52
|
+
|
53
|
+
We use “sign in” instead of “log in” and “sign out” instead of “log out”.
|
54
|
+
See the wording policy for details.
|
55
|
+
|
56
|
+
https://docs.example.com/1840
|
57
|
+
fail:
|
58
|
+
- "Log in"
|
59
|
+
- "Log out"
|
60
|
+
pass:
|
61
|
+
- "Sign in"
|
62
|
+
- "Sign out"
|
63
|
+
```
|
64
|
+
|
65
|
+
## Rule: mixin
|
66
|
+
> Warning: This rule needs customization.
|
67
|
+
|
68
|
+
A mixin lets you make groups of CSS declarations that you want to reuse throughout your site. In this example, it creates a warning when the color pattern is used and suggests using a mixin instead.
|
69
|
+
|
70
|
+
```yaml
|
71
|
+
rules:
|
72
|
+
- id: use-mixin
|
73
|
+
message: Use mixin.
|
74
|
+
pattern: "color: #038cf4;"
|
75
|
+
pass:
|
76
|
+
- "@include some-mixin;"
|
77
|
+
fail:
|
78
|
+
- "color: #038cf4;"
|
79
|
+
```
|
@@ -0,0 +1,193 @@
|
|
1
|
+
This website was created with [Docusaurus](https://docusaurus.io/).
|
2
|
+
|
3
|
+
# What's In This Document
|
4
|
+
|
5
|
+
* [Get Started in 5 Minutes](#get-started-in-5-minutes)
|
6
|
+
* [Directory Structure](#directory-structure)
|
7
|
+
* [Editing Content](#editing-content)
|
8
|
+
* [Adding Content](#adding-content)
|
9
|
+
* [Full Documentation](#full-documentation)
|
10
|
+
|
11
|
+
# Get Started in 5 Minutes
|
12
|
+
|
13
|
+
1. Make sure all the dependencies for the website are installed:
|
14
|
+
|
15
|
+
```sh
|
16
|
+
# Install dependencies
|
17
|
+
$ yarn
|
18
|
+
```
|
19
|
+
2. Run your dev server:
|
20
|
+
|
21
|
+
```sh
|
22
|
+
# Start the site
|
23
|
+
$ yarn start
|
24
|
+
```
|
25
|
+
|
26
|
+
## Directory Structure
|
27
|
+
|
28
|
+
Your project file structure should look something like this
|
29
|
+
|
30
|
+
```
|
31
|
+
my-docusaurus/
|
32
|
+
docs/
|
33
|
+
doc-1.md
|
34
|
+
doc-2.md
|
35
|
+
doc-3.md
|
36
|
+
website/
|
37
|
+
blog/
|
38
|
+
2016-3-11-oldest-post.md
|
39
|
+
2017-10-24-newest-post.md
|
40
|
+
core/
|
41
|
+
node_modules/
|
42
|
+
pages/
|
43
|
+
static/
|
44
|
+
css/
|
45
|
+
img/
|
46
|
+
package.json
|
47
|
+
sidebar.json
|
48
|
+
siteConfig.js
|
49
|
+
```
|
50
|
+
|
51
|
+
# Editing Content
|
52
|
+
|
53
|
+
## Editing an existing docs page
|
54
|
+
|
55
|
+
Edit docs by navigating to `docs/` and editing the corresponding document:
|
56
|
+
|
57
|
+
`docs/doc-to-be-edited.md`
|
58
|
+
|
59
|
+
```markdown
|
60
|
+
---
|
61
|
+
id: page-needs-edit
|
62
|
+
title: This Doc Needs To Be Edited
|
63
|
+
---
|
64
|
+
|
65
|
+
Edit me...
|
66
|
+
```
|
67
|
+
|
68
|
+
For more information about docs, click [here](https://docusaurus.io/docs/en/navigation)
|
69
|
+
|
70
|
+
## Editing an existing blog post
|
71
|
+
|
72
|
+
Edit blog posts by navigating to `website/blog` and editing the corresponding post:
|
73
|
+
|
74
|
+
`website/blog/post-to-be-edited.md`
|
75
|
+
```markdown
|
76
|
+
---
|
77
|
+
id: post-needs-edit
|
78
|
+
title: This Blog Post Needs To Be Edited
|
79
|
+
---
|
80
|
+
|
81
|
+
Edit me...
|
82
|
+
```
|
83
|
+
|
84
|
+
For more information about blog posts, click [here](https://docusaurus.io/docs/en/adding-blog)
|
85
|
+
|
86
|
+
# Adding Content
|
87
|
+
|
88
|
+
## Adding a new docs page to an existing sidebar
|
89
|
+
|
90
|
+
1. Create the doc as a new markdown file in `/docs`, example `docs/newly-created-doc.md`:
|
91
|
+
|
92
|
+
```md
|
93
|
+
---
|
94
|
+
id: newly-created-doc
|
95
|
+
title: This Doc Needs To Be Edited
|
96
|
+
---
|
97
|
+
|
98
|
+
My new content here..
|
99
|
+
```
|
100
|
+
|
101
|
+
1. Refer to that doc's ID in an existing sidebar in `website/sidebar.json`:
|
102
|
+
|
103
|
+
```javascript
|
104
|
+
// Add newly-created-doc to the Getting Started category of docs
|
105
|
+
{
|
106
|
+
"docs": {
|
107
|
+
"Getting Started": [
|
108
|
+
"quick-start",
|
109
|
+
"newly-created-doc" // new doc here
|
110
|
+
],
|
111
|
+
...
|
112
|
+
},
|
113
|
+
...
|
114
|
+
}
|
115
|
+
```
|
116
|
+
|
117
|
+
For more information about adding new docs, click [here](https://docusaurus.io/docs/en/navigation)
|
118
|
+
|
119
|
+
## Adding a new blog post
|
120
|
+
|
121
|
+
1. Make sure there is a header link to your blog in `website/siteConfig.js`:
|
122
|
+
|
123
|
+
`website/siteConfig.js`
|
124
|
+
```javascript
|
125
|
+
headerLinks: [
|
126
|
+
...
|
127
|
+
{ blog: true, label: 'Blog' },
|
128
|
+
...
|
129
|
+
]
|
130
|
+
```
|
131
|
+
|
132
|
+
2. Create the blog post with the format `YYYY-MM-DD-My-Blog-Post-Title.md` in `website/blog`:
|
133
|
+
|
134
|
+
`website/blog/2018-05-21-New-Blog-Post.md`
|
135
|
+
|
136
|
+
```markdown
|
137
|
+
---
|
138
|
+
author: Frank Li
|
139
|
+
authorURL: https://twitter.com/foobarbaz
|
140
|
+
authorFBID: 503283835
|
141
|
+
title: New Blog Post
|
142
|
+
---
|
143
|
+
|
144
|
+
Lorem Ipsum...
|
145
|
+
```
|
146
|
+
|
147
|
+
For more information about blog posts, click [here](https://docusaurus.io/docs/en/adding-blog)
|
148
|
+
|
149
|
+
## Adding items to your site's top navigation bar
|
150
|
+
|
151
|
+
1. Add links to docs, custom pages or external links by editing the headerLinks field of `website/siteConfig.js`:
|
152
|
+
|
153
|
+
`website/siteConfig.js`
|
154
|
+
```javascript
|
155
|
+
{
|
156
|
+
headerLinks: [
|
157
|
+
...
|
158
|
+
/* you can add docs */
|
159
|
+
{ doc: 'my-examples', label: 'Examples' },
|
160
|
+
/* you can add custom pages */
|
161
|
+
{ page: 'help', label: 'Help' },
|
162
|
+
/* you can add external links */
|
163
|
+
{ href: 'https://github.com/facebook/Docusaurus', label: 'GitHub' },
|
164
|
+
...
|
165
|
+
],
|
166
|
+
...
|
167
|
+
}
|
168
|
+
```
|
169
|
+
|
170
|
+
For more information about the navigation bar, click [here](https://docusaurus.io/docs/en/navigation)
|
171
|
+
|
172
|
+
## Adding custom pages
|
173
|
+
|
174
|
+
1. Docusaurus uses React components to build pages. The components are saved as .js files in `website/pages/en`:
|
175
|
+
1. If you want your page to show up in your navigation header, you will need to update `website/siteConfig.js` to add to the `headerLinks` element:
|
176
|
+
|
177
|
+
`website/siteConfig.js`
|
178
|
+
```javascript
|
179
|
+
{
|
180
|
+
headerLinks: [
|
181
|
+
...
|
182
|
+
{ page: 'my-new-custom-page', label: 'My New Custom Page' },
|
183
|
+
...
|
184
|
+
],
|
185
|
+
...
|
186
|
+
}
|
187
|
+
```
|
188
|
+
|
189
|
+
For more information about custom pages, click [here](https://docusaurus.io/docs/en/custom-pages).
|
190
|
+
|
191
|
+
# Full Documentation
|
192
|
+
|
193
|
+
Full documentation can be found on the [website](https://docusaurus.io/).
|
@@ -0,0 +1,100 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) 2017-present, Facebook, Inc.
|
3
|
+
*
|
4
|
+
* This source code is licensed under the MIT license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
|
8
|
+
const React = require('react');
|
9
|
+
|
10
|
+
class Footer extends React.Component {
|
11
|
+
docUrl(doc) {
|
12
|
+
const baseUrl = this.props.config.baseUrl;
|
13
|
+
const docsUrl = this.props.config.docsUrl;
|
14
|
+
const docsPart = `${docsUrl ? `${docsUrl}/` : ''}`;
|
15
|
+
return `${baseUrl}${docsPart}${doc}`;
|
16
|
+
}
|
17
|
+
|
18
|
+
pageUrl(doc, language) {
|
19
|
+
const baseUrl = this.props.config.baseUrl;
|
20
|
+
return baseUrl + (language ? `${language}/` : '') + doc;
|
21
|
+
}
|
22
|
+
|
23
|
+
render() {
|
24
|
+
return (
|
25
|
+
<footer className="nav-footer" id="footer">
|
26
|
+
<section className="sitemap">
|
27
|
+
<a href={this.props.config.baseUrl} className="nav-home">
|
28
|
+
{this.props.config.footerIcon && (
|
29
|
+
<img
|
30
|
+
src={this.props.config.baseUrl + this.props.config.footerIcon}
|
31
|
+
alt={this.props.config.title}
|
32
|
+
width="40"
|
33
|
+
height="39"
|
34
|
+
/>
|
35
|
+
)}
|
36
|
+
</a>
|
37
|
+
<div>
|
38
|
+
<h5>Docs</h5>
|
39
|
+
<a href={this.docUrl('getstarted.html')}>
|
40
|
+
Getting Started
|
41
|
+
</a>
|
42
|
+
<a href={this.docUrl('configuration.html')}>
|
43
|
+
Configuration
|
44
|
+
</a>
|
45
|
+
<a href={this.docUrl('rules.html')}>
|
46
|
+
Rules
|
47
|
+
</a>
|
48
|
+
<a href={this.docUrl('commands.html')}>
|
49
|
+
Commands
|
50
|
+
</a>
|
51
|
+
<a href={this.docUrl('development.html')}>
|
52
|
+
Development
|
53
|
+
</a>
|
54
|
+
</div>
|
55
|
+
<div>
|
56
|
+
<h5>More</h5>
|
57
|
+
<a href="https://github.com/sider/goodcheck">GitHub</a>
|
58
|
+
<a
|
59
|
+
className="github-button"
|
60
|
+
href={this.props.config.repoUrl}
|
61
|
+
data-icon="octicon-star"
|
62
|
+
data-count-href="/sider/goodcheck/stargazers"
|
63
|
+
data-show-count="true"
|
64
|
+
data-count-aria-label="# stargazers on GitHub"
|
65
|
+
aria-label="Star this project on GitHub">
|
66
|
+
Star
|
67
|
+
</a>
|
68
|
+
{this.props.config.twitterUsername && (
|
69
|
+
<div className="social">
|
70
|
+
<a
|
71
|
+
href={`https://twitter.com/${
|
72
|
+
this.props.config.twitterUsername
|
73
|
+
}`}
|
74
|
+
className="twitter-follow-button">
|
75
|
+
Follow @{this.props.config.twitterUsername}
|
76
|
+
</a>
|
77
|
+
</div>
|
78
|
+
)}
|
79
|
+
{this.props.config.facebookAppId && (
|
80
|
+
<div className="social">
|
81
|
+
<div
|
82
|
+
className="fb-like"
|
83
|
+
data-href={this.props.config.url}
|
84
|
+
data-colorscheme="dark"
|
85
|
+
data-layout="standard"
|
86
|
+
data-share="true"
|
87
|
+
data-width="225"
|
88
|
+
data-show-faces="false"
|
89
|
+
/>
|
90
|
+
</div>
|
91
|
+
)}
|
92
|
+
</div>
|
93
|
+
</section>
|
94
|
+
<section className="copyright">{this.props.config.copyright}</section>
|
95
|
+
</footer>
|
96
|
+
);
|
97
|
+
}
|
98
|
+
}
|
99
|
+
|
100
|
+
module.exports = Footer;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
{
|
2
|
+
"scripts": {
|
3
|
+
"examples": "docusaurus-examples",
|
4
|
+
"start": "docusaurus-start",
|
5
|
+
"build": "docusaurus-build",
|
6
|
+
"publish-gh-pages": "docusaurus-publish",
|
7
|
+
"write-translations": "docusaurus-write-translations",
|
8
|
+
"version": "docusaurus-version",
|
9
|
+
"rename-version": "docusaurus-rename-version"
|
10
|
+
},
|
11
|
+
"devDependencies": {
|
12
|
+
"docusaurus": "^1.12.0"
|
13
|
+
}
|
14
|
+
}
|