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

Command handling implemented #323 #331

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Command handling implemented #323 #331

wants to merge 1 commit into from

Conversation

botanicus
Copy link
Contributor

#323

Note: #322 should be merged in first.

@0crat
Copy link
Collaborator

0crat commented Jul 3, 2018

Job #331 is now in scope, role is REV

@0crat 0crat added the scope label Jul 3, 2018
@0crat
Copy link
Collaborator

0crat commented Jul 3, 2018

This pull request #331 is assigned to @ledestin/z, here is why; the budget is 15 minutes, see §4; please, read §27 and when you decide to accept the changes, inform @yegor256/z (the architect) right in this ticket; if you decide that this PR should not be accepted ever, also inform the architect; this blog post will help you understand what is expected from a code reviewer; there will be a monetary reward for this job

@yegor256
Copy link
Collaborator

yegor256 commented Jul 3, 2018

@botanicus again no tests?

@botanicus
Copy link
Contributor Author

@yegor256 tests are in #322. (Not starting with them complicated the workflow a bit here, but they do exist and are done, just not here.)

@yegor256
Copy link
Collaborator

yegor256 commented Jul 3, 2018

@botanicus each pull request must have a combination of "new tests + new code." Without tests a PR won't be merged. We simply can't be sure that the code you contribute works.

@botanicus
Copy link
Contributor Author

@yegor256 that makes sense, however here we already split the work in puzzle 1 test and puzzle 2 this.

Makes sense? If not, what’s your suggestion?

@yegor256
Copy link
Collaborator

yegor256 commented Jul 4, 2018

@botanicus that was a mistake. Let's not make it worse. Just follow the rule: every change starts with a test. Doesn't matter where.

@botanicus
Copy link
Contributor Author

@yegor256 let’s do that.

In order for me to do some progress there though, please reply to my comments in #330

Additionally: is what’s in the PR satisfactory to meet the requirements for having tests in this issue? And if not now, will it meet them once reworked in the desired way, or is there a need to do something in this PR directly?

@yegor256
Copy link
Collaborator

yegor256 commented Jul 5, 2018

@botanicus the rule is simple: I have to be sure that the code you submit works. It there are no tests -- I don't trust your code.

@botanicus
Copy link
Contributor Author

@yegor256 what do you mean? Are you saying that if #330 is merged in first, this works?

@yegor256
Copy link
Collaborator

yegor256 commented Jul 6, 2018

@botanicus not at all. That ticket will be merged by itself. Then, we will get back to this ticket and the question will still be the same: what is broken now? Every time you submit a pull request you are fixing something that is broken. If it's broken, you should prove that it's broken -- with a test. If you can't prove it's broken -- what's the point of the pull request? You are not fixing anything, right? Thus, every change comes to the master branch with a test that proves that something was broken and now it's fixed.

@codecov-io
Copy link

Codecov Report

Merging #331 into master will decrease coverage by 0.05%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #331      +/-   ##
=========================================
- Coverage   33.76%   33.7%   -0.06%     
=========================================
  Files          50      49       -1     
  Lines        2343    2332      -11     
=========================================
- Hits          791     786       -5     
+ Misses       1552    1546       -6
Impacted Files Coverage Δ
lib/zold/commands/node.rb 21.26% <0%> (-0.45%) ⬇️
lib/zold/hungry_wallets.rb
lib/zold/commands/pay.rb 22.64% <0%> (+0.6%) ⬆️
lib/zold/tax.rb 51.42% <0%> (+1.42%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d3ee24d...60a9ef7. Read the comment docs.

@0crat
Copy link
Collaborator

0crat commented Jul 8, 2018

@ledestin/z this job was assigned to you 5days ago. It will be taken away from you soon, unless you close it, see §8. Read this and this, please.

@@ -27,10 +27,34 @@ def run(args = [])
mine = Args.new(opts, @log).take || return
command = mine[0]
raise "A command is required, try 'zold alias --help'" unless command
case command
when 'set' then set(mine[1], mine[2])
Copy link
Contributor

Choose a reason for hiding this comment

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

@botanicus please don't make us guess what mine[1] is, extract variables.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ledestin it's how it's been used in other commands as well, for instance https://github.com/zold-io/zold/blob/master/lib/zold/commands/remote.rb#L120

If you think this is wrong, then it should be changed everywhere, not just here, in which case I think bug report is where it belongs.

I personally don't think there's anything wrong with it since they are named in both method signature and in the help just above it.

I'm not sure what @yegor256 thinks, I've seen something from him about avoiding unnecessary variables, but I cannot tell if this is one of the cases or not.

Anyhow ... since it's not specific to this code, I'd suggest a bug report. Makes sense?

Copy link
Contributor

Choose a reason for hiding this comment

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

@botanicus sure!

# The set command expects 'wallet' which is the wallet id
# and 'alias' (here called 'name' as alias is a Ruby keyword).
# It writes this info into the alias file as described in #279.
def set(_wallet, _name)
Copy link
Contributor

Choose a reason for hiding this comment

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

@botanicus do tests exist for these?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes #330

@ledestin
Copy link
Contributor

ledestin commented Jul 9, 2018

@botanicus please see my comments

@botanicus
Copy link
Contributor Author

@ledestin please see.

@ledestin
Copy link
Contributor

@yegor256 seems fine to me. tests exist in #330.

@yegor256
Copy link
Collaborator

@botanicus again no tests? We can't merge anything without tests first.

@botanicus
Copy link
Contributor Author

@yegor256 tests exist in #330. @ledestin agrees with me on that ^ as well. I don't see what could I possible do otherwise.

@yegor256
Copy link
Collaborator

@botanicus let's wait for them to be merged and see what happens? At the moment we can't merge this.

@yegor256
Copy link
Collaborator

@botanicus will you continue here?

case command
when 'set' then set(mine[1], mine[2])
when 'remove' then remove(mine[1])
when 'show' then show(mine[1])
Copy link
Contributor

Choose a reason for hiding this comment

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

else 
  raise “Unknown command: ‘#{command}’”
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants