Coder Social home page Coder Social logo

Comments (7)

pionxzh avatar pionxzh commented on July 24, 2024 1

The length limitation has been removed.

from wakaru.

pionxzh avatar pionxzh commented on July 24, 2024

smart-rename will check if the new name is longer than the original one to ensure that the meaningful or, let's say, the longer name won't be eliminated accidentally. This rule might not be reasonable when both names are relatively short. I think we can adjust the rule to be:

  1. replace when key length > value length. It means the key should be more expressive
  2. replace when both key and value are short (e.g. <= 3). It means the value might be a temporary variable, and the key should be more expressive or readable in most cases
  3. don't replace when key length <= value length. It means the key is not more expressive than the value, or the author wants to provide a more expressive name for the value

from wakaru.

pionxzh avatar pionxzh commented on July 24, 2024

you can update id to idd, and you will see aa becomes idd 😄

from wakaru.

milahu avatar milahu commented on July 24, 2024

i dont care about the length, i just want to remove the rebindings

rebindings should only be preserved if there is a collision with other identifiers
and these other identifiers cannot be renamed

from wakaru.

0xdevalias avatar 0xdevalias commented on July 24, 2024

@milahu I believe the length is being used as a method to figure what is a minified variable or not.

If you have a better method of consistently determining that in an automated fashion; feel free to suggest it.

--

I haven't thought about this too deeply, but perhaps if a variable is being destructured, and the key it is being destructured from doesn't clash with any existing variables, then use that key as the variable name (regardless of length)

from wakaru.

pionxzh avatar pionxzh commented on July 24, 2024

Rephrase the updated rule I mentioned: Only keep the destructured name when the variable's length is >= 4 to avoid removing non-minified variables. However, this may not be a good strategy for obfuscated input. Then, we can also consider simply ignoring the length.

from wakaru.

milahu avatar milahu commented on July 24, 2024

this may not be a good strategy for obfuscated input

exactly

from wakaru.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.