We are seeing a lot of critical quality errors in the ruby quality profile like this:
Define a constant instead of duplicating this literal
For example if we repeat ‘Content-Type’ in a file like this:
param :header, 'Content-Type', :string, :required, 'application/json'
or when we use the i18n translations in the same file:
What is the best way to deal with these so that Sonar does not complain? It doesn’t seem correct to create a constant to contain these strings. Is there some best practice that should be followed for these types of repeatable strings?
I can’t seem to find any documentation on it.
Note that we have no control over the quality profile so we cannot turn it off.