goodcheck 2.5.1 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +48 -2
  3. data/LICENSE +1 -1
  4. data/README.md +7 -444
  5. data/lib/goodcheck.rb +9 -4
  6. data/lib/goodcheck/analyzer.rb +13 -9
  7. data/lib/goodcheck/buffer.rb +11 -16
  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 +61 -17
  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 +47 -84
  29. data/.github/workflows/release.yml +0 -16
  30. data/.github/workflows/test.yml +0 -46
  31. data/.gitignore +0 -13
  32. data/.rubocop.yml +0 -5
  33. data/Dockerfile +0 -13
  34. data/Gemfile +0 -6
  35. data/Rakefile +0 -75
  36. data/bin/console +0 -14
  37. data/bin/setup +0 -8
  38. data/cheatsheet.pdf +0 -0
  39. data/docusaurus/.dockerignore +0 -2
  40. data/docusaurus/.gitignore +0 -12
  41. data/docusaurus/Dockerfile +0 -10
  42. data/docusaurus/docker-compose.yml +0 -18
  43. data/docusaurus/docs/commands.md +0 -69
  44. data/docusaurus/docs/configuration.md +0 -300
  45. data/docusaurus/docs/development.md +0 -15
  46. data/docusaurus/docs/getstarted.md +0 -46
  47. data/docusaurus/docs/rules.md +0 -79
  48. data/docusaurus/website/README.md +0 -193
  49. data/docusaurus/website/core/Footer.js +0 -100
  50. data/docusaurus/website/package.json +0 -14
  51. data/docusaurus/website/pages/en/index.js +0 -207
  52. data/docusaurus/website/pages/en/versions.js +0 -118
  53. data/docusaurus/website/sidebars.json +0 -11
  54. data/docusaurus/website/siteConfig.js +0 -171
  55. data/docusaurus/website/static/css/code-block-buttons.css +0 -39
  56. data/docusaurus/website/static/css/custom.css +0 -245
  57. data/docusaurus/website/static/img/favicon.ico +0 -0
  58. data/docusaurus/website/static/js/code-block-buttons.js +0 -47
  59. data/docusaurus/website/versioned_docs/version-1.0.0/commands.md +0 -70
  60. data/docusaurus/website/versioned_docs/version-1.0.0/configuration.md +0 -296
  61. data/docusaurus/website/versioned_docs/version-1.0.0/development.md +0 -16
  62. data/docusaurus/website/versioned_docs/version-1.0.0/getstarted.md +0 -47
  63. data/docusaurus/website/versioned_docs/version-1.0.0/rules.md +0 -81
  64. data/docusaurus/website/versioned_docs/version-1.0.2/rules.md +0 -79
  65. data/docusaurus/website/versioned_docs/version-2.4.0/configuration.md +0 -301
  66. data/docusaurus/website/versioned_docs/version-2.4.3/rules.md +0 -80
  67. data/docusaurus/website/versioned_sidebars/version-1.0.0-sidebars.json +0 -11
  68. data/docusaurus/website/versioned_sidebars/version-1.0.2-sidebars.json +0 -11
  69. data/docusaurus/website/versioned_sidebars/version-2.4.0-sidebars.json +0 -11
  70. data/docusaurus/website/versions.json +0 -11
  71. data/docusaurus/website/yarn.lock +0 -6806
  72. data/goodcheck.gemspec +0 -35
  73. data/goodcheck.yml +0 -10
  74. data/logo/GoodCheck Horizontal.pdf +0 -899
  75. data/logo/GoodCheck Horizontal.png +0 -0
  76. data/logo/GoodCheck Horizontal.svg +0 -55
  77. data/logo/GoodCheck logo.png +0 -0
  78. data/logo/GoodCheck vertical.png +0 -0
  79. data/sample.yml +0 -57
@@ -1,16 +0,0 @@
1
- name: Release
2
-
3
- on: push
4
-
5
- jobs:
6
- release:
7
- runs-on: ubuntu-latest
8
- steps:
9
- - uses: actions/checkout@v2
10
- - uses: softprops/action-gh-release@v1
11
- if: startsWith(github.ref, 'refs/tags/')
12
- with:
13
- body: |
14
- For details, see the [changelog](https://github.com/${{ github.repository }}/blob/${{ github.sha }}/CHANGELOG.md).
15
- env:
16
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -1,46 +0,0 @@
1
- name: Test
2
-
3
- on: [push]
4
-
5
- jobs:
6
- test:
7
- runs-on: ubuntu-latest
8
- strategy:
9
- matrix:
10
- ruby: [2.4, 2.5, 2.6, 2.7]
11
- steps:
12
- - uses: actions/checkout@v2
13
- - uses: ruby/setup-ruby@v1
14
- with:
15
- ruby-version: ${{ matrix.ruby }}
16
- - run: |
17
- gem install bundler --no-document
18
- bundle config set path vendor/bundle
19
- bundle install --jobs=4 --retry=3
20
- - run: bundle exec rake
21
-
22
- build-docs:
23
- runs-on: ubuntu-latest
24
- steps:
25
- - uses: actions/checkout@v2
26
- - uses: ruby/setup-ruby@v1
27
- with:
28
- ruby-version: 2.7
29
- - run: |
30
- gem install bundler --no-document
31
- bundle config set path vendor/bundle
32
- bundle install --jobs=4 --retry=3
33
- - run: bundle exec rake docs:build
34
-
35
- benchmark:
36
- runs-on: ubuntu-latest
37
- steps:
38
- - uses: actions/checkout@v2
39
- - uses: ruby/setup-ruby@v1
40
- with:
41
- ruby-version: 2.7
42
- - run: |
43
- gem install bundler --no-document
44
- bundle config set path vendor/bundle
45
- bundle install --jobs=4 --retry=3
46
- - run: bundle exec rake benchmark:run[10000]
data/.gitignore DELETED
@@ -1,13 +0,0 @@
1
- /.bundle/
2
- /vendor/bundle/
3
- /.yardoc
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
- /.idea
11
- /Gemfile.lock
12
- /.ruby-version
13
- .DS_Store
data/.rubocop.yml DELETED
@@ -1,5 +0,0 @@
1
- # We don't use RuboCop.
2
- # If you really believe a Cop should be enabled, open pull requests for each Cop and explain why it matters.
3
-
4
- AllCops:
5
- DisabledByDefault: true
data/Dockerfile DELETED
@@ -1,13 +0,0 @@
1
- FROM rubylang/ruby:2.6.3-bionic
2
-
3
- ENV DEBIAN_FRONTEND=noninteractive
4
-
5
- RUN mkdir /goodcheck
6
- WORKDIR /goodcheck
7
- COPY . /goodcheck/
8
- RUN rake install
9
-
10
- RUN mkdir /work
11
- WORKDIR /work
12
-
13
- ENTRYPOINT ["goodcheck"]
data/Gemfile DELETED
@@ -1,6 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
-
5
- # Specify your gem's dependencies in goodcheck.gemspec
6
- gemspec
data/Rakefile DELETED
@@ -1,75 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rake/testtask"
3
-
4
- Rake::TestTask.new(:test) do |t|
5
- t.libs << "test"
6
- t.libs << "lib"
7
- t.test_files = FileList["test/**/*_test.rb"]
8
- end
9
-
10
- task :default => :test
11
-
12
- namespace :docker do
13
- task :build do
14
- sh 'docker', 'build', '-t', 'sider/goodcheck:dev', '.'
15
- end
16
- end
17
-
18
- namespace :docs do
19
- desc "Install dependencies for the documentation website"
20
- task :install_deps do
21
- on_docs_dir do
22
- sh "yarn", "install"
23
- end
24
- end
25
-
26
- desc "Build the documentation website"
27
- task :build => [:install_deps] do
28
- on_docs_dir do
29
- sh "yarn", "run", "build"
30
- end
31
- end
32
-
33
- desc "Update the version of the documentation website"
34
- task :update_version => [:install_deps] do
35
- on_docs_dir do
36
- sh "yarn", "run", "version", Goodcheck::VERSION
37
- end
38
- end
39
-
40
- desc "Publish the documentation website"
41
- task :publish => [:build] do
42
- on_docs_dir do
43
- sh "yarn", "run", "publish-gh-pages"
44
- end
45
- end
46
-
47
- def on_docs_dir(&block)
48
- Dir.chdir "docusaurus/website", &block
49
- end
50
- end
51
-
52
- namespace :benchmark do
53
- desc "Run benchmark"
54
- task :run, [:n] do |_task, args|
55
- require "benchmark"
56
- require "net/http"
57
- require "tempfile"
58
- require_relative "lib/goodcheck"
59
- require_relative "lib/goodcheck/cli"
60
-
61
- content = Net::HTTP.get(URI("https://raw.githubusercontent.com/ruby/ruby/0256e4f0f5e10f0a15cbba2cd64e252dfa864e4a/gc.c"))
62
- target_file = Tempfile.new("goodcheck-benchmark-")
63
- target_file.write content
64
- target_file = target_file.path
65
-
66
- n = Integer(args[:n] || 1000)
67
- puts "n = #{n}"
68
-
69
- Benchmark.bm do |x|
70
- x.report do
71
- n.times { Goodcheck::CLI.new(stdout: STDOUT, stderr: STDERR).run(["check", target_file]) }
72
- end
73
- end
74
- end
75
- end
data/bin/console DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "goodcheck"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start(__FILE__)
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
data/cheatsheet.pdf DELETED
Binary file
@@ -1,2 +0,0 @@
1
- */node_modules
2
- *.log
@@ -1,12 +0,0 @@
1
- .DS_Store
2
-
3
- node_modules
4
-
5
- lib/core/metadata.js
6
- lib/core/MetadataBlog.js
7
-
8
- website/translated_docs
9
- website/build/
10
- website/package-lock.json
11
- website/node_modules
12
- website/i18n/*
@@ -1,10 +0,0 @@
1
- FROM node:8.11.4
2
-
3
- WORKDIR /app/website
4
-
5
- EXPOSE 3000 35729
6
- COPY ./docs /app/docs
7
- COPY ./website /app/website
8
- RUN yarn install
9
-
10
- CMD ["yarn", "start"]
@@ -1,18 +0,0 @@
1
- version: "3"
2
-
3
- services:
4
- docusaurus:
5
- build: .
6
- ports:
7
- - 3000:3000
8
- - 35729:35729
9
- volumes:
10
- - ./docs:/app/docs
11
- - ./website/blog:/app/website/blog
12
- - ./website/core:/app/website/core
13
- - ./website/i18n:/app/website/i18n
14
- - ./website/pages:/app/website/pages
15
- - ./website/static:/app/website/static
16
- - ./website/sidebars.json:/app/website/sidebars.json
17
- - ./website/siteConfig.js:/app/website/siteConfig.js
18
- working_dir: /app/website
@@ -1,69 +0,0 @@
1
- ---
2
- id: commands
3
- title: Commands
4
- sidebar_label: Commands
5
- ---
6
-
7
-
8
- ## `goodcheck init [options]`
9
-
10
- The `init` command generates an example of a configuration file.
11
-
12
- Available options are:
13
-
14
- * `-c=[CONFIG]`, `--config=[CONFIG]` to specify the configuration file name to generate.
15
- * `--force` to allow overwriting of an existing config file.
16
-
17
- ## `goodcheck check [options] targets...`
18
-
19
- The `check` command checks your programs under `targets...`.
20
- You can pass:
21
-
22
- * Directory paths, or
23
- * Paths to files.
24
-
25
- When you omit `targets`, it checks all files in `.`.
26
-
27
- Available options are:
28
-
29
- * `-c [CONFIG]`, `--config=[CONFIG]` to specify the configuration file.
30
- * `-R [rule]`, `--rule=[rule]` to specify the rules you want to check.
31
- * `--format=[text|json]` to specify output format.
32
- * `-v`, `--verbose` to be verbose.
33
- * `--debug` to print all debug messages.
34
- * `--force` to ignore downloaded caches.
35
-
36
- `goodcheck check` exits with:
37
-
38
- * `0` when it does not find any matching text fragment.
39
- * `2` when it finds some matching text.
40
- * `1` when it finds some error.
41
-
42
- You can check its exit status to identify if the tool finds some pattern or not.
43
-
44
- ## `goodcheck test [options]`
45
-
46
- The `test` command tests rules.
47
- The test contains:
48
-
49
- * Validation of rule `id` uniqueness.
50
- * If `pass` examples does not match with any of `pattern`s.
51
- * If `fail` examples matches with some of `pattern`s.
52
-
53
- Use `test` command when you add a new rule to be sure you are writing rules correctly.
54
-
55
- Available options are:
56
-
57
- * `-c [CONFIG]`, `--config=[CONFIG]` to specify the configuration file.
58
- * `-v`, `--verbose` to be verbose.
59
- * `--debug` to print all debug messages.
60
- * `--force` to ignore downloaded caches
61
-
62
- ## `goodcheck pattern [options] ids...`
63
-
64
- The `pattern` command prints the regular expressions generated from the patterns.
65
- The command is for debugging patterns, especially token patterns.
66
-
67
- The available option is:
68
-
69
- * `-c [CONFIG]`, `--config=[CONFIG]` to specify the configuration file.
@@ -1,300 +0,0 @@
1
- ---
2
- id: configuration
3
- title: Configuration
4
- sidebar_label: Configuration
5
- ---
6
-
7
- ## `goodcheck.yml`
8
-
9
- An example of the configuration is like the following:
10
-
11
- ```yaml
12
- rules:
13
- - id: com.example.github
14
- pattern: Github
15
- message: |
16
- GitHub is GitHub, not Github
17
-
18
- You may misspelling the name of the service!
19
- justification:
20
- - When you mean a service different from GitHub
21
- - When GitHub is renamed
22
- glob:
23
- - app/views/**/*.html.slim
24
- - config/locales/**/*.yaml
25
- pass:
26
- - <a>Signup via GitHub</a>
27
- fail:
28
- - <a>Signup via Github</a>
29
- ```
30
-
31
- The *rule* hash contains the following keys.
32
-
33
- * `id`: a string to identify rules (required)
34
- * `pattern`: a *pattern* or a sequence of *pattern*s
35
- * `message`: a string to tell writers why the code piece should be revised (required)
36
- * `justification`: a sequence of strings to tell writers when an exception can be allowed (optional)
37
- * `glob`: a *glob* or a sequence of *glob*s (optional)
38
- * `pass`: a string, or a sequence of strings, which does not match the given pattern (optional)
39
- * `fail`: a string, or a sequence of strings, which does match the given pattern (optional)
40
-
41
- ## *pattern*
42
-
43
- A *pattern* can be a *literal pattern*, *regexp pattern*, *token pattern*, or a string.
44
-
45
- ### String literal
46
-
47
- String literal represents a *literal pattern* or *regexp pattern*.
48
-
49
- ```yaml
50
- pattern:
51
- - This is a literal pattern
52
- - /This is a regexp pattern/
53
- ```
54
-
55
- If the string value begins with `/` and ends with `/`, it is a *regexp pattern*.
56
- You can optionally specify regexp options like `/casefold/i` or `/multiline/m`.
57
-
58
- ### *literal pattern*
59
-
60
- *literal pattern* allows you to construct a regexp which matches exactly to the `literal` string.
61
-
62
- ```yaml
63
- id: com.sample.GitHub
64
- pattern:
65
- literal: Github
66
- case_sensitive: true
67
- message: Write GitHub, not Github
68
- ```
69
-
70
- All regexp meta characters included in the `literal` value will be escaped.
71
- `case_sensitive` is an optional key and the default is `true`.
72
-
73
- ### *regexp pattern*
74
-
75
- *regexp pattern* allows you to write a regexp with meta chars.
76
-
77
- ```yaml
78
- id: com.sample.digits
79
- pattern:
80
- regexp: \d{4,}
81
- case_sensitive: false
82
- multiline: false
83
- message: Insert delimiters when writing large numbers
84
- justification:
85
- - When you are not writing numbers, including phone numbers, zip code, ...
86
- ```
87
-
88
- It accepts two optional attributes, `case_sensitive` and `multiline`.
89
- The default values of `case_sensitive` and `multiline` are `true` and `false` respectively.
90
-
91
- The regexp will be passed to `Regexp.compile`.
92
- The precise definition of regular expressions can be found in the documentation for Ruby.
93
-
94
- ### *token pattern*
95
-
96
- *token pattern* compiles to a *tokenized* regexp.
97
-
98
- ```yaml
99
- id: com.sample.no-blink
100
- pattern:
101
- token: "<blink"
102
- case_sensitive: false
103
- message: Stop using <blink> tag
104
- glob: "**/*.html"
105
- justification:
106
- - If Lynx is the major target of the web site
107
- ```
108
-
109
- It tries to tokenize the input and generates a regexp which matches a sequence of tokens.
110
- The tokenization is heuristic and may not work well for your programming language.
111
- In that case, try using *regexp pattern*.
112
-
113
- The generated regexp of `<blink` is `<\s*blink\b/m`.
114
- It matches with `<blink />` and `< BLINK>`, but does not match with `https://www.chromium.org/blink`.
115
-
116
- It accepts one optional attribute `case_sensitive`.
117
- The default value of `case_sensitive` is `true`.
118
- Note that the generated regexp is in multiline mode.
119
-
120
- Token patterns can have an optional `where` attribute and *variable bindings*.
121
-
122
- ```yaml
123
- pattern:
124
- - token: bgcolor=${color:string}
125
- where:
126
- color: true
127
- ```
128
-
129
- The variable binding consists of *variable name* and *variable type*, where `color` and `string` in the example above respectively. You have to add a key of the *variable name* in `where` attribute.
130
-
131
- We have 8 built-in patterns:
132
-
133
- * `string`
134
- * `int`
135
- * `float`
136
- * `number`
137
- * `url`
138
- * `email`
139
- * `word`
140
- * `identifier`
141
-
142
- You can find the exact definitions of the types in the definition of `Goodcheck::Pattern::Token` (`@@TYPES`).
143
-
144
- You can omit the type of variable binding.
145
-
146
- ```yaml
147
- pattern:
148
- - token: margin-left: ${size}px;
149
- where:
150
- size: true
151
- - token: backgroundColor={${color}}
152
- where:
153
- color: true
154
- ```
155
-
156
- In this case, the following character will be used to detect the range of binding. In the first example above, the `px` will be used as the marker for the end of `size` binding.
157
-
158
- If parens or brackets are surrounding the variable, Goodcheck tries to match with nested ones in the variable. It expands five levels of nesting. See the example of matches with the second `backgroundColor` pattern:
159
-
160
- - `backgroundColor={color}` Matches (`color=="color"`)
161
- - `backgroundColor={{ red: red(), green: green(), blue: green()-1 }}` Matches (`color=="{ red: red(), green: green(), blue: green()-1 }"`)
162
- - `backgroundColor={ {{{{{{}}}}}} }` Matches (`color==" {{{{{{}}}}}"`)
163
-
164
- ## *glob*
165
-
166
- A *glob* can be a string, or a hash.
167
-
168
- ```yaml
169
- glob:
170
- pattern: "legacy/**/*.rb"
171
- encoding: EUC-JP
172
- ```
173
-
174
- The hash can have an optional `encoding` attribute.
175
- You can specify the encoding of the file by the names defined for Ruby.
176
- The list of all available encoding names can be found by `$ ruby -e "puts Encoding.name_list"`.
177
- The default value is `UTF-8`.
178
-
179
- If you write a string as a `glob`, the string value can be the `pattern` of the glob, without `encoding` attribute.
180
-
181
- If you omit the `glob` attribute in a rule, the rule will be applied to all files given to `goodcheck`.
182
-
183
- If both your rule and its pattern has `glob`, Goodcheck will scan the pattern with files matching the `glob` condition in the pattern.
184
-
185
- ```yaml
186
- rules:
187
- - id: glob_test
188
- pattern:
189
- - literal: 123 # This pattern applies to .css files
190
- glob: "*.css"
191
- - literal: abc # This pattern applies to .txt files
192
- glob: "*.txt"
193
- ```
194
-
195
- ## A rule with _negated_ pattern
196
-
197
- Goodcheck rules are usually to detect _something is included in a file_.
198
- You can define the _negated_ rules for the opposite, _something is missing in a file_.
199
-
200
- ```yaml
201
- rules:
202
- - id: negated
203
- not:
204
- pattern:
205
- <!DOCTYPE html>
206
- message: Write a doctype on HTML files.
207
- glob: "**/*.html"
208
- ```
209
-
210
- ## A rule without `pattern`
211
-
212
- You can define a rule without `pattern`.
213
- The rule emits an issue on each file specified with `glob`.
214
- You cannot omit `glob` from a rule definition without `pattern`.
215
-
216
- ```yaml
217
- rules:
218
- - id: without_pattern
219
- message: |
220
- Read the operation manual for DB migration: https://example.com/guides/123
221
- glob: db/schema.rb
222
- ```
223
-
224
- The output will be something like:
225
-
226
- ```
227
- $ goodcheck check
228
- 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
229
- ```
230
-
231
- ## Triggers
232
-
233
- Version 2.0.0 introduces a new abstraction to define patterns, trigger.
234
- You can continue using `pattern`s in `rule`, but using `trigger` allows more flexible pattern definition and more precise testing.
235
-
236
- ```
237
- rules:
238
- - id: trigger
239
- message: Using trigger
240
- trigger:
241
- - pattern: <blink
242
- glob: "**/*.html"
243
- fail:
244
- - <blink></blink>
245
- - not:
246
- pattern:
247
- token: <meta charset="UTF-8">
248
- case_sensitive: false
249
- glob: "**/*.html"
250
- pass: |
251
- <html>
252
- <meta charset="utf-8"></meta>
253
- </html>
254
- ```
255
-
256
- You can continue existing `pattern` definitions, but using `goodcheck test` against `pattern`s with `glob` does not work.
257
- If your `pattern` definition includes `glob`, switching to `trigger` would make sense.
258
-
259
- ## Importing rules
260
-
261
- `goodcheck.yml` can have an optional `import` attribute.
262
-
263
- ```yaml
264
- import:
265
- - /usr/share/goodcheck/rules.yml
266
- - lib/goodcheck/rules.yml
267
- - https://some.host/shared/rules.yml
268
- ```
269
-
270
- The value of `import` can be an array of:
271
-
272
- - A string which represents an absolute file path,
273
- - A string which represents a relative file path from the config file, or
274
- - A http/https URL which represents the location of rules
275
-
276
- The rules file is a YAML file with an array of rules.
277
-
278
- ## Downloaded rules
279
-
280
- Downloaded rules are cached in `cache` directory in *goodcheck home directory*.
281
- The *goodcheck home directory* is `~/.goodcheck`, but you can customize the location with `GOODCHECK_HOME` environment variable.
282
-
283
- The cache expires in 3 minutes.
284
-
285
- ## Excluding files
286
-
287
- `goodcheck.yml` can have an optional `exclude` attribute.
288
-
289
- ```yaml
290
- exclude:
291
- - node_modules
292
- - vendor
293
- ```
294
-
295
- The value of `exclude` can be a string or an array of strings representing the glob pattern for excluded files.
296
-
297
-
298
- ## Cheatsheet
299
-
300
- You can download a [printable cheatsheet](https://github.com/sider/goodcheck/blob/master/cheatsheet.pdf) from this repository.