我遇到了一个奇怪的问题overcommit
and Rails 5.0.2
应用程序与ruby 2.4.0
:
$ overcommit --run
Running pre-commit hooks
Check if database schema is up to date..........[RailsSchemaUpToDate] OK
Check YAML syntax........................................[YamlSyntax] OK
Check Gemfile dependencies..............................[BundleCheck] OK
Check for vulnerable versions of gems...................[BundleAudit] OK
Analyze with RuboCop........................................[RuboCop] OK
Analyze with haml-lint.....................................[HamlLint] OK
✓ All pre-commit hooks passed
$ git ci -m "Overcommit and Linters added"
Running pre-commit hooks
Check if database schema is up to date..........[RailsSchemaUpToDate] FAILED
It looks like you're adding a migration, but did not update the schema file
Check YAML syntax........................................[YamlSyntax] OK
Check Gemfile dependencies..............................[BundleCheck] OK
Check for vulnerable versions of gems...................[BundleAudit] OK
Analyze with RuboCop........................................[RuboCop] OK
Analyze with haml-lint.....................................[HamlLint] OK
✗ One or more pre-commit hooks failed
这是我的相关部分Gemfile
:
group :lint do
gem 'overcommit', '~> 0.41', require: false # hook event pre-commit, pre-push
gem 'brakeman', '~> 3.7.2', require: false # A static analysis security vulnerability scanner
gem 'haml-lint', '~> 0.26', require: false # Syntax checker for HAML
gem 'ruby_css_lint', '~> 0.1', require: false # Syntax checker for CSS
gem 'rubocop', '~> 0.50', require: false # A Ruby static code analyzer
gem 'bundler-audit', '~> 0.6' # Check dependencies
end
In my .overcommit.yml
I have:
PreCommit:
ALL:
exclude:
- 'bin/**'
- 'public/**'
- 'vendor/**'
# ...
# Migration Check
RailsSchemaUpToDate:
enabled: true
on_warn: fail
我的 db 文件夹结构是:
+-- db
| +-- seeds.rb
| +-- migrate
| +-- 20170922082256_devise_create_users.rb
| +-- 20170922084050_create_fans.rb
| +-- schema.rb
这是我的相关部分db/schema.rb
:
ActiveRecord::Schema.define(version: 20170922084050) do
# ...
end
我尝试降级到ruby 2.3.1
但我仍然遇到同样的问题。
有人遇到同样的问题吗?