- 11 Dec, 2018 1 commit
-
-
Yorick Peterse authored
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.
-
- 10 Dec, 2018 30 commits
-
-
Rémy Coutable authored
Remove unnecessary includes of ShellAdapter See merge request gitlab-org/gitlab-ce!23607
-
Rémy Coutable authored
Set a fixed date for frontend fixtures See merge request gitlab-org/gitlab-ce!22672
-
Robert Speicher authored
Backport some EE helper changes See merge request gitlab-org/gitlab-ce!23631
-
Robert Speicher authored
Improve feature proposal template for improved product thinking See merge request gitlab-org/gitlab-ce!23190
-
Dimitrie Hoekstra authored
-
Douwe Maan authored
Fix a frozen string error in app/mailers/notify.rb Closes #55104 See merge request gitlab-org/gitlab-ce!23683
-
Kushal Pandya authored
Adjust dropdown item and header padding to comply with design specs See merge request gitlab-org/gitlab-ce!23552
-
Winnie Hellmann authored
-
Kamil Trzciński authored
Resolve "Project Namespace field should be removed from Group Cluster, Add existing" Closes #55090 See merge request gitlab-org/gitlab-ce!23679
-
Sanad Liaquat authored
Add QA option to use the same Chrome profile Closes #52255 See merge request gitlab-org/gitlab-ce!23576
-
Dylan Griffith authored
-
Rémy Coutable authored
Signed-off-by:
Rémy Coutable <remy@rymai.me>
-
Winnie Hellmann authored
-
Phil Hughes authored
Replaces vue-resource with axios for registry code See merge request gitlab-org/gitlab-ce!23545
-
Rémy Coutable authored
Only allow strings in URL::Sanitizer.valid? Closes #55079 See merge request gitlab-org/gitlab-ce!23675
-
Rémy Coutable authored
Fix already initialized constant IDENTIFIER warning See merge request gitlab-org/gitlab-ce!23681
-
Douwe Maan authored
Check for valid refs in CommitController before doing anything Closes gitaly#1425 See merge request gitlab-org/gitlab-ce!23680
-
Douwe Maan authored
Revert "Merge branch 'bvl-reenable-codeowners' into 'master'" See merge request gitlab-org/gitlab-ce!23684
-
Grzegorz Bizon authored
Add endpoint to download single artifact by ref Closes #54626 See merge request gitlab-org/gitlab-ce!23538
-
Douwe Maan authored
This reverts merge request !23381
-
Douwe Maan authored
Populate MR metrics with events table information (migration) Closes #41587 See merge request gitlab-org/gitlab-ce!23564
-
Kamil Trzciński authored
Use new reports syntax for SAST in Auto DevOps See merge request gitlab-org/gitlab-ce!23163
-
Fabio Busatto authored
-
Filipa Lacerda authored
Fixed styling of image comment badges on commits Closes #54849 See merge request gitlab-org/gitlab-ce!23659
-
Kamil Trzciński authored
Backport operations_path helper See merge request gitlab-org/gitlab-ce!23654
-
Semyon Pupkov authored
/app/spec/uploaders/personal_file_uploader_spec.rb:3: warning: already initialized constant IDENTIFIER /app/spec/uploaders/namespace_file_uploader_spec.rb:3: warning: previous definition of IDENTIFIER was here
-
Stan Hu authored
Before a 404 would be rendered only after a request to Gitaly would return with an InvalidArgument error. Now we check that the ref have a valid format before sending it to Gitaly. In both cases, a 404 is returned to the user, but this change prevents Gitaly from generating error noise in production. Closes https://gitlab.com/gitlab-org/gitaly/issues/1425
-
Thong Kuah authored
-
Thong Kuah authored
This enables #allow_user_defined_namespace? to work so that the form for a group cluster will now longer show the "Project namespace" field.
-
Thong Kuah authored
That shows that we cannot create a new group cluster
-
- 09 Dec, 2018 1 commit
-
-
Stan Hu authored
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/55079
-
- 08 Dec, 2018 8 commits
-
-
Matija Čupić authored
-
Phil Hughes authored
CE Backport: Epic issue list and related issue list re-design See merge request gitlab-org/gitlab-ce!23658
-
Kushal Pandya authored
-
Phil Hughes authored
Resolve "Navigating unresolved discussions on Merge Request page" Closes #51122 See merge request gitlab-org/gitlab-ce!22789
-
André Luís authored
-
Clement Ho authored
Resolve "Extended user centric tooltips" Closes #50157 See merge request gitlab-org/gitlab-ce!23231
-
Tim Zallmann authored
-
Clement Ho authored
[CE] Backport SAML unlink changes: UrlBlocker#ascii_only See merge request gitlab-org/gitlab-ce!23627
-