Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make deprecated messages infos as per the doc #197

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/travis/yml/doc/validate/flags.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/travis/yml/doc/validate/unknown_keys.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion spec/travis/yml/accept/addon/jwts_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 9 additions & 8 deletions spec/travis/yml/accept/addon/sonarcloud_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@
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 { expect(msgs.size).to eq 1 }
it { should have_msg [:info, :'addons.sonarcloud', :deprecated_key, key: 'branches', info: 'setting a branch is deprecated'] }
it { expect(info.size).to eq 1 }
end

describe 'given branches (seq of strs)' do
Expand All @@ -69,8 +69,8 @@
- 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 { expect(msgs.size).to eq 1 }
it { should have_msg [:info, :'addons.sonarcloud', :deprecated_key, key: 'branches', info: 'setting a branch is deprecated'] }
it { expect(info.size).to eq 1 }
end

describe 'given github_token (str)' do
Expand All @@ -80,9 +80,10 @@
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 }
it { expect(msgs.size).to eq 1 }
it { expect(info.size).to eq 1 }
end

describe 'given github_token (secure)' do
Expand All @@ -93,8 +94,8 @@
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 { expect(msgs.size).to eq 1 }
it { should have_msg [:info, :'addons.sonarcloud', :deprecated_key, key: 'github_token', info: 'setting a GitHub token is deprecated'] }
it { expect(info.size).to eq 1 }
end
end
end
2 changes: 1 addition & 1 deletion spec/travis/yml/accept/deploy/boxfuse_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion spec/travis/yml/accept/deploy/scalingo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions spec/travis/yml/accept/deploy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/travis/yml/accept/jobs_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/travis/yml/accept/language_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion spec/travis/yml/accept/os_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion spec/travis/yml/accept/sudo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/travis/yml/doc/accept/validate/unknown_keys_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions spec/travis/yml/doc/messages_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down