Commit 46c03e93 authored by Marcel Amirault's avatar Marcel Amirault

Merge branch 'docs-formatter' into 'master'

docs: Format code blocks

See merge request gitlab-org/gitlab!62972
parents d830b385 9af54596
......@@ -275,7 +275,7 @@ installations from source.
It contains the JSON version of the logs in `application.log` like the example below:
``` json
```json
{
"severity":"INFO",
"time":"2020-01-14T13:35:15.466Z",
......
......@@ -100,7 +100,7 @@ Consider the following pipeline, with jobs `A`, `B`, and `C`. Imagine you want:
To achieve this, you can configure your `.gitlab-ci.yml` file as follows:
``` yaml
```yaml
.only-default: &only-default
only:
- main
......
......@@ -41,7 +41,7 @@ jobs:
Example of the same job definition in GitLab CI/CD:
``` yaml
```yaml
job1:
script: "execute-script-for-job1"
```
......
......@@ -538,7 +538,7 @@ In this case, we could as well just use `render_ce` which would ignore any EE
partials. One example would be
`ee/app/views/shared/issuable/form/_default_templates.html.haml`:
``` haml
```haml
- if @project.feature_available?(:issuable_default_templates)
= render_ce 'shared/issuable/form/default_templates'
- elsif show_promotions?
......
......@@ -68,7 +68,7 @@ objects are touching them, then it would be an acceptable use.
We especially allow the case where a single instance variable is used with
`||=` to set up the value. This would look like:
``` ruby
```ruby
module M
def f
@f ||= true
......@@ -85,7 +85,7 @@ we could easily add to the cop, we should do it.
Even if we could just disable the cop, we should avoid doing so. Some code
could be easily rewritten in simple form. Consider this acceptable method:
``` ruby
```ruby
module Gitlab
module Emoji
def emoji_unicode_version(name)
......@@ -104,7 +104,7 @@ cop is not smart enough to judge that this is fine.
On the other hand, we could split this method into two:
``` ruby
```ruby
module Gitlab
module Emoji
def emoji_unicode_version(name)
......@@ -127,7 +127,7 @@ Now the cop doesn't complain.
Put the disabling comment right after your code in the same line:
``` ruby
```ruby
module M
def violating_method
@f + @g # rubocop:disable Gitlab/ModuleWithInstanceVariables
......@@ -137,7 +137,7 @@ end
If there are multiple lines, you could also enable and disable for a section:
``` ruby
```ruby
module M
# rubocop:disable Gitlab/ModuleWithInstanceVariables
def violating_method
......@@ -167,13 +167,13 @@ point of view), making it extremely hard to track data dependency.
We're trying to use something like this instead:
``` haml
```haml
= render 'projects/commits/commit', commit: commit, ref: ref, project: project
```
And in the partial:
``` haml
```haml
- ref = local_assigns.fetch(:ref)
- commit = local_assigns.fetch(:commit)
- project = local_assigns.fetch(:project)
......
......@@ -143,7 +143,7 @@ Service classes usually have an `execute` method, which can return a
In a successful case:
``` ruby
```ruby
response = ServiceResponse.success(message: 'Branch was deleted')
response.success? # => true
......@@ -154,7 +154,7 @@ response.message # => 'Branch was deleted'
In a failed case:
``` ruby
```ruby
response = ServiceResponse.error(message: 'Unsupported operation')
response.success? # => false
......@@ -165,7 +165,7 @@ response.message # => 'Unsupported operation'
An additional payload can also be attached:
``` ruby
```ruby
response = ServiceResponse.success(payload: { issue: issue })
response.payload[:issue] # => issue
......
......@@ -14,7 +14,7 @@ Refer to [`merge_hash.rb`](https://gitlab.com/gitlab-org/gitlab/blob/master/lib/
- Deep merges an array of hashes:
``` ruby
```ruby
Gitlab::Utils::MergeHash.merge(
[{ hello: ["world"] },
{ hello: "Everyone" },
......@@ -25,7 +25,7 @@ Refer to [`merge_hash.rb`](https://gitlab.com/gitlab-org/gitlab/blob/master/lib/
Gives:
``` ruby
```ruby
[
{
hello:
......@@ -41,7 +41,7 @@ Refer to [`merge_hash.rb`](https://gitlab.com/gitlab-org/gitlab/blob/master/lib/
- Extracts all keys and values from a hash into an array:
``` ruby
```ruby
Gitlab::Utils::MergeHash.crush(
{ hello: "world", this: { crushes: ["an entire", "hash"] } }
)
......@@ -49,7 +49,7 @@ Refer to [`merge_hash.rb`](https://gitlab.com/gitlab-org/gitlab/blob/master/lib/
Gives:
``` ruby
```ruby
[:hello, "world", :this, :crushes, "an entire", "hash"]
```
......@@ -69,7 +69,7 @@ Refer to [`override.rb`](https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gi
Here's a simple example:
``` ruby
```ruby
class Base
def execute
end
......@@ -86,7 +86,7 @@ Refer to [`override.rb`](https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gi
This also works on modules:
``` ruby
```ruby
module Extension
extend ::Gitlab::Utils::Override
......@@ -164,7 +164,7 @@ Refer to [`strong_memoize.rb`](https://gitlab.com/gitlab-org/gitlab/blob/master/
Instead of writing patterns like this:
``` ruby
```ruby
class Find
def result
return @result if defined?(@result)
......@@ -176,7 +176,7 @@ Refer to [`strong_memoize.rb`](https://gitlab.com/gitlab-org/gitlab/blob/master/
You could write it like:
``` ruby
```ruby
class Find
include Gitlab::Utils::StrongMemoize
......@@ -190,7 +190,7 @@ Refer to [`strong_memoize.rb`](https://gitlab.com/gitlab-org/gitlab/blob/master/
- Clear memoization
``` ruby
```ruby
class Find
include Gitlab::Utils::StrongMemoize
end
......@@ -209,7 +209,7 @@ method level values, and optional method arguments.
A simple example that only uses the instance level customised values is:
``` ruby
```ruby
class UserAccess
extend Gitlab::Cache::RequestCache
......@@ -230,7 +230,7 @@ instance variable so the cache logic would be the same.
We can also set different strategies for different methods:
``` ruby
```ruby
class Commit
extend Gitlab::Cache::RequestCache
......
......@@ -323,7 +323,7 @@ at the logs that are produced by the container scanning analyzer in `container_s
The log contains a list of found vulnerabilities as a table, for example:
```plainttext
```plaintext
+------------+-------------------------+------------------------+-----------------------+------------------------------------------------------------------------+
| STATUS | CVE SEVERITY | PACKAGE NAME | PACKAGE VERSION | CVE DESCRIPTION |
+------------+-------------------------+------------------------+-----------------------+------------------------------------------------------------------------+
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment