overcommit
和
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
在我的
.overcommit.yml
PreCommit:
ALL:
exclude:
- 'bin/**'
- 'public/**'
- 'vendor/**'
# ...
# Migration Check
RailsSchemaUpToDate:
enabled: true
on_warn: fail
我的数据库文件夹结构是:
+-- 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
但我仍然遇到同样的问题。