Multi-line comments do not resolve automatically
Summary
Our Code Style requires any control statement (such as if
, while
etc.) that spans over multiple lines (regardless of whether it is the statement itself or its contents) to have curly braces to provide a clearer visual indication on where block begins/ends.
Only single-line statements may omit curly braces.
Steps to reproduce
- Pick a project that has "Automatically resolve merge request diff discussions when they become outdated" enabled in the General > Merge requests settings.
- Create a merge request that contains code which is missing block delimiters. Example:
// this is permitted
if (condition)
this.IsFine();
// this requires curly braces
if (condition)
for (int i = 0; i < 10; i++)
Console.WriteLine("Counting {0}", i);
- Add a multi-line comment (with or without a code suggestions) that turns the second statement into this:
// this requires curly braces
if (condition)
+{
for (int i = 0; i < 10; i++)
Console.WriteLine("Counting {0}", i);
+}
- Make this change in the associated branch to add the curly braces and push the changes.
- Expect the comment to be resolved automatically.
Example Project
What is the current bug behavior?
The comment remains, and has to be marked as resolved by hand. So far, this seems to be the case regardless of where/how the multi-line comment is created (that is: including the block before, including lines around or just including the indented code)
What is the expected correct behavior?
Since the general code range (where the multi-line comment applies) has changed, the expectation is that the comment is automatically resolved.
Relevant logs and/or screenshots
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true
)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true
)(we will only investigate if the tests are passing)