goodcheck 2.5.2 → 2.6.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -3
- data/lib/goodcheck.rb +3 -1
- data/lib/goodcheck/cli.rb +78 -54
- data/lib/goodcheck/commands/check.rb +19 -1
- data/lib/goodcheck/commands/config_loading.rb +19 -2
- data/lib/goodcheck/commands/init.rb +4 -2
- data/lib/goodcheck/commands/pattern.rb +2 -1
- data/lib/goodcheck/commands/test.rb +5 -4
- data/lib/goodcheck/config_loader.rb +5 -4
- data/lib/goodcheck/error.rb +3 -0
- data/lib/goodcheck/exit_status.rb +6 -0
- data/lib/goodcheck/glob.rb +14 -3
- data/lib/goodcheck/import_loader.rb +25 -9
- data/lib/goodcheck/version.rb +1 -1
- metadata +5 -55
- data/.github/dependabot.yml +0 -18
- data/.github/workflows/release.yml +0 -16
- data/.github/workflows/test.yml +0 -46
- data/.gitignore +0 -13
- data/.rubocop.yml +0 -5
- data/Dockerfile +0 -13
- data/Gemfile +0 -6
- data/Rakefile +0 -75
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/cheatsheet.pdf +0 -0
- data/docusaurus/.dockerignore +0 -2
- data/docusaurus/.gitignore +0 -12
- data/docusaurus/Dockerfile +0 -10
- data/docusaurus/docker-compose.yml +0 -18
- data/docusaurus/docs/commands.md +0 -69
- data/docusaurus/docs/configuration.md +0 -300
- data/docusaurus/docs/development.md +0 -15
- data/docusaurus/docs/getstarted.md +0 -46
- data/docusaurus/docs/rules.md +0 -79
- data/docusaurus/website/README.md +0 -193
- data/docusaurus/website/core/Footer.js +0 -100
- data/docusaurus/website/package.json +0 -14
- data/docusaurus/website/pages/en/index.js +0 -207
- data/docusaurus/website/pages/en/versions.js +0 -118
- data/docusaurus/website/sidebars.json +0 -11
- data/docusaurus/website/siteConfig.js +0 -171
- data/docusaurus/website/static/css/code-block-buttons.css +0 -39
- data/docusaurus/website/static/css/custom.css +0 -245
- data/docusaurus/website/static/img/favicon.ico +0 -0
- data/docusaurus/website/static/js/code-block-buttons.js +0 -47
- data/docusaurus/website/versioned_docs/version-1.0.0/commands.md +0 -70
- data/docusaurus/website/versioned_docs/version-1.0.0/configuration.md +0 -296
- data/docusaurus/website/versioned_docs/version-1.0.0/development.md +0 -16
- data/docusaurus/website/versioned_docs/version-1.0.0/getstarted.md +0 -47
- data/docusaurus/website/versioned_docs/version-1.0.0/rules.md +0 -81
- data/docusaurus/website/versioned_docs/version-1.0.2/rules.md +0 -79
- data/docusaurus/website/versioned_docs/version-2.4.0/configuration.md +0 -301
- data/docusaurus/website/versioned_docs/version-2.4.3/rules.md +0 -80
- data/docusaurus/website/versioned_sidebars/version-1.0.0-sidebars.json +0 -11
- data/docusaurus/website/versioned_sidebars/version-1.0.2-sidebars.json +0 -11
- data/docusaurus/website/versioned_sidebars/version-2.4.0-sidebars.json +0 -11
- data/docusaurus/website/versions.json +0 -12
- data/docusaurus/website/yarn.lock +0 -6604
- data/goodcheck.gemspec +0 -35
- data/goodcheck.yml +0 -10
- data/logo/GoodCheck Horizontal.pdf +0 -899
- data/logo/GoodCheck Horizontal.png +0 -0
- data/logo/GoodCheck Horizontal.svg +0 -55
- data/logo/GoodCheck logo.png +0 -0
- data/logo/GoodCheck vertical.png +0 -0
- data/sample.yml +0 -57
data/lib/goodcheck/glob.rb
CHANGED
@@ -1,21 +1,32 @@
|
|
1
1
|
module Goodcheck
|
2
2
|
class Glob
|
3
|
+
FNM_FLAGS = File::FNM_PATHNAME | File::FNM_EXTGLOB | File::FNM_DOTMATCH
|
4
|
+
|
3
5
|
attr_reader :pattern
|
4
6
|
attr_reader :encoding
|
7
|
+
attr_reader :exclude
|
5
8
|
|
6
|
-
def initialize(pattern:, encoding:)
|
9
|
+
def initialize(pattern:, encoding:, exclude:)
|
7
10
|
@pattern = pattern
|
8
11
|
@encoding = encoding
|
12
|
+
@exclude = exclude
|
9
13
|
end
|
10
14
|
|
11
15
|
def test(path)
|
12
|
-
path.fnmatch?(pattern,
|
16
|
+
path.fnmatch?(pattern, FNM_FLAGS) && !excluded?(path)
|
13
17
|
end
|
14
18
|
|
15
19
|
def ==(other)
|
16
20
|
other.is_a?(Glob) &&
|
17
21
|
other.pattern == pattern &&
|
18
|
-
other.encoding == encoding
|
22
|
+
other.encoding == encoding &&
|
23
|
+
other.exclude == exclude
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def excluded?(path)
|
29
|
+
Array(exclude).any? { |exc| path.fnmatch?(exc, FNM_FLAGS) }
|
19
30
|
end
|
20
31
|
end
|
21
32
|
end
|
@@ -1,13 +1,23 @@
|
|
1
1
|
module Goodcheck
|
2
2
|
class ImportLoader
|
3
|
-
class UnexpectedSchemaError <
|
3
|
+
class UnexpectedSchemaError < Error
|
4
4
|
attr_reader :uri
|
5
5
|
|
6
6
|
def initialize(uri)
|
7
|
+
super("Unexpected URI schema: #{uri.scheme}")
|
7
8
|
@uri = uri
|
8
9
|
end
|
9
10
|
end
|
10
11
|
|
12
|
+
class FileNotFound < Error
|
13
|
+
attr_reader :path
|
14
|
+
|
15
|
+
def initialize(path)
|
16
|
+
super("No such a file: #{path}")
|
17
|
+
@path = path
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
11
21
|
attr_reader :cache_path
|
12
22
|
attr_reader :expires_in
|
13
23
|
attr_reader :force_download
|
@@ -24,20 +34,26 @@ module Goodcheck
|
|
24
34
|
uri = URI.parse(name)
|
25
35
|
|
26
36
|
case uri.scheme
|
27
|
-
when nil
|
28
|
-
load_file
|
37
|
+
when nil
|
38
|
+
load_file name, &block
|
39
|
+
when "file"
|
40
|
+
load_file uri.path, &block
|
29
41
|
when "http", "https"
|
30
42
|
load_http uri, &block
|
31
43
|
else
|
32
|
-
raise UnexpectedSchemaError.new(
|
44
|
+
raise UnexpectedSchemaError.new(uri)
|
33
45
|
end
|
34
46
|
end
|
35
47
|
|
36
|
-
def load_file(
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
48
|
+
def load_file(path)
|
49
|
+
files = Dir.glob(File.join(config_path.parent.to_path, path), File::FNM_DOTMATCH | File::FNM_EXTGLOB).sort
|
50
|
+
if files.empty?
|
51
|
+
raise FileNotFound.new(path)
|
52
|
+
else
|
53
|
+
files.each do |file|
|
54
|
+
Goodcheck.logger.info "Reading file: #{file}"
|
55
|
+
yield File.read(file)
|
56
|
+
end
|
41
57
|
end
|
42
58
|
end
|
43
59
|
|
data/lib/goodcheck/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: goodcheck
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Soutaro Matsumoto
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -148,56 +148,10 @@ executables:
|
|
148
148
|
extensions: []
|
149
149
|
extra_rdoc_files: []
|
150
150
|
files:
|
151
|
-
- ".github/dependabot.yml"
|
152
|
-
- ".github/workflows/release.yml"
|
153
|
-
- ".github/workflows/test.yml"
|
154
|
-
- ".gitignore"
|
155
|
-
- ".rubocop.yml"
|
156
151
|
- CHANGELOG.md
|
157
|
-
- Dockerfile
|
158
|
-
- Gemfile
|
159
152
|
- LICENSE
|
160
153
|
- README.md
|
161
|
-
- Rakefile
|
162
|
-
- bin/console
|
163
|
-
- bin/setup
|
164
|
-
- cheatsheet.pdf
|
165
|
-
- docusaurus/.dockerignore
|
166
|
-
- docusaurus/.gitignore
|
167
|
-
- docusaurus/Dockerfile
|
168
|
-
- docusaurus/docker-compose.yml
|
169
|
-
- docusaurus/docs/commands.md
|
170
|
-
- docusaurus/docs/configuration.md
|
171
|
-
- docusaurus/docs/development.md
|
172
|
-
- docusaurus/docs/getstarted.md
|
173
|
-
- docusaurus/docs/rules.md
|
174
|
-
- docusaurus/website/README.md
|
175
|
-
- docusaurus/website/core/Footer.js
|
176
|
-
- docusaurus/website/package.json
|
177
|
-
- docusaurus/website/pages/en/index.js
|
178
|
-
- docusaurus/website/pages/en/versions.js
|
179
|
-
- docusaurus/website/sidebars.json
|
180
|
-
- docusaurus/website/siteConfig.js
|
181
|
-
- docusaurus/website/static/css/code-block-buttons.css
|
182
|
-
- docusaurus/website/static/css/custom.css
|
183
|
-
- docusaurus/website/static/img/favicon.ico
|
184
|
-
- docusaurus/website/static/js/code-block-buttons.js
|
185
|
-
- docusaurus/website/versioned_docs/version-1.0.0/commands.md
|
186
|
-
- docusaurus/website/versioned_docs/version-1.0.0/configuration.md
|
187
|
-
- docusaurus/website/versioned_docs/version-1.0.0/development.md
|
188
|
-
- docusaurus/website/versioned_docs/version-1.0.0/getstarted.md
|
189
|
-
- docusaurus/website/versioned_docs/version-1.0.0/rules.md
|
190
|
-
- docusaurus/website/versioned_docs/version-1.0.2/rules.md
|
191
|
-
- docusaurus/website/versioned_docs/version-2.4.0/configuration.md
|
192
|
-
- docusaurus/website/versioned_docs/version-2.4.3/rules.md
|
193
|
-
- docusaurus/website/versioned_sidebars/version-1.0.0-sidebars.json
|
194
|
-
- docusaurus/website/versioned_sidebars/version-1.0.2-sidebars.json
|
195
|
-
- docusaurus/website/versioned_sidebars/version-2.4.0-sidebars.json
|
196
|
-
- docusaurus/website/versions.json
|
197
|
-
- docusaurus/website/yarn.lock
|
198
154
|
- exe/goodcheck
|
199
|
-
- goodcheck.gemspec
|
200
|
-
- goodcheck.yml
|
201
155
|
- lib/goodcheck.rb
|
202
156
|
- lib/goodcheck/analyzer.rb
|
203
157
|
- lib/goodcheck/array_helper.rb
|
@@ -210,6 +164,8 @@ files:
|
|
210
164
|
- lib/goodcheck/commands/test.rb
|
211
165
|
- lib/goodcheck/config.rb
|
212
166
|
- lib/goodcheck/config_loader.rb
|
167
|
+
- lib/goodcheck/error.rb
|
168
|
+
- lib/goodcheck/exit_status.rb
|
213
169
|
- lib/goodcheck/glob.rb
|
214
170
|
- lib/goodcheck/home_path.rb
|
215
171
|
- lib/goodcheck/import_loader.rb
|
@@ -222,12 +178,6 @@ files:
|
|
222
178
|
- lib/goodcheck/rule.rb
|
223
179
|
- lib/goodcheck/trigger.rb
|
224
180
|
- lib/goodcheck/version.rb
|
225
|
-
- logo/GoodCheck Horizontal.pdf
|
226
|
-
- logo/GoodCheck Horizontal.png
|
227
|
-
- logo/GoodCheck Horizontal.svg
|
228
|
-
- logo/GoodCheck logo.png
|
229
|
-
- logo/GoodCheck vertical.png
|
230
|
-
- sample.yml
|
231
181
|
homepage: https://github.com/sider/goodcheck
|
232
182
|
licenses:
|
233
183
|
- MIT
|
@@ -247,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
247
197
|
- !ruby/object:Gem::Version
|
248
198
|
version: '0'
|
249
199
|
requirements: []
|
250
|
-
rubygems_version: 3.1.
|
200
|
+
rubygems_version: 3.1.4
|
251
201
|
signing_key:
|
252
202
|
specification_version: 4
|
253
203
|
summary: Regexp based customizable linter
|
data/.github/dependabot.yml
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
version: 2
|
2
|
-
updates:
|
3
|
-
- package-ecosystem: bundler
|
4
|
-
directory: "/"
|
5
|
-
schedule:
|
6
|
-
interval: monthly
|
7
|
-
time: "09:00"
|
8
|
-
timezone: Asia/Tokyo
|
9
|
-
open-pull-requests-limit: 10
|
10
|
-
versioning-strategy: increase
|
11
|
-
- package-ecosystem: npm
|
12
|
-
directory: "/docusaurus/website"
|
13
|
-
schedule:
|
14
|
-
interval: monthly
|
15
|
-
time: "09:00"
|
16
|
-
timezone: Asia/Tokyo
|
17
|
-
open-pull-requests-limit: 10
|
18
|
-
versioning-strategy: increase
|
@@ -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
|
-
See the [changelog](https://github.com/${{ github.repository }}/blob/${{ github.sha }}/CHANGELOG.md) for more details.
|
15
|
-
env:
|
16
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
data/.github/workflows/test.yml
DELETED
@@ -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
data/.rubocop.yml
DELETED
data/Dockerfile
DELETED
data/Gemfile
DELETED
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__)
|