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

Confusing metrics.globalVariables vs offenders.globalVariables output #227

Closed
pdehaan opened this issue Feb 3, 2014 · 1 comment
Closed
Assignees
Milestone

Comments

@pdehaan
Copy link

pdehaan commented Feb 3, 2014

Steps to reproduce:

  1. Run Phantomas from the command line and set the reporter to JSON:
    $ sudo phantomas --url https://foo.org/signup --reporter json
  2. Compare the metrics.globalVariables and offenders.globalVariables results:
    "globalVariables": 12,

But the globalVariables array is an array with one element

    "globalVariables": [
      "$, Backbone, Modernizr, _, define, html5, jQuery, jQuery110206297926814295352, require, requirejs, router, translator"
    ],

Actual results:

metrics.globalVariables == 12, but the offenders.globalVariables only has a single item in it's array (which is a ", " delimited string):

offenders.globalVariables[0] = "$, Backbone, Modernizr, _, define, html5, jQuery, jQuery110206297926814295352, require, requirejs, router, translator"

Expected results:

Each global variable should be its own array element (something like offenders.globalVariables = offenders.globalVariables[0].split(", "))

  • offenders.globalVariables[0] === "$"
  • offenders.globalVariables[1] === "Backbone"
  • ...
  • offenders.globalVariables[11] === "translator"
@macbre macbre added this to the v1.0 milestone Feb 3, 2014
@macbre macbre self-assigned this Feb 3, 2014
@macbre
Copy link
Owner

macbre commented Feb 3, 2014

@pdehaan, good point. I was considering this approach when implementing this.

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

No branches or pull requests

2 participants