Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rubocop: Inherit rules from cookpad/styleguide and auto-correct all #330

Merged
merged 4 commits into from
Mar 5, 2024

Conversation

nekketsuuu
Copy link
Contributor

  • Updated rubocop to the latest, and installed recommended rubocop extensions
  • Applied cookpad/styleguide rules
  • Refactored MaskedDatum to remove class variables

Also enable some extentions according to rubocop suggestions
- Avoid using class variables https://github.com/cookpad/styleguide/blob/master/ruby.en.md#variables
    - But class_attribute with the default value which is calculated using an instance method is a bit difficult
- Remove cache and query directly, in order to remove both class variables and class_attributes
    - The calculation cost will be roughly the same
@nekketsuuu nekketsuuu requested a review from a team February 28, 2024 12:39
scope :masking_table, ->(database_name, table_name) {
masking_database(database_name)
.or(where(database_name: database_name, table_name: table_name, column_name: ANY_NAME))
.or(where(database_name: ANY_NAME, table_name: table_name, column_name: ANY_NAME))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this also fixes behavior for */#{table_name}/*

@nekketsuuu nekketsuuu merged commit 7852c87 into master Mar 5, 2024
2 checks passed
@nekketsuuu nekketsuuu deleted the nekketsuuu-cookpad-rubocop branch March 5, 2024 05:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants