Skip to content

Rubocop + fixes#598

Merged
albertvaka merged 3 commits intomasterfrom
albertvaka/rubocop
Jan 13, 2020
Merged

Rubocop + fixes#598
albertvaka merged 3 commits intomasterfrom
albertvaka/rubocop

Conversation

@albertvaka
Copy link
Copy Markdown
Contributor

@albertvaka albertvaka commented Jan 10, 2020

  • Enables rubocop.
  • Fixes rubocop ofenses.
  • Fixes broken facts_to_tags on A5, which was broken because the tests
    didn't run because the syntax was not correct (uncovered by rubocop).
  • Adds test for facts_to_tags on A6/A7.

@albertvaka albertvaka force-pushed the albertvaka/rubocop branch 4 times, most recently from 1fbee06 to 1646fc3 Compare January 10, 2020 19:51
- Enables rubocop
- Fixes rubocop ofenses
- Fixes broken `facts_to_tags` on A5, which was broken because the tests
didn't run because the syntax was not correct (uncovered by rubocop)
- Adds a test for `facts_to_tags` on A6/A7.
Copy link
Copy Markdown
Member

@truthbk truthbk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me, the fact the tests are green appears to corroborate that. I added a couple of notes on things I noticed but that may be ignored.

Great stuff!


context 'compile errors for incorrect values' do
let(:params) {{ use_mount: 'heaps' }}
let(:params) { { use_mount: 'heaps' } }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you've typically replaced the double let(:params) { { ... } } with:

let(:params) do
   {
      // ...
   }
end

I'm not sure if you'd rather keep this as-is for a single-liner, or if you'd like to use the new notation for consistency. I have no strong preference, but you have gone for the consistent approach in most places, so just pointing this out.

end

it {
if RSpec::Support::OS.windows?
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The windows-style carriage return is no longer an issue? I guess not since tests are green and you added windows to the CI, but worth asking I guess :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PDK skel adds a .gitattributes files that makes git change line ends on all files on commit, so they are consistent across OSes.

Comment thread spec/classes/datadog_agent_spec.rb Outdated
.with_content(%r{deb\s+https://apt.datadoghq.com/\s+stable\s+7})
end
end
let(:params) { { agent_version: '7.15.1' } }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto about the let blocks and consistency; this happens in several places in this file. Your call.

Comment thread spec/classes/datadog_agent_spec.rb Outdated
'content' => /^dd_url: https:\/\/notaurl.datadoghq.com\n/,
)}
let(:params) do
{ dd_url: 'https://notaurl.datadoghq.com',
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very picky nit: I was expecting different alignment on the braces in this block here (for consistency). This happens in a few more places in this file.

Copy link
Copy Markdown
Contributor Author

@albertvaka albertvaka Jan 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used rubocops autoformatter, but I agree this is ugly. Rubcop seems to accept it both ways, let me check if I can change it so this is an offense.

# it should install the mirror
context 'with manage_repo => true' do
let(:params){ {:manage_repo => true, :agent_major_version => 5} }
let(:params) { { manage_repo: true, agent_major_version: 5 } }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

@albertvaka albertvaka merged commit 1f5b081 into master Jan 13, 2020
@albertvaka albertvaka deleted the albertvaka/rubocop branch January 13, 2020 18:13
cegeka-jenkins pushed a commit to cegeka/puppet-datadog_agent that referenced this pull request Apr 6, 2020
- Enables rubocop
- Fixes rubocop ofenses
- Fixes broken `facts_to_tags` on A5, which was broken because the tests
didn't run because the syntax was not correct (uncovered by rubocop)
- Adds a test for `facts_to_tags` on A6/A7.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants