Skip to content

Add frozen_string_literal: true to specs

Danger requires frozen_string_literal: true for new .rb files

https://gitlab.com/gitlab-org/gitlab-ce/issues/47424 added the magic comment for all application files. The next major offender is spec files. Since we move spec files often, we should add this magic comment to all existing spec .rb files too.

Use this sed script which could be useful to replace:

git grep -L frozen_string_literal <directory> | grep "\.rb$"  | xargs -n1 sed -i "" '1s/^/# frozen_string_literal: true\'$'\n\\'$'\n/'
Edited by Thong Kuah