From 6bd10bbc0261ea8716cc2849b80a3138ca983215 Mon Sep 17 00:00:00 2001 From: Ivan Pozdeev Date: Sun, 13 Dec 2020 05:32:35 +0300 Subject: [PATCH 1/3] Make deprecated messages infos as per the doc --- lib/travis/yml/doc/validate/flags.rb | 4 ++-- lib/travis/yml/doc/validate/unknown_keys.rb | 2 +- spec/travis/yml/accept/addon/jwts_spec.rb | 2 +- spec/travis/yml/accept/addon/sonarcloud_spec.rb | 8 ++++---- spec/travis/yml/accept/deploy/boxfuse_spec.rb | 2 +- spec/travis/yml/accept/deploy/scalingo_spec.rb | 2 +- spec/travis/yml/accept/deploy_spec.rb | 6 +++--- spec/travis/yml/accept/jobs_spec.rb | 2 +- spec/travis/yml/accept/language_spec.rb | 2 +- spec/travis/yml/accept/os_spec.rb | 1 - spec/travis/yml/accept/sudo_spec.rb | 2 +- spec/travis/yml/doc/accept/validate/unknown_keys_spec.rb | 2 +- spec/travis/yml/doc/messages_spec.rb | 4 ++-- 13 files changed, 19 insertions(+), 20 deletions(-) diff --git a/lib/travis/yml/doc/validate/flags.rb b/lib/travis/yml/doc/validate/flags.rb index 434368c44..77ef6b284 100644 --- a/lib/travis/yml/doc/validate/flags.rb +++ b/lib/travis/yml/doc/validate/flags.rb @@ -39,7 +39,7 @@ def deprecated_value? def deprecated_value deprecation = schema.values.deprecation(value.value) - value.warn :deprecated_value, value: value.value, info: deprecation + value.info :deprecated_value, value: value.value, info: deprecation end def deprecated_key? @@ -49,7 +49,7 @@ def deprecated_key? def deprecated_key value.keys.each do |key| next unless deprecation = schema[key]&.deprecation - value.warn :deprecated_key, key: key, info: deprecation, line: key.line, src: key.src + value.info :deprecated_key, key: key, info: deprecation, line: key.line, src: key.src end end end diff --git a/lib/travis/yml/doc/validate/unknown_keys.rb b/lib/travis/yml/doc/validate/unknown_keys.rb index f3d8ca31d..f1d220e59 100644 --- a/lib/travis/yml/doc/validate/unknown_keys.rb +++ b/lib/travis/yml/doc/validate/unknown_keys.rb @@ -51,7 +51,7 @@ def warn_unknown(map, value) end def warn_anchor(map, value) - map.msg :warn, :deprecated_key, key: value.key, info: 'anchor on a non-private key', + map.msg :info, :deprecated_key, key: value.key, info: 'anchor on a non-private key', line: value.key.line, src: value.key.src end diff --git a/spec/travis/yml/accept/addon/jwts_spec.rb b/spec/travis/yml/accept/addon/jwts_spec.rb index 7a0e1bdf6..890ce33fc 100644 --- a/spec/travis/yml/accept/addon/jwts_spec.rb +++ b/spec/travis/yml/accept/addon/jwts_spec.rb @@ -6,7 +6,7 @@ jwt: foo ) it { should serialize_to addons: { jwt: ['foo'] } } - it { should have_msg [:warn, :addons, :deprecated_key, key: 'jwt', info: 'Discontinued as of April 17, 2018'] } + it { should have_msg [:info, :addons, :deprecated_key, key: 'jwt', info: 'Discontinued as of April 17, 2018'] } end describe 'given a secure' do diff --git a/spec/travis/yml/accept/addon/sonarcloud_spec.rb b/spec/travis/yml/accept/addon/sonarcloud_spec.rb index 1e6c31d82..68bb50b98 100644 --- a/spec/travis/yml/accept/addon/sonarcloud_spec.rb +++ b/spec/travis/yml/accept/addon/sonarcloud_spec.rb @@ -57,7 +57,7 @@ branches: str ) it { should serialize_to addons: { sonarcloud: { branches: ['str'] } } } - it { should have_msg [:warn, :'addons.sonarcloud', :deprecated_key, key: 'branches', info: 'setting a branch is deprecated'] } + it { should have_msg [:info, :'addons.sonarcloud', :deprecated_key, key: 'branches', info: 'setting a branch is deprecated'] } it { expect(msgs.size).to eq 1 } end @@ -69,7 +69,7 @@ - str ) it { should serialize_to addons: { sonarcloud: { branches: ['str'] } } } - it { should have_msg [:warn, :'addons.sonarcloud', :deprecated_key, key: 'branches', info: 'setting a branch is deprecated'] } + it { should have_msg [:info, :'addons.sonarcloud', :deprecated_key, key: 'branches', info: 'setting a branch is deprecated'] } it { expect(msgs.size).to eq 1 } end @@ -80,7 +80,7 @@ github_token: str ) it { should serialize_to addons: { sonarcloud: { github_token: 'str' } } } - it { should have_msg [:warn, :'addons.sonarcloud', :deprecated_key, key: 'github_token', info: 'setting a GitHub token is deprecated'] } + it { should have_msg [:info, :'addons.sonarcloud', :deprecated_key, key: 'github_token', info: 'setting a GitHub token is deprecated'] } it { should have_msg [:alert, :'addons.sonarcloud.github_token', :secure, type: :str] } it { expect(msgs.size).to eq 2 } end @@ -93,7 +93,7 @@ secure: #{secure} ) it { should serialize_to addons: { sonarcloud: { github_token: { secure: secure } } } } - it { should have_msg [:warn, :'addons.sonarcloud', :deprecated_key, key: 'github_token', info: 'setting a GitHub token is deprecated'] } + it { should have_msg [:info, :'addons.sonarcloud', :deprecated_key, key: 'github_token', info: 'setting a GitHub token is deprecated'] } it { expect(msgs.size).to eq 1 } end end diff --git a/spec/travis/yml/accept/deploy/boxfuse_spec.rb b/spec/travis/yml/accept/deploy/boxfuse_spec.rb index d48919696..a33708380 100644 --- a/spec/travis/yml/accept/deploy/boxfuse_spec.rb +++ b/spec/travis/yml/accept/deploy/boxfuse_spec.rb @@ -48,7 +48,7 @@ ) it { should serialize_to deploy: [provider: 'boxfuse', config_file: 'str'] } it { should have_msg [:info, :deploy, :alias_key, alias: 'configfile', key: 'config_file', provider: 'boxfuse'] } - xit { should have_msg [:warn, :deploy, :deprecated_key, :configfile] } + xit { should have_msg [:info, :deploy, :deprecated_key, :configfile] } end end diff --git a/spec/travis/yml/accept/deploy/scalingo_spec.rb b/spec/travis/yml/accept/deploy/scalingo_spec.rb index 2042adc98..2305b1a90 100644 --- a/spec/travis/yml/accept/deploy/scalingo_spec.rb +++ b/spec/travis/yml/accept/deploy/scalingo_spec.rb @@ -52,7 +52,7 @@ ) it { should serialize_to deploy: [provider: 'scalingo', api_token: { secure: secure }] } it { should have_msg [:info, :deploy, :alias_key, alias: 'api_key', key: 'api_token', provider: 'scalingo'] } - xit { should have_msg [:warn, :deploy, :deprecated_key, :api_key] } + xit { should have_msg [:info, :deploy, :deprecated_key, :api_key] } end end diff --git a/spec/travis/yml/accept/deploy_spec.rb b/spec/travis/yml/accept/deploy_spec.rb index bfe61b484..f5bbd8914 100644 --- a/spec/travis/yml/accept/deploy_spec.rb +++ b/spec/travis/yml/accept/deploy_spec.rb @@ -328,7 +328,7 @@ ) it { should serialize_to deploy: [provider: 'heroku', on: { repo: 'str' }] } it { should have_msg [:info, :deploy, :alias_key, alias: 'true', key: 'on', provider: 'heroku'] } - xit { should have_msg [:warn, :'deploy.on', :deprecated_key, key: 'on'] } + xit { should have_msg [:info, :'deploy.on', :deprecated_key, key: 'on'] } end end @@ -342,7 +342,7 @@ bucket: production_branch ) xit { should serialize_to deploy: [provider: 'heroku', on: { branch: { production: { bucket: 'production_branch' } } }] } - xit { should have_msg [:warn, :'deploy.on.branch', :deprecated, deprecation: :branch_specific_option_hash] } + xit { should have_msg [:info, :'deploy.on.branch', :deprecated, deprecation: :branch_specific_option_hash] } end describe 'migrating :tags, with :tags already given', v2: true, migrate: true do @@ -436,7 +436,7 @@ production: production ) xit { should serialize_to deploy: [provider: 'heroku', run: { production: 'production' }] } - xit { should have_msg [:warn, :'deploy.run', :deprecated, given: :run, info: :branch_specific_option_hash] } + xit { should have_msg [:info, :'deploy.run', :deprecated, given: :run, info: :branch_specific_option_hash] } end describe 'branches.only' do diff --git a/spec/travis/yml/accept/jobs_spec.rb b/spec/travis/yml/accept/jobs_spec.rb index 4ded00cf6..423a5f948 100644 --- a/spec/travis/yml/accept/jobs_spec.rb +++ b/spec/travis/yml/accept/jobs_spec.rb @@ -611,7 +611,7 @@ branch: master ) it { should serialize_to jobs: { allow_failures: [rvm: '2.3', branch: 'master'] } } - it { should have_msg [:warn, :'jobs.allow_failures', :deprecated_key, key: 'branch', info: 'use conditional allow_failures using :if'] } + it { should have_msg [:info, :'jobs.allow_failures', :deprecated_key, key: 'branch', info: 'use conditional allow_failures using :if'] } end describe 'allow_failures given a seq of strings (common mistake)', drop: true do diff --git a/spec/travis/yml/accept/language_spec.rb b/spec/travis/yml/accept/language_spec.rb index a06713425..15ac829f7 100644 --- a/spec/travis/yml/accept/language_spec.rb +++ b/spec/travis/yml/accept/language_spec.rb @@ -151,7 +151,7 @@ language: __connie__ ) it { should serialize_to language: '__connie__' } - it { should have_msg [:warn, :language, :deprecated_value, value: '__connie__', info: 'experimental stack language'] } + it { should have_msg [:info, :language, :deprecated_value, value: '__connie__', info: 'experimental stack language'] } end end end diff --git a/spec/travis/yml/accept/os_spec.rb b/spec/travis/yml/accept/os_spec.rb index cfd3e3dcf..4e5c7d3e2 100644 --- a/spec/travis/yml/accept/os_spec.rb +++ b/spec/travis/yml/accept/os_spec.rb @@ -61,7 +61,6 @@ os: linux-ppc64le ) it { should serialize_to os: ['linux-ppc64le'] } - # it { should have_msg [:warn, :os, :deprecated_value, value: 'linux-ppc64le', info: 'use os: linux, arch: ppc64le'] } end end diff --git a/spec/travis/yml/accept/sudo_spec.rb b/spec/travis/yml/accept/sudo_spec.rb index eecbea23a..958afea7c 100644 --- a/spec/travis/yml/accept/sudo_spec.rb +++ b/spec/travis/yml/accept/sudo_spec.rb @@ -13,7 +13,7 @@ sudo: true ) it { should serialize_to sudo: true } - it { should have_msg [:warn, :root, :deprecated_key, key: 'sudo', info: 'The key `sudo` has no effect anymore.'] } + it { should have_msg [:info, :root, :deprecated_key, key: 'sudo', info: 'The key `sudo` has no effect anymore.'] } end describe 'given the string on' do diff --git a/spec/travis/yml/doc/accept/validate/unknown_keys_spec.rb b/spec/travis/yml/doc/accept/validate/unknown_keys_spec.rb index a38828d00..5dad83d66 100644 --- a/spec/travis/yml/doc/accept/validate/unknown_keys_spec.rb +++ b/spec/travis/yml/doc/accept/validate/unknown_keys_spec.rb @@ -28,6 +28,6 @@ <<: *ref yaml it { should serialize_to unknown: { script: './str' }, script: ['./str'] } - it { should have_msg [:warn, :root, :deprecated_key, key: 'unknown', info: 'anchor on a non-private key', line: 0, src: '.travis.yml'] } + it { should have_msg [:info, :root, :deprecated_key, key: 'unknown', info: 'anchor on a non-private key', line: 0, src: '.travis.yml'] } end end diff --git a/spec/travis/yml/doc/messages_spec.rb b/spec/travis/yml/doc/messages_spec.rb index c68596f26..28ed604ad 100644 --- a/spec/travis/yml/doc/messages_spec.rb +++ b/spec/travis/yml/doc/messages_spec.rb @@ -71,12 +71,12 @@ describe 'deprecated_key' do yaml 'one: one' - it { should have_msg [:warn, :root, :deprecated_key, key: 'one', info: 'deprecation', line: 0] } + it { should have_msg [:info, :root, :deprecated_key, key: 'one', info: 'deprecation', line: 0] } end describe 'deprecated_value' do yaml 'one: "1"' - it { should have_msg [:warn, :one, :deprecated_value, value: '1', info: 'deprecation', line: 0] } + it { should have_msg [:info, :one, :deprecated_value, value: '1', info: 'deprecation', line: 0] } end describe 'downcase' do From b88bd67c7201ec4d2aeefb7537628768f0d833cf Mon Sep 17 00:00:00 2001 From: Ivan Pozdeev Date: Sun, 13 Dec 2020 06:01:44 +0300 Subject: [PATCH 2/3] (dummy commit to restart the check) From 6a615b411cd2b57544f996ee58889b3438afcb93 Mon Sep 17 00:00:00 2001 From: Ivan Pozdeev Date: Sun, 13 Dec 2020 07:18:54 +0300 Subject: [PATCH 3/3] Additional correctionbs for message number checks --- spec/travis/yml/accept/addon/sonarcloud_spec.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/spec/travis/yml/accept/addon/sonarcloud_spec.rb b/spec/travis/yml/accept/addon/sonarcloud_spec.rb index 68bb50b98..248843935 100644 --- a/spec/travis/yml/accept/addon/sonarcloud_spec.rb +++ b/spec/travis/yml/accept/addon/sonarcloud_spec.rb @@ -58,7 +58,7 @@ ) it { should serialize_to addons: { sonarcloud: { branches: ['str'] } } } it { should have_msg [:info, :'addons.sonarcloud', :deprecated_key, key: 'branches', info: 'setting a branch is deprecated'] } - it { expect(msgs.size).to eq 1 } + it { expect(info.size).to eq 1 } end describe 'given branches (seq of strs)' do @@ -70,7 +70,7 @@ ) it { should serialize_to addons: { sonarcloud: { branches: ['str'] } } } it { should have_msg [:info, :'addons.sonarcloud', :deprecated_key, key: 'branches', info: 'setting a branch is deprecated'] } - it { expect(msgs.size).to eq 1 } + it { expect(info.size).to eq 1 } end describe 'given github_token (str)' do @@ -82,7 +82,8 @@ it { should serialize_to addons: { sonarcloud: { github_token: 'str' } } } it { should have_msg [:info, :'addons.sonarcloud', :deprecated_key, key: 'github_token', info: 'setting a GitHub token is deprecated'] } it { should have_msg [:alert, :'addons.sonarcloud.github_token', :secure, type: :str] } - it { expect(msgs.size).to eq 2 } + it { expect(msgs.size).to eq 1 } + it { expect(info.size).to eq 1 } end describe 'given github_token (secure)' do @@ -94,7 +95,7 @@ ) it { should serialize_to addons: { sonarcloud: { github_token: { secure: secure } } } } it { should have_msg [:info, :'addons.sonarcloud', :deprecated_key, key: 'github_token', info: 'setting a GitHub token is deprecated'] } - it { expect(msgs.size).to eq 1 } + it { expect(info.size).to eq 1 } end end end