Git Product home page Git Product logo

Comments (5)

KevinHock avatar KevinHock commented on July 19, 2024 2

Thanks @dgzlopes! 👍 🎈 🎉 🎂

from detect-secrets.

dgzlopes avatar dgzlopes commented on July 19, 2024

Hello! I don't understand why the IGNORED_FILE_EXTENSIONS structure should change from a tuple to a dict. Could you offer some more insight on this?

On the other side, I made this quick fix dgzlopes@3828be9 on my fork (handling the check inside scan_file() instead of _extract_secrets_from_file()) and seems to work ok. Any idea on where to handle it more gently?

from detect-secrets.

KevinHock avatar KevinHock commented on July 19, 2024

The reason why I would like to change it to a dict is because the only use is an in check, which is faster in a hash table (dictionary). It's less for performance reasons and more for knowing how it is used, from seeing the type.

from detect-secrets.

dgzlopes avatar dgzlopes commented on July 19, 2024

Oh! I see. On the other hand (and sorry if this question is stupid) why we can't use a Set()?

They have both the same time complexity (O(1) for membership checking on the average case [0]) and both are implemented with a Hashtable. Also our file extensions values fit in one dimension [1], are unique and can be unordered. Also the Python docs [3] states that they are a good option for membership testing.

[0] https://wiki.python.org/moin/TimeComplexity#set
[1] https://stackoverflow.com/questions/19454970/is-there-a-python-dict-without-values
[2] https://docs.python.org/3/library/stdtypes.html#set

from detect-secrets.

KevinHock avatar KevinHock commented on July 19, 2024

Oh, I wasn't clear, I did mean set.
e.g. replacing the ( with { and ) with }

A dictionary without keys is a set, so I kind of used them interchangeably.

from detect-secrets.

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.