1. 16 Jan, 2019 2 commits
    • Yorick Peterse's avatar
      Fix detecting nested EE constants in RuboCop · 9722158c
      Yorick Peterse authored
      The InjectEnterpriseEditionModule cop would not detect certain nested EE
      constants such as `EE::Foo::Bar::Baz`. This could result in it not
      enforcing `prepend` being placed on the last line. This commit fixes
      this by just performing a string match on the line, instead of relying
      on AST matching.
    • Bob Van Landuyt's avatar
      Prevent factories in background migration specs · 7c801333
      Bob Van Landuyt authored
      The Background migration specs also run against a certain version of
      the database. So we should avoid using factories.
  2. 13 Dec, 2018 1 commit
    • Yorick Peterse's avatar
      Added Cop for injecting EE modules · 7c580556
      Yorick Peterse authored
      This Cop enforces the rule that injecting EE modules (using prepend,
      include, or extend) is done by placing the injection on the last line of
      a file, instead of somewhere in the middle. By placing these lines at
      the very end, merge conflicts will not happen.
  3. 27 Nov, 2018 1 commit
    • Toon Claes's avatar
      Make add_reference cop accept a hash for :index · 54b63919
      Toon Claes authored
      It might happen you want to make the reference column have a unique
      value, or you want to create partial indexes. So instead of only
      accepting a `true` value, also accept a hash of options.
  4. 22 Nov, 2018 1 commit
  5. 31 Oct, 2018 1 commit
  6. 15 Oct, 2018 1 commit
  7. 24 Sep, 2018 1 commit
  8. 21 Sep, 2018 1 commit
  9. 19 Sep, 2018 1 commit
    • Bob Van Landuyt's avatar
      Remove unused constant · 23d55015
      Bob Van Landuyt authored
      This removes an unused constant from the
      `RubyInterpolationInTranslation`. The constant was used in a first
      implementation of this class.
  10. 17 Sep, 2018 1 commit
    • Yorick Peterse's avatar
      Added FromUnion to easily select from a UNION · 8a72f5c4
      Yorick Peterse authored
      This commit adds the module `FromUnion`, which provides the class method
      `from_union`. This simplifies the process of selecting data from the
      result of a UNION, and reduces the likelihood of making mistakes. As a
      result, instead of this:
          union = Gitlab::SQL::Union.new([foo, bar])
          Foo.from("(#{union.to_sql}) #{Foo.table_name}")
      We can now write this instead:
          Foo.from_union([foo, bar])
      This commit also includes some changes to make this new setup work
      properly. For example, a bug in Rails 4
      (https://github.com/rails/rails/issues/24193) would break the use of
      `from("sub-query-here").includes(:relation)` in certain cases. There was
      also a CI query which appeared to repeat a lot of conditions from an
      outer query on an inner query, which isn't necessary.
      Finally, we include a RuboCop cop to ensure developers use this new
      module, instead of using Gitlab::SQL::Union directly.
      Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/51307
  11. 11 Sep, 2018 1 commit
  12. 05 Sep, 2018 1 commit
  13. 29 Aug, 2018 5 commits
  14. 25 Aug, 2018 1 commit
    • Bob Van Landuyt's avatar
      Reject ruby interpolation in externalized strings · 08c0a1b8
      Bob Van Landuyt authored
      When using ruby interpolation in externalized strings, they can't be
      detected. Which means they will never be presented to be translated.
      To mix variables into translations we need to use `sprintf`
      Instead of:
          _("Hello #{subject}")
          _("Hello %{subject}) % { subject: 'world' }
  15. 16 Aug, 2018 1 commit
  16. 08 Aug, 2018 1 commit
  17. 09 Jul, 2018 1 commit
  18. 22 Jun, 2018 1 commit
  19. 20 Jun, 2018 1 commit
    • Bob Van Landuyt's avatar
      Add a cop for `FinderMethods` · f3f1df14
      Bob Van Landuyt authored
      This notifies developers when calling `find(_by!)` chained on
      `execute`. And suggests using the methods from `FinderMethods`. These
      will perform the correct authorization checks on the resource when it
      is found.
  20. 19 Jun, 2018 1 commit
    • Sean McGivern's avatar
      Disallow methods that copy data on large tables · eb086a4b
      Sean McGivern authored
      {change_column_type,rename_column}_concurrently both copy data from one column
      to another during a migration, which should not be done on GitLab.com. Instead,
      we should use background migrations.
  21. 29 May, 2018 1 commit
  22. 23 Apr, 2018 1 commit
  23. 18 Apr, 2018 2 commits
  24. 09 Apr, 2018 1 commit
  25. 06 Apr, 2018 1 commit
  26. 21 Mar, 2018 1 commit
  27. 08 Mar, 2018 1 commit
  28. 31 Jan, 2018 1 commit
  29. 12 Jan, 2018 1 commit
  30. 11 Jan, 2018 1 commit
  31. 26 Dec, 2017 1 commit
  32. 22 Dec, 2017 1 commit
  33. 13 Dec, 2017 1 commit
  34. 11 Dec, 2017 1 commit
    • Sean McGivern's avatar
      Add cop for use of remove_column · 1ab33b15
      Sean McGivern authored
      remove_column should only be used in the up (or change) step of a migration if
      it's a post-deployment migration. Otherwise there will be downtime due to the
      ActiveRecord column cache, which we can avoid by using the IgnorableColumn
      concern in combination with a post-deployment migration.