From 9fddb8625e832bc0c1316c193d02b669d65b39ad Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 17 May 2024 14:27:32 +0200 Subject: [PATCH] rubocop: Fix Style/FrozenStringLiteralComment --- .rubocop_todo.yml | 7 ------- .simplecov | 2 ++ Gemfile | 2 ++ Rakefile | 2 ++ bin/msync | 1 + features/step_definitions/git_steps.rb | 2 ++ features/support/env.rb | 2 ++ lib/modulesync.rb | 2 ++ lib/modulesync/cli.rb | 2 ++ lib/modulesync/cli/thor.rb | 2 ++ lib/modulesync/constants.rb | 12 +++++++----- lib/modulesync/git_service.rb | 2 ++ lib/modulesync/git_service/base.rb | 2 ++ lib/modulesync/git_service/factory.rb | 2 ++ lib/modulesync/git_service/github.rb | 2 ++ lib/modulesync/git_service/gitlab.rb | 2 ++ lib/modulesync/hook.rb | 2 ++ lib/modulesync/puppet_module.rb | 2 ++ lib/modulesync/renderer.rb | 2 ++ lib/modulesync/repository.rb | 2 ++ lib/modulesync/settings.rb | 2 ++ lib/modulesync/source_code.rb | 2 ++ lib/modulesync/util.rb | 2 ++ lib/monkey_patches.rb | 2 ++ modulesync.gemspec | 2 ++ spec/helpers/faker.rb | 2 ++ spec/helpers/faker/puppet_module_remote_repo.rb | 2 ++ spec/spec_helper.rb | 2 ++ spec/unit/module_sync/git_service/factory_spec.rb | 2 ++ spec/unit/module_sync/git_service/github_spec.rb | 2 ++ spec/unit/module_sync/git_service/gitlab_spec.rb | 2 ++ spec/unit/module_sync/git_service_spec.rb | 2 ++ spec/unit/module_sync/settings_spec.rb | 2 ++ spec/unit/module_sync/source_code_spec.rb | 2 ++ spec/unit/module_sync_spec.rb | 2 ++ 35 files changed, 72 insertions(+), 12 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 7bb349d9..9082b53a 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -100,13 +100,6 @@ Style/FetchEnvVar: Exclude: - 'lib/modulesync/git_service.rb' -# Offense count: 34 -# This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: always, always_true, never -Style/FrozenStringLiteralComment: - Enabled: false - # Offense count: 1 # Configuration parameters: AllowedMethods. # AllowedMethods: respond_to_missing? diff --git a/.simplecov b/.simplecov index 30cde509..de97b546 100644 --- a/.simplecov +++ b/.simplecov @@ -1,3 +1,5 @@ +# frozen_string_literal: true + SimpleCov.start do if ENV['SIMPLECOV_ROOT'] SimpleCov.root(ENV['SIMPLECOV_ROOT']) diff --git a/Gemfile b/Gemfile index 10d0a09e..1a815a34 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + source ENV['GEM_SOURCE'] || 'https://rubygems.org' gemspec diff --git a/Rakefile b/Rakefile index 4fbf754e..c377c1d9 100644 --- a/Rakefile +++ b/Rakefile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'rake/clean' require 'cucumber/rake/task' require 'rubocop/rake_task' diff --git a/bin/msync b/bin/msync index b6831083..ad0456c7 100755 --- a/bin/msync +++ b/bin/msync @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# frozen_string_literal: true if ENV['COVERAGE'] # This block allow us to grab code coverage when running this script. diff --git a/features/step_definitions/git_steps.rb b/features/step_definitions/git_steps.rb index e8848ff9..d7739263 100644 --- a/features/step_definitions/git_steps.rb +++ b/features/step_definitions/git_steps.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require_relative '../../spec/helpers/faker/puppet_module_remote_repo' Given 'a basic setup with a puppet module {string} from {string}' do |name, namespace| diff --git a/features/support/env.rb b/features/support/env.rb index fb5a264e..31bd73b5 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'simplecov' SimpleCov.command_name 'Cucumber' diff --git a/lib/modulesync.rb b/lib/modulesync.rb index a447aaa9..33dabbe6 100644 --- a/lib/modulesync.rb +++ b/lib/modulesync.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'English' require 'fileutils' require 'pathname' diff --git a/lib/modulesync/cli.rb b/lib/modulesync/cli.rb index 1c28ce4e..b6ece1ee 100644 --- a/lib/modulesync/cli.rb +++ b/lib/modulesync/cli.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'thor' require 'modulesync' diff --git a/lib/modulesync/cli/thor.rb b/lib/modulesync/cli/thor.rb index 658e7816..9c1ebd63 100644 --- a/lib/modulesync/cli/thor.rb +++ b/lib/modulesync/cli/thor.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'thor' require 'modulesync/cli' diff --git a/lib/modulesync/constants.rb b/lib/modulesync/constants.rb index 9f9853da..80a36586 100644 --- a/lib/modulesync/constants.rb +++ b/lib/modulesync/constants.rb @@ -1,10 +1,12 @@ +# frozen_string_literal: true + module ModuleSync module Constants - MODULE_FILES_DIR = 'moduleroot/'.freeze - CONF_FILE = 'config_defaults.yml'.freeze - MODULE_CONF_FILE = '.sync.yml'.freeze - MODULESYNC_CONF_FILE = 'modulesync.yml'.freeze - HOOK_FILE = '.git/hooks/pre-push'.freeze + MODULE_FILES_DIR = 'moduleroot/' + CONF_FILE = 'config_defaults.yml' + MODULE_CONF_FILE = '.sync.yml' + MODULESYNC_CONF_FILE = 'modulesync.yml' + HOOK_FILE = '.git/hooks/pre-push' GLOBAL_DEFAULTS_KEY = :global end end diff --git a/lib/modulesync/git_service.rb b/lib/modulesync/git_service.rb index 9c5a5538..e877162a 100644 --- a/lib/modulesync/git_service.rb +++ b/lib/modulesync/git_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ModuleSync class Error < StandardError; end diff --git a/lib/modulesync/git_service/base.rb b/lib/modulesync/git_service/base.rb index f37bd616..8b24f46d 100644 --- a/lib/modulesync/git_service/base.rb +++ b/lib/modulesync/git_service/base.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ModuleSync module GitService # Generic class for git services diff --git a/lib/modulesync/git_service/factory.rb b/lib/modulesync/git_service/factory.rb index 52adafe8..878c0d07 100644 --- a/lib/modulesync/git_service/factory.rb +++ b/lib/modulesync/git_service/factory.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ModuleSync module GitService # Git service's factory diff --git a/lib/modulesync/git_service/github.rb b/lib/modulesync/git_service/github.rb index 025452bb..da9f5cab 100644 --- a/lib/modulesync/git_service/github.rb +++ b/lib/modulesync/git_service/github.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'modulesync/git_service' require 'modulesync/git_service/base' require 'octokit' diff --git a/lib/modulesync/git_service/gitlab.rb b/lib/modulesync/git_service/gitlab.rb index 82f03eb2..42d53413 100644 --- a/lib/modulesync/git_service/gitlab.rb +++ b/lib/modulesync/git_service/gitlab.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'gitlab' require 'modulesync/git_service' require 'modulesync/git_service/base' diff --git a/lib/modulesync/hook.rb b/lib/modulesync/hook.rb index 0cad42d5..9fe9987d 100644 --- a/lib/modulesync/hook.rb +++ b/lib/modulesync/hook.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'modulesync' module ModuleSync diff --git a/lib/modulesync/puppet_module.rb b/lib/modulesync/puppet_module.rb index 7cb4710c..f4278218 100644 --- a/lib/modulesync/puppet_module.rb +++ b/lib/modulesync/puppet_module.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'puppet_blacksmith' require 'modulesync/source_code' diff --git a/lib/modulesync/renderer.rb b/lib/modulesync/renderer.rb index 0358cad9..0746d9e2 100644 --- a/lib/modulesync/renderer.rb +++ b/lib/modulesync/renderer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'erb' require 'find' diff --git a/lib/modulesync/repository.rb b/lib/modulesync/repository.rb index cc3cb64b..3f556252 100644 --- a/lib/modulesync/repository.rb +++ b/lib/modulesync/repository.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'git' module ModuleSync diff --git a/lib/modulesync/settings.rb b/lib/modulesync/settings.rb index 1f51af34..7fff2e78 100644 --- a/lib/modulesync/settings.rb +++ b/lib/modulesync/settings.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ModuleSync # Encapsulate a configs for a module, providing easy access to its parts # All configs MUST be keyed by the relative target filename diff --git a/lib/modulesync/source_code.rb b/lib/modulesync/source_code.rb index 44235ae8..3d529e03 100644 --- a/lib/modulesync/source_code.rb +++ b/lib/modulesync/source_code.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'modulesync' require 'modulesync/git_service' require 'modulesync/git_service/factory' diff --git a/lib/modulesync/util.rb b/lib/modulesync/util.rb index 682e27a0..32b7887f 100644 --- a/lib/modulesync/util.rb +++ b/lib/modulesync/util.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'yaml' module ModuleSync diff --git a/lib/monkey_patches.rb b/lib/monkey_patches.rb index ca4fb440..232118c2 100644 --- a/lib/monkey_patches.rb +++ b/lib/monkey_patches.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Git module LibMonkeyPatch # Monkey patch set_custom_git_env_variables due to our ::Git::GitExecuteError handling. diff --git a/modulesync.gemspec b/modulesync.gemspec index fe3e078b..4fe08f31 100644 --- a/modulesync.gemspec +++ b/modulesync.gemspec @@ -1,3 +1,5 @@ +# frozen_string_literal: true + lib = File.expand_path('lib', __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) diff --git a/spec/helpers/faker.rb b/spec/helpers/faker.rb index b666b380..68430e26 100644 --- a/spec/helpers/faker.rb +++ b/spec/helpers/faker.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ModuleSync # Faker is a top-level module to keep global faker config module Faker diff --git a/spec/helpers/faker/puppet_module_remote_repo.rb b/spec/helpers/faker/puppet_module_remote_repo.rb index 17e57914..2770ac78 100644 --- a/spec/helpers/faker/puppet_module_remote_repo.rb +++ b/spec/helpers/faker/puppet_module_remote_repo.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'open3' require_relative '../faker' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index f094b0d8..a3b8b068 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'simplecov' require 'modulesync' diff --git a/spec/unit/module_sync/git_service/factory_spec.rb b/spec/unit/module_sync/git_service/factory_spec.rb index c45525a3..5824ef55 100644 --- a/spec/unit/module_sync/git_service/factory_spec.rb +++ b/spec/unit/module_sync/git_service/factory_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'modulesync' require 'modulesync/git_service/factory' diff --git a/spec/unit/module_sync/git_service/github_spec.rb b/spec/unit/module_sync/git_service/github_spec.rb index eb87917a..323f7bed 100644 --- a/spec/unit/module_sync/git_service/github_spec.rb +++ b/spec/unit/module_sync/git_service/github_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' require 'modulesync/git_service/github' diff --git a/spec/unit/module_sync/git_service/gitlab_spec.rb b/spec/unit/module_sync/git_service/gitlab_spec.rb index fb820d40..e0221dbe 100644 --- a/spec/unit/module_sync/git_service/gitlab_spec.rb +++ b/spec/unit/module_sync/git_service/gitlab_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' require 'modulesync/git_service/gitlab' diff --git a/spec/unit/module_sync/git_service_spec.rb b/spec/unit/module_sync/git_service_spec.rb index 0623ef50..e3cec6b6 100644 --- a/spec/unit/module_sync/git_service_spec.rb +++ b/spec/unit/module_sync/git_service_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'modulesync' require 'modulesync/git_service' diff --git a/spec/unit/module_sync/settings_spec.rb b/spec/unit/module_sync/settings_spec.rb index d7801ee2..9e91bb6f 100644 --- a/spec/unit/module_sync/settings_spec.rb +++ b/spec/unit/module_sync/settings_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe ModuleSync::Settings do diff --git a/spec/unit/module_sync/source_code_spec.rb b/spec/unit/module_sync/source_code_spec.rb index 23438d6a..32acea97 100644 --- a/spec/unit/module_sync/source_code_spec.rb +++ b/spec/unit/module_sync/source_code_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe ModuleSync::SourceCode do diff --git a/spec/unit/module_sync_spec.rb b/spec/unit/module_sync_spec.rb index 0cab7960..b634c74a 100644 --- a/spec/unit/module_sync_spec.rb +++ b/spec/unit/module_sync_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe ModuleSync do