Commit Graph

87 Commits

Author SHA1 Message Date
dfa6eac075 Add latest changes from gitlab-org/gitlab@master 2023-11-07 09:08:54 +00:00
5c59989677 Add latest changes from gitlab-org/gitlab@master 2023-02-15 03:10:54 +00:00
ef58231bd6 Add latest changes from gitlab-org/gitlab@master 2023-01-18 12:07:21 +00:00
5150ecc452 Add latest changes from gitlab-org/gitlab@master 2022-10-17 18:09:13 +00:00
67049ac7aa Add latest changes from gitlab-org/gitlab@master 2021-10-26 18:09:19 +00:00
f2c27c6f97 Add latest changes from gitlab-org/gitlab@master 2021-01-06 12:10:58 +00:00
ce2a803dc4 Add latest changes from gitlab-org/gitlab@master 2020-02-17 00:09:21 +00:00
866ca4e49f Add latest changes from gitlab-org/gitlab@master 2020-02-14 21:09:08 +00:00
0ab47b994c Add latest changes from gitlab-org/gitlab@master 2020-02-13 15:08:52 +00:00
6b833f1e03 Add latest changes from gitlab-org/gitlab@master 2020-02-04 15:08:40 +00:00
6b9d3a4e83 Add latest changes from gitlab-org/gitlab@master 2020-01-29 18:08:47 +00:00
571d993b49 Add latest changes from gitlab-org/gitlab@master 2020-01-15 18:08:34 +00:00
1caa60060b Add latest changes from gitlab-org/gitlab@master 2019-12-19 00:08:01 +00:00
71221554dd Add latest changes from gitlab-org/gitlab@master 2019-12-04 21:07:31 +00:00
8644755363 Add latest changes from gitlab-org/gitlab@master 2019-12-01 06:06:11 +00:00
4f05a63095 Add latest changes from gitlab-org/gitlab@master 2019-11-28 18:06:11 +00:00
90a06a20be Add latest changes from gitlab-org/gitlab@master 2019-11-07 15:06:33 +00:00
f155cc9034 Add latest changes from gitlab-org/gitlab@master 2019-10-16 03:06:12 +00:00
40d3d57413 Add latest changes from gitlab-org/gitlab@master 2019-09-13 18:06:03 +00:00
b7dfe2ae40 Add latest changes from gitlab-org/gitlab@master 2019-09-13 13:26:31 +00:00
daf7810e2e Add Scalability/FileUploads cop
This cop prevents you from using file in API, it points you to the
development documentation about workhorse file acceleration.
2019-09-10 16:24:10 +00:00
4f2ac51644 Add Rubocop check to avoid using be_success
Prevent using `be_success` call in controller specs to avoid
getting following deprecation warning:

```
DEPRECATION WARNING: The success? predicate is deprecated and
will be removed in Rails 6.0.
Please use successful? as provided by Rack::Response::Helpers.
```
2019-08-28 08:43:47 +02:00
4706352416 Adds cop to enforce string limits on migrations
This cop will analyze migrations that add columns with string, and
report an offense if the string has no limit enforced

Related to https://gitlab.com/gitlab-org/gitlab-ce/issues/64505
2019-08-23 21:36:12 +00:00
ab0a6455c7 Add RSpec/TopLevelDescribePath cop
The RSpec/FilePath cop checks that a spec file's path is correct, but
only if the file describes a constant. We want to check, for any file
with a top-level `describe`, whether the file path ends in
`_spec.rb`. We don't care what comes before that; just that it will be
executed by RSpec at all.
2019-08-01 11:07:26 +01:00
0ab89d8e36 Add a rubocop for Rails.logger
Suggests to use a JSON structured log instead

Related to https://gitlab.com/gitlab-org/gitlab-ce/issues/54102
2019-07-10 19:26:47 +00:00
ac2d08212b Add a cop to ensure we authorize GraphQL types 2019-06-21 13:00:50 +02:00
f93b2e02a5 Run rubocop -a on CE files 2019-05-05 03:24:28 -07:00
fad99d934f Add Rubocop rule to ban include ActionView::Context 2019-04-29 06:14:53 -07:00
650f40865e Forbid the use of #reload and prefer #reset
The `#reload` makes to load all objects into memory,
and the main purpose of `#reload` is to drop the association cache.

The `#reset` seems to solve exactly that case.
2019-04-15 13:05:14 +02:00
7c58055631 Added Cop for injecting EE modules
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.
2018-12-13 16:09:21 +01:00
186b2143ab Add cop prohibiting params argument in url_for 2018-11-22 10:08:18 +01:00
02c47f2f73 Add a new QA::ElementWithPattern cop
This cop forbids the use of `element :foo, 'pattern'` and
`element :bar, /pattern/` in QA files.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2018-10-15 14:28:03 +02:00
81d949f656 Applies the CE backport of EE#657 2018-09-24 12:02:01 +01:00
0896d6942d Fix leading slash in redirects and add cop 2018-09-21 14:10:20 +00:00
8a72f5c427 Added FromUnion to easily select from a UNION
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
2018-09-17 12:39:43 +02:00
91c40973dc Added RuboCop cops to enforce code reuse rules
These Cops enforces the code reuse rules as defined in merge request
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/21254.
2018-09-11 15:00:18 +02:00
2f0327b7d8 Adds Rubocop rule to enforce class_methods over module ClassMethods 2018-08-29 16:56:34 +02:00
08c0a1b852 Reject ruby interpolation in externalized strings
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.

Instead of:

    _("Hello #{subject}")

Use:

    _("Hello %{subject}) % { subject: 'world' }
2018-08-25 18:43:21 +02:00
96ce2da74e Blacklist the use of "destroy_all"
This method usually has really bad performance implications, as it loads
rows into memory and deletes them one by one.
2018-08-16 17:29:33 +02:00
e3ff390986 Add rubocop check for add_reference to require index. 2018-08-08 23:30:48 +02:00
f3f1df1476 Add a cop for FinderMethods
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.
2018-06-20 18:13:13 +02:00
6f292eaa69 Revert the addition of goldiloader
This reverts the addition of the "goldiloader" Gem and all use of it.
While this Gem is very promising it's causing a variety of problems on
GitLab.com due to it eager-loading too much data in places where we
don't expect/can handle this. At least for the time being this means we
have to go back to manually fixing N+1 query problems, but at least
those should not cause a negative impact on availability.
2018-04-18 15:51:39 +02:00
c6b1043e9d Resolve "Make a Rubocop that forbids returning from a block" 2018-04-18 09:19:40 +00:00
4ef3e3491e Add cop for has_many :through without disabled autoloading
Goldiloader is great, but has several issues with has_many :through relations:

* https://github.com/salsify/goldiloader/issues/12
* https://github.com/salsify/goldiloader/issues/14
* https://github.com/salsify/goldiloader/issues/18

Rather than try to figure out which applies in each case, we should just do the
drudge work of manually disabling autoloading for all relations of this type. We
can always use regular preloading for specific cases, but this way we avoid
generating invalid queries through Goldiloader's magic.
2018-04-09 12:47:04 +01:00
4b035896c4 Introduce a new FactoriesInMigrationSpecs cop
Signed-off-by: Rémy Coutable <remy@rymai.me>
2018-04-06 17:41:52 +02:00
95ced3bb5f Merge branch 'fj-15329-services-callbacks-ssrf' into 'security-10-6'
Server Side Request Forgery in Services and Web Hooks

See merge request gitlab/gitlabhq!2337
2018-03-21 14:39:21 +00:00
5c7a738105 [CE] Add Naming/FileName rule checking expected class/module per filename 2018-03-08 12:56:54 +00:00
4f00a05152 Introduce PredicateMemoization cop and fix offenses
with StrongMemoize
2018-01-12 17:54:55 +08:00
729f05f0e3 Adds Rubocop rule for line break around conditionals 2018-01-11 16:34:01 +00:00
cc7a7aad80 Require our own custom cops; Remove missing cops
Also try to use the same config from EE
2017-12-26 16:30:36 +08:00