forked from jakeonrails/fix-db-schema-conflicts
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow projects to define their own Rubocop config
The fix-db-schema-conflicts gem currently does not support rubocop v0.54.0. The maintainer is considering solutions to allow projects to set the rubocop configuration used by fix-db-schema-conflicts. jakeonrails#28
- Loading branch information
Showing
2 changed files
with
19 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,21 @@ | ||
require 'fix_db_schema_conflicts/schema_dumper.rb' | ||
require 'fix_db_schema_conflicts/schema_dumper' | ||
require 'fix_db_schema_conflicts/autocorrect_configuration' | ||
|
||
require 'fix_db_schema_conflicts/railtie' if defined?(Rails) | ||
|
||
module FixDBSchemaConflicts | ||
require 'fix_db_schema_conflicts/railtie' if defined?(Rails) | ||
class << self | ||
def rubocop_config=(config_path) | ||
@rubocop_config = config_path | ||
end | ||
|
||
def rubocop_config | ||
@rubocop_config || default_config | ||
end | ||
|
||
def default_config | ||
relative_path = AutocorrectConfiguration.load | ||
File.expand_path("../#{relative_path}", __dir__) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fd9a105
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @tonyta would (or did) you consider making a PR to the official gem?
fd9a105
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alexanderadam This implementation was a bit naive and the maintainer looked like he was looking into strategies himself (jakeonrails#28), so I haven't bothered making a PR.
I am working on a spike with tests for multiple Ruby and Rails versions and compatibility thoughout different RuboCop versions as well. But haven't had the time to polish it up. Maybe someday soon...