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

Refactor packet config #50

Merged
merged 11 commits into from
Feb 17, 2015
Merged

Refactor packet config #50

merged 11 commits into from
Feb 17, 2015

Conversation

jmthomas
Copy link
Contributor

@jmthomas jmthomas commented Feb 9, 2015

I'm not done yet but take a look and see if you agree with my philosophy here. Basically I'm breaking up packet_config into individual keyword parsers which have top level class methods to parse them.

@@ -87,6 +87,7 @@ spec = Gem::Specification.new do |s|
s.add_development_dependency 'reek', '~> 1'
s.add_development_dependency 'roodi', '~> 4'
s.add_development_dependency 'guard', '~> 2'
s.add_development_dependency 'wdm', '>= 0.1.0' if Gem.win_platform?
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was so Guard didn't complain.

Copy link

Choose a reason for hiding this comment

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

You can't do this. Dependencies are only evaluated when the gem is created, so this will break other platforms if the gem is created on windows.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Any suggestions?

Copy link

Choose a reason for hiding this comment

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

You can do something like this in the main Gemfile. What is requiring wdm that is not installing it?

Copy link

Choose a reason for hiding this comment

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

Note approval is dependent on removing this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Guard wants it on Windows so it doesn't have to poll the filesystem. I'll add it to the main Gemfile.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.14%) to 91.25% when pulling 3b8511c on refactor_packet_config into 3f3bfdb on master.

@@ -569,6 +583,7 @@ def reset
def clone
packet = super()
if packet.instance_variable_get("@processors")
packet.instance_variable_set("@processors", packet.processors.clone)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not properly cloning the processors was a bug and I added a spec for it

@ghost
Copy link

ghost commented Feb 9, 2015

Approved. Big refactorings like this are scary, and almost guaranteed to lead to regressions. In general, let's make sure we only refactor things that truly need improvement and can be made simpler, not just try to make Code Climate happy.

@jmthomas
Copy link
Contributor Author

I agree that it is a lot of changes but each time I do this I catch a few bugs as well. Plus these mega-classes make the code very unapproachable for new people who want to understand and contribute.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.14%) to 91.25% when pulling 1716a24 on refactor_packet_config into 3f3bfdb on master.

@ghost
Copy link

ghost commented Feb 10, 2015

Approved

@coveralls
Copy link

Coverage Status

Coverage increased (+0.12%) to 91.23% when pulling 19877e7 on refactor_packet_config into 3f3bfdb on master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.16%) to 91.27% when pulling def9fb4 on refactor_packet_config into 3f3bfdb on master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.18%) to 91.29% when pulling 43e7f98 on refactor_packet_config into 3f3bfdb on master.

@ghost
Copy link

ghost commented Feb 12, 2015

Is this done?

@jmthomas
Copy link
Contributor Author

I was on vacation. I have a few more spec fixes and then it's done.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.24%) to 91.35% when pulling 2982f29 on refactor_packet_config into 3f3bfdb on master.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling bf65756 on refactor_packet_config into * on master*.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling bf65756 on refactor_packet_config into * on master*.

@jmthomas
Copy link
Contributor Author

@ryanatball please review

# variables.
#
# @return [Array<String>] Warning messages for big definition overlaps
def check_bit_offsets
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was previously in packet_config but I felt like it belongs here inside the Packet class.

@ghost
Copy link

ghost commented Feb 17, 2015

Approved.

@jmthomas
Copy link
Contributor Author

All the specs pass and when I run individual specs in the packets/parser folder I get 100% coverage. You might notice that as I trimmed down the packet_config code I also trimmed it's spec and moved stuff into the individual parser specs.

@jmthomas jmthomas closed this Feb 17, 2015
@jmthomas jmthomas reopened this Feb 17, 2015
jmthomas added a commit that referenced this pull request Feb 17, 2015
@jmthomas jmthomas merged commit 9a2433a into master Feb 17, 2015
@jmthomas jmthomas deleted the refactor_packet_config branch February 17, 2015 19:39
@jmthomas jmthomas mentioned this pull request Feb 17, 2015
ghost pushed a commit that referenced this pull request Apr 5, 2021
Merge in COSMOSEE/base from COSMOSEE-127_settings-page to master

* commit '181563b524ce985b17096ccfe86082a82b24801d':
  Change "forget" to "clear"
  Add settings to clear localStorage items
  Authorize save_setting for global settings
  Add error and success alerts for classification banner settings
  Add configurable font color for classification banners
  Move classification banner code to own component
  Implement saving and loading classification banner
  Add classification banners
  Add classification banner settings page
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