Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2019-03-28Inherit from ApplicationRecord instead of ActiveRecord::BaseNick Thomas
2019-01-14Add clear_credentials method to ProjectImportDataStan Hu
This backports changes made in https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/9134.
2018-12-11Refactor Project#create_or_update_import_dataYorick Peterse
In https://gitlab.com/gitlab-org/release/framework/issues/28 we found that this method was changed a lot over the years: 43 times if our calculations were correct. Looking at the method, it had quite a few branches going on: def create_or_update_import_data(data: nil, credentials: nil) return if data.nil? && credentials.nil? project_import_data = import_data || build_import_data if data project_import_data.data ||= {} project_import_data.data = project_import_data.data.merge(data) end if credentials project_import_data.credentials ||= {} project_import_data.credentials = project_import_data.credentials.merge(credentials) end project_import_data end If we turn the || and ||= operators into regular if statements, we can see a bit more clearly that this method has quite a lot of branches in it: def create_or_update_import_data(data: nil, credentials: nil) if data.nil? && credentials.nil? return else project_import_data = if import_data import_data else build_import_data end if data if project_import_data.data # nothing else project_import_data.data = {} end project_import_data.data = project_import_data.data.merge(data) end if credentials if project_import_data.credentials # nothing else project_import_data.credentials = {} end project_import_data.credentials = project_import_data.credentials.merge(credentials) end project_import_data end end The number of if statements and branches here makes it easy to make mistakes. To resolve this, we refactor this code in such a way that we can get rid of all but the first `if data.nil? && credentials.nil?` statement. We can do this by simply sending `to_h` to `nil` in the right places, which removes the need for statements such as `if data`. Since this data gets written to a database, in ProjectImportData we do make sure to not write empty Hash values. This requires an `unless` (which is really a `if !`), but the resulting code is still very easy to read.
2018-07-27Enable frozen string in app/models/*.rbgfyoung
Partially addresses #47424.
2018-05-30Upgrade to Ruby 2.4.4Stan Hu
Fixes that make this work: * A change in Ruby (https://github.com/ruby/ruby/commit/ce635262f53b760284d56bb1027baebaaec175d1) requires passing in the exact required length for OpenSSL keys and IVs. * Ensure the secrets.yml is generated before any prepended modules are loaded. This is done by renaming the `secret_token.rb` initializer to `01_secret_token.rb`, which is a bit ugly but involves the least impact on other files.
2017-08-07Backport changes in ↵Nick Thomas
https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/2551 to CE
2017-07-06Rename ActiverecordSerialize copYorick Peterse
This cop has been renamed to ActiveRecordSerialize to match the way "ActiveRecord" is usually written.
2017-05-31Added Cop to blacklist the use of serializeYorick Peterse
This Cop blacklists the use of ActiveRecord's "serialize" method, except for cases where we already use this.
2016-06-28add missing attribute to attr_encrypted so it is fully backwards-compatibleJames Lopez
2016-05-30Upgrade attr_encrypted and encryptorConnor Shea
attr_encrypted (1.3.4 => 3.0.1) Changelog: https://github.com/attr-encrypted/attr_encrypted/blob/master/CHANGELOG.m d attr_encrypted 2.x included a vulnerability, so that major version is skipped. 3.x requires that the algorithm and mode used by each encrypted attribute is specified explicitly. `nil` is no longer a valid value for the encrypted_value_iv field, so it’s changed to a randomly generated string.
2016-05-09Remove the annotate gem and delete old annotationsJeroen van Baarsen
In 8278b763d96ef10c6494409b18b7eb541463af29 the default behaviour of annotation has changes, which was causing a lot of noise in diffs. We decided in #17382 that it is better to get rid of the whole annotate gem, and instead let people look at schema.rb for the columns in a table. Fixes: #17382
2016-05-06Annotate modelsDmitriy Zaporozhets
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2016-05-06Annotate the modelsZeger-Jan van de Weg
2016-04-19Remove useless require 'file_size_validator' causing warningsRémy Coutable
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-04-11changed a few things based on feedbackJames Lopez
2016-04-06removed TODO [ci skip]James Lopez
2016-04-06fix some issues with credentialsJames Lopez
2016-04-05some refactoring to symbolise keys across importers and left a TODOJames Lopez
2016-04-01fix fogbugz importJames Lopez
2016-03-21fixed some rubocop warningsJames Lopez
2016-03-21fixed few issues with the migrationJames Lopez
2016-03-07refactored a bunch of stuff based on MR feedbackJames Lopez
2016-03-04fix specsJames Lopez
2016-03-04added import url exposer to construct URL withunencrypted credentialsJames Lopez
2016-03-03WIP - refactored migration and updated project_import_data with encrypted attJames Lopez
2015-05-03Re-annotate modelsStan Hu
2015-04-17Move import data out of project so it doesn't take ages to load.Douwe Maan