Closed movitto closed 9 years ago
@movitto Looks like the Polisher::RPM::AUTHOR constant is missing, causing the specs to fail.
This PR is enormous, which is not necessarily a bad thing, just hard to follow. From a high level, what is this PR achieving? Do you have an example before/after code snippet showing how this PR improves client code? Thanks for digging into this, refactoring is good, I'm just trying to understand it.
:cookie:
@jrafanie updated, split up the changes. Mostly structural / heirarchical, not too many changes to the external api but this makes things more modular and maintainable. Should be able to base additional changes to target functionality easier from here on out.
@movitto Can you address the following cops (where appropriate): DeprecatedClassMethods UnusedMethodArgument UselessAssignment Semicolon NonNilCheck HandleExceptions Blocks MultilineBlockChain
Some of these cops are worth looking at regardless if it's just a move.
I can't really follow what's going on here even with the split up commits. I think there just too many refactoring/reorganizing going on. Probably would be more readable if you did it in small units of change.
It seems a bit better organized so there's that. I'm fine with it, just can't say anything useful as I don't understand the design changes.
@jrafanie updated for style. Left some of the items as-is where I felt things flowed better and skipped over some of the trivial ones on the list.
Regarding the split up commits, it's probably not worth the effort atm, especially since builder only uses one callpath and that's largely unchanged. This changeset mostly serves to organize the file list which was under lib/polisher into subdirs according to generic intent and to split large classes into mixin modules (with functionality remaining the same). There are a few small changes / fixes but we can take some time to tighten things down before the next release.
Checked commits https://github.com/movitto/polisher-1/commit/8969080f952bb90206fbbc769c623acc3f48417f .. https://github.com/movitto/polisher-1/commit/fc29ad612f901252171633758d9e510210ebb20d with rubocop 0.27.1 89 files checked, 136 offenses detected
lib/polisher/adaptors/version_checker.rb
each_with_object
instead of inject
.lib/polisher/gem/diff.rb
unless
statement spanning multiple lines.lib/polisher/gem/files.rb
has_file_satisfied_by?
to file_satisfied_by?
.lib/polisher/gem/parser.rb
if
statement spanning multiple lines.lib/polisher/gem/state.rb
return
detected.return
detected.return
detected.lib/polisher/gem/versions.rb
&:version
as an argument to collect
instead of a block.lib/polisher/gemfile/deps.rb
lib/polisher/gemfile/parser.rb
lib/polisher/git/pkg/builder.rb
lib/polisher/git/pkg/repo.rb
alias_method
instead of alias
.alias_method
instead of alias
.lib/polisher/git/pkg/versions.rb
lib/polisher/mixins/vendored_deps.rb
each_with_object
instead of inject
.lib/polisher/rpm.rb
lib/polisher/rpm/requirement/comparison.rb
lib/polisher/rpm/requirement/gem_reference.rb
!!
).!!
).lib/polisher/rpm/requirement/parser.rb
lib/polisher/rpm/spec/check.rb
has_check?
to check?
.!!
).lib/polisher/rpm/spec/comparison.rb
&:specifier
as an argument to collect
instead of a block.Hash#has_key?
is deprecated in favor of Hash#key?
.Hash#has_key?
is deprecated in favor of Hash#key?
.lib/polisher/rpm/spec/gem_requirements.rb
has_all_requirements_for?
to all_requirements_for?
.&:gem?
as an argument to select
instead of a block.&:gem?
as an argument to select
instead of a block.lib/polisher/rpm/spec/parser.rb
&:strip
as an argument to collect!
instead of a block.lib/polisher/rpm/spec/subpackages.rb
has_doc_subpkg?
to doc_subpkg?
.lib/polisher/rpm/spec/updater.rb
&:rpmize
as an argument to collect
instead of a block.lib/polisher/targets/bodhi.rb
lib/polisher/targets/fedora.rb
lib/polisher/targets/koji/builder.rb
lib/polisher/targets/koji/diff.rb
lib/polisher/targets/koji/versions.rb
has_build?
to build?
.has_build_satisfying?
to build_satisfying?
.lib/polisher/targets/yum.rb
lib/polisher/util/conf_helpers.rb
lib/polisher/util/core_ext.rb
spec/git/pkg_spec.rb
->(params) {...}
.spec/git/repo_spec.rb
==
used in void context.==
used in void context.spec/mixins/versioned_dependencies_spec.rb
spec/targets/fedora_spec.rb
spec/targets/koji_spec.rb
==
used in void context.==
used in void context.==
used in void context.==
used in void context.==
used in void context.==
used in void context.%w
or %W
for array of words.%w
or %W
for array of words.%w
or %W
for array of words.->(params) {...}
.spec/targets/yum_spec.rb
spec/util/component_spec.rb
spec/util/core_ext_spec.rb
@jrafanie any objections to merging this? Since most changes are to internal layout / style, I'd suggest we get this in / iron additional things out via the spec suite (see followup pr's). The overall codebase should be fairly stable after this point as most things are now componentized / compartmentalized.
Sure @movitto, I haven't been spending too much time in this area, so feel free to do multi-step restructuring, we can bump the version to 0.11.0 when you're done to shake out any thing that breaks.
My only suggestion is to keep your eye on the rubocop warnings and code climate/coveralls scores... they're good general guidelines... Let's drop complexity where we can to make small objects that do one thing well.
Refactoring of codebase so as to consolidate functionality and simplify modules. Components are now more or less independent of each other save specified integration points and are better organized.