Skip to content

identifiersPrefix option - #180

Merged
sanex3339 merged 10 commits into
masterfrom
identifirs-prefix
Jan 24, 2018
Merged

sanex3339 merged 10 commits into
masterfrom
identifirs-prefix

Conversation

@sanex3339

Copy link
Copy Markdown
Member

No description provided.

@coveralls

coveralls commented Jan 17, 2018 •

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.007%) to 98.347% when pulling d4b801e on identifirs-prefix into 4f4f95b on master.

@india081947 india081947 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I think you have incorporated all the required changes.

Please do check below points if it needs changes or not.

  1. In Read me, I think you might not wanted to specify only mangled option. >> Use this option when identifierNamesGenerator: 'mangled'

  2. I hope you dont want prefix track in this.previousMangledName = newName;

thanks

@coveralls

coveralls commented Jan 18, 2018 •

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.007%) to 98.347% when pulling d291fc4 on identifirs-prefix into 4f4f95b on master.

@coveralls

coveralls commented Jan 18, 2018 •

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.01%) to 98.354% when pulling 6de55d2 on identifirs-prefix into 4f4f95b on master.

@india081947 india081947 left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hi @sanex3339,

I may not be correct here, but just wanted to share my point here on why we need additional boolean type here.

As far as I know Chancejs will generate any random data, but will that anyway give 100% GUARANTEE that it wont repeat the same data as generated earlier? This just not apply to global but internal variable too.

If answer is NO then we are putting intentional BUG in system that in a time to come there may be a case that this.randomGenerator.getRandomString(3) & mangled variable (Hexa may have more less chances but not with mangled) gets generated same for another file and then the problem remains same...

We are introducing this field to GUARANTEE that no global variable will be repeat.

Instead I would suggest to introduce internal private static counter which will be a global counter and will get incremented on every new global / internal variable as prefixed, this counter if needed then converted to hexadecimal before affixing.

So in case of true, following code will generate global variable something XYZ_A, and then in some point for file number 1023 it can generate same XYZ_A, isn't that possible?

this.identifiersPrefix = this.options.identifiersPrefix === true ? this.randomGenerator.getRandomString(3)
: this.options.identifiersPrefix || '';

Above option with true will make person addicted to that options assuming he is safe on duplicate while there are small chance of repeat.

So from my side I would not suggest this code, instead the previous PR's simple logic would suffice solution.

@coveralls

coveralls commented Jan 19, 2018 •

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.01%) to 98.33% when pulling a5afb0d on identifirs-prefix into 4f4f95b on master.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.02%) to 98.356% when pulling e4f9c10 on identifirs-prefix into 4f4f95b on master.

1 similar comment
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.02%) to 98.356% when pulling e4f9c10 on identifirs-prefix into 4f4f95b on master.

@sanex3339

sanex3339 commented Jan 22, 2018 •

Copy link
Copy Markdown
Member Author

Now prefix will added only to global identifiers. Should add tests and some refactoring, because i don't like the way how isGlobalIdentifier flag is passing to the Identifiers replacer.

Yep, i will add prefix generation on CLI side for directory obfuscation.

@sanex3339

Copy link
Copy Markdown
Member Author

Seems complete

@sanex3339
sanex3339 merged commit 2b2cc13 into master Jan 24, 2018
@sanex3339
sanex3339 deleted the identifirs-prefix branch January 24, 2018 14:59
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