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

Reduce cyclomatic complexity of product.js #47

Closed
philwinkle opened this issue Sep 28, 2014 · 3 comments
Closed

Reduce cyclomatic complexity of product.js #47

philwinkle opened this issue Sep 28, 2014 · 3 comments

Comments

@philwinkle
Copy link

I believe this requires a refactor on a couple levels:

  • It requires eval. If eval is required you should rather echo the code from config and inject it into the spConfig object.
  • It has a cyclomatic complexity of 18. The highest, at best, should be 4-5. That means we need to refactor it to use a number of sub functions or utilize map, guard functions.

I have begun a refactor, but may require help to discuss rationale.

@tzyganu
Copy link
Owner

tzyganu commented Sep 29, 2014

@philwinkle Yes the product.js requires a js eval. It evaluates the code filled in the config fields Js Callback after main image change and Js Callback after media change. Those are executed after the main product image or the media block are changed. I'm not sure I understand how I can echo it in the config ad inject it in the spConfig object.
You have my skype Id so you can fill me in on what I'm missing.
We can also talk about reducing the cyclomatic complexity.

Thanks for trying to make this extension better.

@tzyganu
Copy link
Owner

tzyganu commented Nov 19, 2014

@philwinkle This should be fixed in version 2.0.0. All functions from product.js have the max cyclomatic complexity of 5. (at least that's what I'm getting from the tool I'm using)

@tzyganu tzyganu closed this as completed Nov 19, 2014
@philwinkle
Copy link
Author

👍

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

No branches or pull requests

2 participants