goodcheck 2.5.2 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +49 -3
  3. data/LICENSE +1 -1
  4. data/README.md +8 -445
  5. data/lib/goodcheck.rb +9 -4
  6. data/lib/goodcheck/analyzer.rb +13 -9
  7. data/lib/goodcheck/buffer.rb +9 -21
  8. data/lib/goodcheck/cli.rb +79 -57
  9. data/lib/goodcheck/commands/check.rb +41 -27
  10. data/lib/goodcheck/commands/config_loading.rb +28 -5
  11. data/lib/goodcheck/commands/init.rb +4 -2
  12. data/lib/goodcheck/commands/pattern.rb +2 -1
  13. data/lib/goodcheck/commands/test.rb +38 -30
  14. data/lib/goodcheck/config.rb +68 -1
  15. data/lib/goodcheck/config_loader.rb +41 -31
  16. data/lib/goodcheck/error.rb +3 -0
  17. data/lib/goodcheck/exit_status.rb +8 -0
  18. data/lib/goodcheck/glob.rb +14 -3
  19. data/lib/goodcheck/import_loader.rb +96 -26
  20. data/lib/goodcheck/issue.rb +3 -3
  21. data/lib/goodcheck/location.rb +28 -0
  22. data/lib/goodcheck/logger.rb +4 -4
  23. data/lib/goodcheck/reporters/json.rb +6 -1
  24. data/lib/goodcheck/reporters/text.rb +44 -11
  25. data/lib/goodcheck/rule.rb +3 -1
  26. data/lib/goodcheck/unarchiver.rb +40 -0
  27. data/lib/goodcheck/version.rb +1 -1
  28. metadata +44 -82
  29. data/.github/dependabot.yml +0 -18
  30. data/.github/workflows/release.yml +0 -16
  31. data/.github/workflows/test.yml +0 -46
  32. data/.gitignore +0 -13
  33. data/.rubocop.yml +0 -5
  34. data/Dockerfile +0 -13
  35. data/Gemfile +0 -6
  36. data/Rakefile +0 -75
  37. data/bin/console +0 -14
  38. data/bin/setup +0 -8
  39. data/cheatsheet.pdf +0 -0
  40. data/docusaurus/.dockerignore +0 -2
  41. data/docusaurus/.gitignore +0 -12
  42. data/docusaurus/Dockerfile +0 -10
  43. data/docusaurus/docker-compose.yml +0 -18
  44. data/docusaurus/docs/commands.md +0 -69
  45. data/docusaurus/docs/configuration.md +0 -300
  46. data/docusaurus/docs/development.md +0 -15
  47. data/docusaurus/docs/getstarted.md +0 -46
  48. data/docusaurus/docs/rules.md +0 -79
  49. data/docusaurus/website/README.md +0 -193
  50. data/docusaurus/website/core/Footer.js +0 -100
  51. data/docusaurus/website/package.json +0 -14
  52. data/docusaurus/website/pages/en/index.js +0 -207
  53. data/docusaurus/website/pages/en/versions.js +0 -118
  54. data/docusaurus/website/sidebars.json +0 -11
  55. data/docusaurus/website/siteConfig.js +0 -171
  56. data/docusaurus/website/static/css/code-block-buttons.css +0 -39
  57. data/docusaurus/website/static/css/custom.css +0 -245
  58. data/docusaurus/website/static/img/favicon.ico +0 -0
  59. data/docusaurus/website/static/js/code-block-buttons.js +0 -47
  60. data/docusaurus/website/versioned_docs/version-1.0.0/commands.md +0 -70
  61. data/docusaurus/website/versioned_docs/version-1.0.0/configuration.md +0 -296
  62. data/docusaurus/website/versioned_docs/version-1.0.0/development.md +0 -16
  63. data/docusaurus/website/versioned_docs/version-1.0.0/getstarted.md +0 -47
  64. data/docusaurus/website/versioned_docs/version-1.0.0/rules.md +0 -81
  65. data/docusaurus/website/versioned_docs/version-1.0.2/rules.md +0 -79
  66. data/docusaurus/website/versioned_docs/version-2.4.0/configuration.md +0 -301
  67. data/docusaurus/website/versioned_docs/version-2.4.3/rules.md +0 -80
  68. data/docusaurus/website/versioned_sidebars/version-1.0.0-sidebars.json +0 -11
  69. data/docusaurus/website/versioned_sidebars/version-1.0.2-sidebars.json +0 -11
  70. data/docusaurus/website/versioned_sidebars/version-2.4.0-sidebars.json +0 -11
  71. data/docusaurus/website/versions.json +0 -12
  72. data/docusaurus/website/yarn.lock +0 -6604
  73. data/goodcheck.gemspec +0 -35
  74. data/goodcheck.yml +0 -10
  75. data/logo/GoodCheck Horizontal.pdf +0 -899
  76. data/logo/GoodCheck Horizontal.png +0 -0
  77. data/logo/GoodCheck Horizontal.svg +0 -55
  78. data/logo/GoodCheck logo.png +0 -0
  79. data/logo/GoodCheck vertical.png +0 -0
  80. data/sample.yml +0 -57
@@ -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;
@@ -1,118 +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
- const CompLibrary = require('../../core/CompLibrary');
11
-
12
- const Container = CompLibrary.Container;
13
-
14
- const CWD = process.cwd();
15
-
16
- const versions = require(`${CWD}/versions.json`);
17
-
18
- function Versions(props) {
19
- const { config: siteConfig } = props;
20
- const latestVersion = versions[0];
21
- const repoUrl = `https://github.com/${siteConfig.organizationName}/${
22
- siteConfig.projectName
23
- }`;
24
- return (
25
- <div className="docMainWrapper wrapper">
26
- <Container className="mainContainer versionsContainer">
27
- <div className="post">
28
- <header className="postHeader">
29
- <h1>{siteConfig.title} Versions</h1>
30
- </header>
31
- <p>New versions of this project are released every so often.</p>
32
- <h3 id="latest">Current version (Stable)</h3>
33
- <table className="versions">
34
- <tbody>
35
- <tr>
36
- <th>{latestVersion}</th>
37
- <td>
38
- {/* You are supposed to change this href where appropriate
39
- Example: href="<baseUrl>/docs(/:language)/:id" */}
40
- <a
41
- href={`${siteConfig.baseUrl}${siteConfig.docsUrl}/${
42
- props.language ? props.language + '/' : ''
43
- }configuration`}>
44
- Documentation
45
- </a>
46
- </td>
47
- <td>
48
- <a href="https://github.com/sider/goodcheck/releases">Release Notes</a>
49
- </td>
50
- </tr>
51
- </tbody>
52
- </table>
53
- <p>
54
- This is the version that is configured automatically when you first
55
- install this project.
56
- </p>
57
- <h3 id="rc">Pre-release versions</h3>
58
- <table className="versions">
59
- <tbody>
60
- <tr>
61
- <th>master</th>
62
- <td>
63
- {/* You are supposed to change this href where appropriate
64
- Example: href="<baseUrl>/docs(/:language)/next/:id" */}
65
- <a
66
- href={`${siteConfig.baseUrl}${siteConfig.docsUrl}/${
67
- props.language ? props.language + '/' : ''
68
- }next/configuration`}>
69
- Documentation
70
- </a>
71
- </td>
72
- <td>
73
- <a href={repoUrl}>Source Code</a>
74
- </td>
75
- </tr>
76
- </tbody>
77
- </table>
78
- <p>Other text describing this section.</p>
79
- <h3 id="archive">Past Versions</h3>
80
- <p>Here you can find previous versions of the documentation.</p>
81
- <table className="versions">
82
- <tbody>
83
- {versions.map(
84
- version =>
85
- version !== latestVersion && (
86
- <tr>
87
- <th>{version}</th>
88
- <td>
89
- {/* You are supposed to change this href where appropriate
90
- Example: href="<baseUrl>/docs(/:language)/:version/:id" */}
91
- <a
92
- href={`${siteConfig.baseUrl}${siteConfig.docsUrl}/${
93
- props.language ? props.language + '/' : ''
94
- }${version}/configuration`}>
95
- Documentation
96
- </a>
97
- </td>
98
- <td>
99
- <a href={`${repoUrl}/releases/tag/v${version}`}>
100
- Release Notes
101
- </a>
102
- </td>
103
- </tr>
104
- ),
105
- )}
106
- </tbody>
107
- </table>
108
- <p>
109
- You can find past versions of this project on{' '}
110
- <a href={repoUrl}>GitHub</a>.
111
- </p>
112
- </div>
113
- </Container>
114
- </div>
115
- );
116
- }
117
-
118
- module.exports = Versions;
@@ -1,11 +0,0 @@
1
- {
2
- "Goodcheck": {
3
- "Docs": [
4
- "getstarted",
5
- "configuration",
6
- "rules",
7
- "commands",
8
- "development"
9
- ]
10
- }
11
- }
@@ -1,171 +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
- // See https://docusaurus.io/docs/site-config for all the possible
9
- // site configuration options.
10
-
11
- // List of projects/orgs using your project for the users page.
12
- // const users = [
13
- // {
14
- // caption: 'User1',
15
- // // You will need to prepend the image path with your baseUrl
16
- // // if it is not '/', like: '/test-site/img/image.jpg'.
17
- // image: 'https://github.com/sider/goodcheck/raw/master/logo/GoodCheck%20Horizontal.png',
18
- // infoLink: 'https://github.com/sider/goodcheck',
19
- // pinned: true,
20
- // },
21
- // ];
22
-
23
- const siteConfig = {
24
- title: 'Goodcheck', // Title for your website.
25
- tagline: 'A regexp based customizable linter',
26
- url: 'https://sider.github.io', // Your website URL
27
- baseUrl: '/goodcheck/', // Base URL for your project */
28
- // For github.io type URLs, you would set the url and baseUrl like:
29
- // url: 'https://facebook.github.io',
30
- // baseUrl: '/test-site/',
31
-
32
- // Used for publishing and more
33
- projectName: 'goodcheck',
34
- organizationName: 'sider',
35
- // For top-level user or org sites, the organization is still the same.
36
- // e.g., for the https://JoelMarcey.github.io site, it would be set like...
37
- // organizationName: 'JoelMarcey'
38
-
39
- // For no header links in the top nav bar -> headerLinks: [],
40
- headerLinks: [
41
- { doc: 'getstarted', label: 'Get Started' },
42
- { doc: 'configuration', label: 'Configuration' },
43
- { doc: 'rules', label: 'Rule' },
44
- { doc: 'commands', label: 'Commands' },
45
- ],
46
-
47
- // If you have users set above, you add it here:
48
- // users,
49
-
50
- /* path to images for header/footer */
51
- headerIcon: 'img/favicon.ico',
52
- footerIcon: 'img/favicon.ico',
53
- favicon: 'img/favicon.ico',
54
-
55
- /* Colors for website */
56
- colors: {
57
- primaryColor: '#09345D', // hsl(209, 82%, 19%)
58
- secondaryColor: '#044d82',
59
- lightColor: '#eaeef3',
60
- },
61
-
62
- /* Custom fonts for website */
63
- /*
64
- fonts: {
65
- myFont: [
66
- "Times New Roman",
67
- "Serif"
68
- ],
69
- myOtherFont: [
70
- "-apple-system",
71
- "system-ui"
72
- ]
73
- },
74
- */
75
-
76
- // This copyright info is used in /core/Footer.js and blog RSS/Atom feeds.
77
- copyright: `Copyright © ${new Date().getFullYear()} Goodcheck`,
78
-
79
- highlight: {
80
- // Highlight.js theme to use for syntax highlighting in code blocks.
81
- theme: 'mono-blue',
82
- },
83
-
84
- // Add custom scripts here that would be placed in <script> tags.
85
- scripts: [
86
- 'https://buttons.github.io/buttons.js',
87
- 'https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js',
88
- '/js/code-block-buttons.js',
89
- ],
90
- stylesheets: ['/css/code-block-buttons.css'],
91
-
92
- // On page navigation for the current documentation page.
93
- onPageNav: 'separate',
94
- // No .html extensions for paths.
95
- cleanUrl: true,
96
-
97
- // Open Graph and Twitter card images.
98
- // ogImage: 'img/undraw_online.svg',
99
- // twitterImage: 'img/undraw_tweetstorm.svg',
100
-
101
- // For sites with a sizable amount of content, set collapsible to true.
102
- // Expand/collapse the links and subcategories under categories.
103
- // docsSideNavCollapsible: true,
104
-
105
- // Show documentation's last contributor's name.
106
- // enableUpdateBy: true,
107
-
108
- // Show documentation's last update time.
109
- // enableUpdateTime: true,
110
-
111
- // You may provide arbitrary config keys to be used as needed by your
112
- // template. For example, if you need your repo's URL...
113
- repoUrl: 'https://github.com/sider/goodcheck',
114
-
115
- splash: {
116
- title: `Goodcheck`,
117
- description: "A regexp based customizable linter",
118
- button: "Get Started",
119
- id: "com.example.github",
120
- pattern: "Github",
121
- message: `|
122
- GitHub is GitHub, not Github
123
-
124
- You may have misspelling the name of the service!`,
125
- resultFront: `index.html: 91: - <a>Signup via `,
126
- match: "Github",
127
- resultEnd: `</a>: GitHub is GitHub, not Github`
128
- },
129
-
130
- featureOne: {
131
- title: `A Goodcheck rule`,
132
- description:
133
- "Define patterns with messages in a goodcheck.yml file and run goodcheck within your repository. Any matching results will be displayed in the terminal.",
134
- id: "com.sample.no-blink",
135
- pattern: "<blink",
136
- message: `|
137
- Stop using <blink> tag`,
138
-
139
- resultFront: `index.html:50: <h3>`,
140
- match: "<blink>",
141
- resultEnd: `HTML5 Markup</blink></h3>: Stop using <blink> tag`
142
- },
143
-
144
- featureTwo: {
145
- title: `A rule with negated pattern`,
146
- description:
147
- "Goodcheck rules are usually to detect if something is included in a file. You can define the negated rules for the opposite, something is missing in a file.",
148
- id: "com.sample.negated",
149
- not: true,
150
- pattern: "<!DOCTYPE html>",
151
- message: `|
152
- Write a doctype on HTML files.`,
153
-
154
- resultFront: `index.html:-:<html lang="en">: Write a doctype on HTML files.`,
155
- glob: "**/*.html"
156
- },
157
-
158
- featureThree: {
159
- title: `A rule without pattern`,
160
- description:
161
- "You can define a rule without pattern. The rule emits an issue on each file specified with glob. You cannot omit glob from a rule definition without pattern. ",
162
- id: "com.sample.without_pattern",
163
- message: `|
164
- Read the operation manual for DB migration: https://example.com/guides/123 `,
165
-
166
- resultFront: `db/schema.rb:-:# This file is auto-generated from the current state of the database. Instead: Read the operation manual for DB migration: https://example.com/guides/123`,
167
- glob: "db/schema.rb"
168
- },
169
- };
170
-
171
- module.exports = siteConfig;