-
Notifications
You must be signed in to change notification settings - Fork 1
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
Fixes tests on master #6
Conversation
b1108e0
to
b9cb493
Compare
@@ -26,6 +26,9 @@ Metrics/CyclomaticComplexity: | |||
Metrics/ParameterLists: | |||
Max: 10 | |||
|
|||
Style/AccessorMethodName: | |||
Enabled: false | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because of the get_value
method: https://github.com/thread-pond/scrum-lint/blob/master/lib/scrum_lint/reporters/interactive_reporter.rb#L10
@@ -4,6 +4,7 @@ rvm: | |||
- 2.1 | |||
- 2.2 | |||
- 2.3.0 | |||
- 2.4.3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Latest stable ruby RVM offers right now
|
||
group :test do | ||
gem 'codeclimate-test-reporter' | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issue: #7
lib/scrum_lint/configuration.rb
Outdated
@@ -63,7 +63,7 @@ def config_file_contents | |||
end | |||
|
|||
def config_file_path | |||
'./.scrum-lint.yml' | |||
ENV.fetch('config_file_path', './.scrum-lint.yml') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allows the user to specify where the .scrum-lint.yml
file is located. This helps the test specs not use the real config file.
@@ -63,7 +63,7 @@ def lookup_project_card(context_link) | |||
ScrumLint::Trello::CardMapper.( | |||
trello_card, | |||
list: trello_card.list, | |||
board_name: trello_card.board.name, | |||
board_name: trello_card.board.name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RuboCop yelled: Style/TrailingCommaInArguments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so is the idea for this PR just to get everything passing, and then if we want to change the rubocop rules we can go back and do that in followups?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kaifius Yup, exactly. I wanted to touch the minimum amount of things to get a passing build and then be more intentional in follow-ups. If you have some suggestions for things to improve, let me know!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool, yeah, i think we should enable this rule and rename get_value
to enable the other rule in followups. Or maybe even paste in synchroform's rubocop.yml and see what fails
@@ -3,7 +3,7 @@ module InteractiveLinter | |||
# checks that cards have #HashTag and interactively assigns | |||
class MissingHashTag < InteractiveLinter::Base | |||
|
|||
MESSAGE = 'missing hashtag' | |||
MESSAGE = 'missing hashtag'.freeze |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RuboCop yelled: Style/MutableConstant
@@ -10,7 +10,7 @@ def call(trello_list, board_name:) | |||
list.cards = mapped_cards( | |||
list: list, | |||
trello_list: trello_list, | |||
board_name: board_name, | |||
board_name: board_name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RuboCop yelled: Style/TrailingCommaInArguments
@@ -1,3 +1,4 @@ | |||
trello_developer_public_key: nope | |||
trello_member_token: nada | |||
github_access_token: foo | |||
github_repo_names: ['foo/bar'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the github repo mapper functionality that's now in configuration.rb
it 'aborts when .scrum-lint.yml is missing' do | ||
file_path = './.scrum-lint.yml' | ||
it 'aborts when config file is missing' do | ||
file_path = ENV.fetch('config_file_path') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test modified to allow for configurable path to .scrum-lint.yml
@@ -1,6 +1,7 @@ | |||
RSpec.describe ScrumLint::Card do | |||
let(:card_params) do | |||
{ | |||
board_name: nil, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Required param for instantiating a ScrumLint::Card
@@ -3,7 +3,12 @@ module ScrumLint | |||
let(:runner) { described_class.new } | |||
|
|||
before(:each) do | |||
allow(Launchy).to receive(:open) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The stubbed objects may not be completely valid, so don't open Launchy
at all
expect(Linter::MissingContext).not_to have_received(:call) | ||
expect(Linter::MissingExpendedPoints).to have_received(:call) | ||
.with(instance_of(Card)) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added code coverage! 🎉
allow(::Trello::Board).to receive(:all).and_return([fake_trello_board]) | ||
allow(::Trello::Card).to receive(:find).and_return(fake_trello_card) | ||
|
||
allow(Octokit::Source).to receive(:call).and_return([]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll deal with tests for the repo linter stuff later
spec/scrum_lint/runner_spec.rb
Outdated
runner.([]) | ||
expect(Linter::MissingTaskList).to have_received(:call) | ||
.with(instance_of(Board)) | ||
expect(Linter::ExtraList).to have_received(:call).with(instance_of(Board)) | ||
expect(Linter::ExtraList).to have_received(:call).with(instance_of(Board)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added code coverage! 🎉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does having this line here twice mean we expect this method to be called twice? if so i think you can do have_received(:call).twice.with(..)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha nope. It means I wasn't very careful with my copy/pasta-ing.
else | ||
SimpleCov.start | ||
end | ||
SimpleCov.start |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issue: #7
short_url: 'https://foo.bar.baz.biz', | ||
url: 'https://something.much.longer', | ||
**options | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Attributes needed to properly instantiate a Card object
end | ||
|
||
def fake_trello_list(name: 'Planned', cards: []) | ||
def fake_trello_list(name: 'Planned', cards: [fake_trello_card]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have at least one card in the list by default
81e9511
to
77048c2
Compare
77048c2
to
e8d866a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eeeeee exciting! just a couple lil comentarios
@@ -63,7 +63,7 @@ def lookup_project_card(context_link) | |||
ScrumLint::Trello::CardMapper.( | |||
trello_card, | |||
list: trello_card.list, | |||
board_name: trello_card.board.name, | |||
board_name: trello_card.board.name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so is the idea for this PR just to get everything passing, and then if we want to change the rubocop rules we can go back and do that in followups?
spec/scrum_lint/runner_spec.rb
Outdated
runner.([]) | ||
expect(Linter::MissingTaskList).to have_received(:call) | ||
.with(instance_of(Board)) | ||
expect(Linter::ExtraList).to have_received(:call).with(instance_of(Board)) | ||
expect(Linter::ExtraList).to have_received(:call).with(instance_of(Board)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does having this line here twice mean we expect this method to be called twice? if so i think you can do have_received(:call).twice.with(..)
spec/scrum_lint/runner_spec.rb
Outdated
expect(Linter::MissingExpendedPoints).not_to have_received(:call) | ||
end | ||
|
||
it 'runs linters where card tags are superset of linter tags' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you update the it statement here to differentiate it from the one above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, good catch. Being half asleep is probably not the best time for programming. I'll also add a little more coverage.
**What** - Fixes rubocop failures using default rules with the exception of one case - Removes CodeClimate from the code because its implementation was deprecated on TravisCI. I opened an issue to look into this: #7 - Added the latest stable ruby version (that RVM has to offer) to run on TravisCI - Did the minimum necessary to mock out the repo linter functionality so that the existing tests will pass. I will make a follow-up eventually to write tests for the repo linter. - Fixed some small things in the existing tests to get them to pass - Added test coverage to the `Runner` spec.
e8d866a
to
525e5b9
Compare
Updated per comments. |
What
case
deprecated on TravisCI. I opened an issue to look into this: Code Climate Integration #7
TravisCI
that the existing tests will pass. I will make a follow-up eventually
to write tests for the repo linter.
Runner
spec.