goodcheck 2.5.2 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -3
  3. data/lib/goodcheck.rb +3 -1
  4. data/lib/goodcheck/cli.rb +78 -54
  5. data/lib/goodcheck/commands/check.rb +19 -1
  6. data/lib/goodcheck/commands/config_loading.rb +19 -2
  7. data/lib/goodcheck/commands/init.rb +4 -2
  8. data/lib/goodcheck/commands/pattern.rb +2 -1
  9. data/lib/goodcheck/commands/test.rb +5 -4
  10. data/lib/goodcheck/config_loader.rb +5 -4
  11. data/lib/goodcheck/error.rb +3 -0
  12. data/lib/goodcheck/exit_status.rb +6 -0
  13. data/lib/goodcheck/glob.rb +14 -3
  14. data/lib/goodcheck/import_loader.rb +25 -9
  15. data/lib/goodcheck/version.rb +1 -1
  16. metadata +5 -55
  17. data/.github/dependabot.yml +0 -18
  18. data/.github/workflows/release.yml +0 -16
  19. data/.github/workflows/test.yml +0 -46
  20. data/.gitignore +0 -13
  21. data/.rubocop.yml +0 -5
  22. data/Dockerfile +0 -13
  23. data/Gemfile +0 -6
  24. data/Rakefile +0 -75
  25. data/bin/console +0 -14
  26. data/bin/setup +0 -8
  27. data/cheatsheet.pdf +0 -0
  28. data/docusaurus/.dockerignore +0 -2
  29. data/docusaurus/.gitignore +0 -12
  30. data/docusaurus/Dockerfile +0 -10
  31. data/docusaurus/docker-compose.yml +0 -18
  32. data/docusaurus/docs/commands.md +0 -69
  33. data/docusaurus/docs/configuration.md +0 -300
  34. data/docusaurus/docs/development.md +0 -15
  35. data/docusaurus/docs/getstarted.md +0 -46
  36. data/docusaurus/docs/rules.md +0 -79
  37. data/docusaurus/website/README.md +0 -193
  38. data/docusaurus/website/core/Footer.js +0 -100
  39. data/docusaurus/website/package.json +0 -14
  40. data/docusaurus/website/pages/en/index.js +0 -207
  41. data/docusaurus/website/pages/en/versions.js +0 -118
  42. data/docusaurus/website/sidebars.json +0 -11
  43. data/docusaurus/website/siteConfig.js +0 -171
  44. data/docusaurus/website/static/css/code-block-buttons.css +0 -39
  45. data/docusaurus/website/static/css/custom.css +0 -245
  46. data/docusaurus/website/static/img/favicon.ico +0 -0
  47. data/docusaurus/website/static/js/code-block-buttons.js +0 -47
  48. data/docusaurus/website/versioned_docs/version-1.0.0/commands.md +0 -70
  49. data/docusaurus/website/versioned_docs/version-1.0.0/configuration.md +0 -296
  50. data/docusaurus/website/versioned_docs/version-1.0.0/development.md +0 -16
  51. data/docusaurus/website/versioned_docs/version-1.0.0/getstarted.md +0 -47
  52. data/docusaurus/website/versioned_docs/version-1.0.0/rules.md +0 -81
  53. data/docusaurus/website/versioned_docs/version-1.0.2/rules.md +0 -79
  54. data/docusaurus/website/versioned_docs/version-2.4.0/configuration.md +0 -301
  55. data/docusaurus/website/versioned_docs/version-2.4.3/rules.md +0 -80
  56. data/docusaurus/website/versioned_sidebars/version-1.0.0-sidebars.json +0 -11
  57. data/docusaurus/website/versioned_sidebars/version-1.0.2-sidebars.json +0 -11
  58. data/docusaurus/website/versioned_sidebars/version-2.4.0-sidebars.json +0 -11
  59. data/docusaurus/website/versions.json +0 -12
  60. data/docusaurus/website/yarn.lock +0 -6604
  61. data/goodcheck.gemspec +0 -35
  62. data/goodcheck.yml +0 -10
  63. data/logo/GoodCheck Horizontal.pdf +0 -899
  64. data/logo/GoodCheck Horizontal.png +0 -0
  65. data/logo/GoodCheck Horizontal.svg +0 -55
  66. data/logo/GoodCheck logo.png +0 -0
  67. data/logo/GoodCheck vertical.png +0 -0
  68. data/sample.yml +0 -57
@@ -1,79 +0,0 @@
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
- ```
@@ -1,193 +0,0 @@
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/).
@@ -1,100 +0,0 @@
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;
@@ -1,14 +0,0 @@
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.14.4"
13
- }
14
- }
@@ -1,207 +0,0 @@
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 Splash extends React.Component {
11
- render() {
12
- return (
13
- <div className="feature-container">
14
- <FeatureDescription
15
- title={this.props.info.title}
16
- description={this.props.info.description}
17
- button={this.props.info.button}
18
- />
19
- <FeatureCodeBoxExtended info={this.props.info} />
20
- </div>
21
- );
22
- }
23
- }
24
-
25
- const Button = props => (
26
- <div className="plugin-wrapper button-wrapper">
27
- <a className="button" href={props.href} target={props.target}>
28
- {props.children}
29
- </a>
30
- </div>
31
- );
32
-
33
- class Section extends React.Component {
34
- render() {
35
-
36
- return (
37
- <div className="section-container">
38
- <div className="section-grid">
39
- <div className="section-card">
40
- <div>
41
- <h2>Configuration</h2>
42
- <p>Learn the patterns and syntax to make custom rules. </p>
43
- <Button href="./docs/configuration">Syntax details</Button>
44
- </div>
45
- </div>
46
- <div className="section-card">
47
- <div>
48
- <h2>Rules</h2>
49
- <p>
50
- Want to see some pre-defined rules? Check out some rules here.
51
- </p>
52
- <Button href="./docs/rules">See rules</Button>
53
- </div>
54
- </div>
55
- <div className="section-card">
56
- <div>
57
- <h2>Commands</h2>
58
- <p>
59
- Goodcheck is written to be used on the command line. Learn about
60
- it’s usage here.
61
- </p>
62
- <Button href="./docs/commands">CLI details</Button>
63
- </div>
64
- </div>
65
- </div>
66
- </div>
67
- );
68
- }
69
- }
70
-
71
- class Feature extends React.Component {
72
- render() {
73
- return (
74
- <div className="center-container">
75
- <div className="feature-container">
76
- <FeatureDescription
77
- title={this.props.info.title}
78
- description={this.props.info.description}
79
- />
80
- <FeatureCodeBoxExtended info={this.props.info} />
81
- </div>
82
- </div>
83
- );
84
- }
85
- }
86
-
87
- class FeatureDescription extends React.Component {
88
- render() {
89
- return (
90
- <div className="description-container">
91
- <h1>{this.props.title}</h1>
92
- <p>{this.props.description}</p>
93
- {this.props.button && (
94
- <Button href="./docs/getstarted">{this.props.button}</Button>
95
- )}
96
- </div>
97
- );
98
- }
99
- }
100
-
101
- class FeatureCodeBoxExtended extends React.Component {
102
- render() {
103
- const info = this.props.info;
104
- return (
105
- <div className="code-container">
106
- <header className="code-top">goodcheck.yml</header>
107
- <section className="code-content">
108
- <pre className="yaml">
109
- <span className="yaml-key">rules</span>
110
- <span className="yaml-syntax">: </span>
111
- <br />
112
- <span className="yaml-syntax">{` - `}</span>
113
- <span className="yaml-key">id</span>
114
- <span className="yaml-syntax">: </span>
115
- <span className="yaml-value">{info.id}</span>
116
- <br />
117
- {info.not && (
118
- <div>
119
- <span className="yaml-key">{` not`}</span>
120
- <span className="yaml-syntax">: </span>
121
- <br />
122
- <span className="yaml-key">{` pattern`}</span>
123
- <span className="yaml-syntax">: </span>
124
- <span className="yaml-value">{info.pattern}</span>
125
- <br />
126
- </div>
127
- )}
128
- {!info.not && (
129
- <div>
130
- {info.pattern && (
131
- <div>
132
- <span className="yaml-key">{` pattern`}</span>
133
- <span className="yaml-syntax">: </span>
134
- <span className="yaml-value">{info.pattern}</span>
135
- </div>
136
- )}
137
- </div>
138
- )}
139
- <span className="yaml-key">{` message`}</span>
140
- <span className="yaml-syntax">: </span>
141
- <span className="yaml-value">{`${info.message}`}</span>
142
- <br />
143
- {info.glob && (
144
- <div>
145
- <span className="yaml-key">{` glob`}</span>
146
- <span className="yaml-syntax">: </span>
147
- <span className="yaml-value">{`${info.glob}`}</span>
148
- </div>
149
- )}
150
- </pre>
151
- </section>
152
- <header className="code-result">Result</header>
153
- <section className="code-terminal">
154
- <p className="yaml">
155
- {`${info.resultFront}`}
156
- {info.match && (
157
- <span className="terminal-highlight"> {info.match} </span>
158
- )}
159
- {info.resultEnd && `${info.resultEnd}`}
160
- </p>
161
- </section>
162
- </div>
163
- );
164
- }
165
- }
166
-
167
- class Index extends React.Component {
168
- render() {
169
- const { config: siteConfig } = this.props;
170
-
171
- const Showcase = () => {
172
-
173
- return (
174
- <div className="productShowcaseSection paddingBottom showcaseBackground">
175
- <br />
176
- <h2>Stop reviewing the same patterns.</h2>
177
- <Button href="./docs/getstarted">Start using {siteConfig.title}</Button>
178
- </div>
179
- );
180
- };
181
-
182
- const MainContainer = () => {
183
- return (
184
- <div className="index-container">
185
- <div className="splash-container">
186
- <Splash info={siteConfig.splash} />
187
- </div>
188
- <div className="three-features-container">
189
- <Section />
190
- <Feature info={siteConfig.featureOne} />
191
- <Feature info={siteConfig.featureTwo} />
192
- <Feature info={siteConfig.featureThree} />
193
- </div>
194
- </div>
195
- );
196
- }
197
-
198
- return (
199
- <div>
200
- <MainContainer />
201
- <Showcase />
202
- </div>
203
- );
204
- }
205
- }
206
-
207
- module.exports = Index;