Skip to content

DSL refactor and minor Ruby improvements and fixes #8

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

Merged
merged 22 commits into from
Mar 19, 2018

Conversation

joelvh
Copy link
Contributor

@joelvh joelvh commented Mar 16, 2018

@zverok here's the refactored changes without processor/transformation changes as your requested in #7.

@coveralls
Copy link

Coverage Status

Coverage increased (+1.5%) to 95.724% when pulling 86f7db6 on joelvh:feature/refactor into 79f3f16 on molybdenum-99:master.

@coveralls
Copy link

coveralls commented Mar 16, 2018

Coverage Status

Coverage increased (+1.5%) to 95.727% when pulling 94c57af on joelvh:feature/refactor into 79f3f16 on molybdenum-99:master.

@joelvh joelvh force-pushed the feature/refactor branch from a7fa860 to e55bbfe Compare March 16, 2018 23:23
@joelvh joelvh changed the title Feature/refactor DSL refactor and minor Ruby improvements and fixes Mar 16, 2018
@joelvh
Copy link
Contributor Author

joelvh commented Mar 16, 2018

@zverok I'm not getting the Rubocop errors that Travis is :-(

@zverok
Copy link
Contributor

zverok commented Mar 17, 2018

@zverok I'm not getting the Rubocop errors that Travis is :-(

It is the latest Rubocop's newly introduced cops, probably you should update it.

Copy link
Contributor

@zverok zverok left a comment

Choose a reason for hiding this comment

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

Thanks for the hard work!
I left a few small comments, but generally it LGTM 👍

@@ -1,6 +1,6 @@
require 'pp'

$:.unshift 'lib'
$:.unshift '../lib'
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's $.LOAD_PATH.unshift File.expand_path('../lib', __FILE__) or something.
Otherwise, this change will prohibit running ruby examples/example.rb from TLAW root.

# end
# ```
#
# See also {#post_process} for some generic explanation of post-processing.
Copy link
Contributor

Choose a reason for hiding this comment

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

Please return these docs to dsl.rb :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Was a cherry-pick merge issue

@@ -0,0 +1,38 @@
module TLAW
# TODO: Add docs
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's at least add something dummy, like "See Params::Base for explanations about params." or something?..

end

private

def child(symbol, expected_class, **params)
children[symbol]
.tap { |child_class|
.tap do |child_class|
Copy link
Contributor

Choose a reason for hiding this comment

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

TBH, I prefer curly braces for "functional" method chains. I will not fight for it furiously, but if it is not a big deal for you,

tap {
...
}.new(...)

...looks more natural for me, even in huge multiline chains.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@zverok I've adopted the do blocks for multi-line because many other projects have Rubocops that require this style. I've come to prefer it, but will avoid changing them in this project for now :-)

@joelvh
Copy link
Contributor Author

joelvh commented Mar 17, 2018

@zverok updates made. That was odd that Rubocop changed defaults. Do you have a way to manage updating gems? Do you just update gems when running tests automatically?

Copy link
Contributor

@zverok zverok left a comment

Choose a reason for hiding this comment

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

...on the second thought, I can just do the removal of "description" logic myself. Let's merge 🎉

text
.gsub(/^[ \t]+/, '')
.gsub(/\A\n|\n\s*\Z/, '')
end
Copy link
Contributor

Choose a reason for hiding this comment

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

The last thing that I noticed: let's probably remove this logic completely? It just repeats what Ruby 2.3 "squiggly heredoc" do, and as this PR specifies 2.3 as the minimum version, there is no need to replicating language features. One can just

  description <<~D
    Any description
    goes here.

    Like a boss!
  D

...and be happy.

@zverok
Copy link
Contributor

zverok commented Mar 19, 2018

That was odd that Rubocop changed defaults. Do you have a way to manage updating gems? Do you just update gems when running tests automatically?

It is not changed defaults, it is new cops added in new version. Probably tlaw's Gemfile just should specify a particular version of Rubocop, and I should update the version manually from time to time.

@zverok zverok merged commit a4c7470 into molybdenum-99:master Mar 19, 2018
@zverok
Copy link
Contributor

zverok commented Mar 19, 2018

Thank you for the awesome work!

@joelvh
Copy link
Contributor Author

joelvh commented Mar 19, 2018

ok, great!

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.

3 participants