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

Simplify Type Checking in sort_collections Function #185

Closed
AkashS0510 opened this issue Sep 28, 2024 · 5 comments
Closed

Simplify Type Checking in sort_collections Function #185

AkashS0510 opened this issue Sep 28, 2024 · 5 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@AkashS0510
Copy link
Collaborator

Issue:
The current implementation of the sort_collections function in the utils.py manually checks for multiple data types (str, float, int, bool) using individual isinstance checks. This can be simplified by grouping these checks into a single isinstance statement, improving readability and reducing redundancy.

Task:

Update the sort_collections function in the utils.py to use a single isinstance check for primitive types.

@AkashS0510 AkashS0510 added enhancement New feature or request good first issue Good for newcomers labels Sep 28, 2024
@AkashS0510 AkashS0510 changed the title 🚀 Simplify Type Checking in sort_collections Function Simplify Type Checking in sort_collections Function Sep 28, 2024
@gabrilito1
Copy link
Contributor

done

gabrilito1 added a commit to gabrilito1/tirith that referenced this issue Sep 29, 2024
Simplify type checking in sort_collections()

Closes StackGuardian#185
samriddhi99 pushed a commit to gabrilito1/tirith that referenced this issue Sep 29, 2024
@AkashS0510 AkashS0510 reopened this Sep 30, 2024
@AkashS0510
Copy link
Collaborator Author

@gabrilito1 There is another instance in the function where the simplification needs to be done. Can you check it and do that again?

@gabrilito1
Copy link
Contributor

yes, done

@gabrilito1
Copy link
Contributor

@AkashS0510 #187

@AkashS0510
Copy link
Collaborator Author

Thanks @gabrilito1

tejasvi541 added a commit to tejasvi541/tirith-local that referenced this issue Oct 4, 2024
Fix: corrected the file name __init__.py

Signed-off-by: pravo23 <[email protected]>

Enhance GitHub Actions Workflow with PR Triggers (StackGuardian#148)

* Add PR triggers to github actions workflow

* Update lint.yml
Centralized version definition to simplify version management (StackGuardian#142)

Co-authored-by: Rafid Aslam <[email protected]>
Update build_test.yml (StackGuardian#149)

* Update build_test.yml

* Update lint.yml
Update logger initialization to use module-specific loggers StackGuardian#140

Changed "logger = logging.getLogger()" line of code to "logger = logging.getLogger(__name__)" in all files

Removed the TODO Comments - "# TODO: At least add __name__ as the name for the logger" in all files
StackGuardian#140

Removed RESULTS text from error

Resolved - Generalize the function get_path_value_from_dict

Refactor get_path_value_from_dict

Moved get_path_value_from_dict to common.py.
Refactored Kubernetes and JSON handler files to import from common.py.

Updated Common.py

Fix linting (StackGuardian#167)

Add a getting started guide in README.md (StackGuardian#139)

* Add a getting started guide in README.md

* Add description of getting started activity, and some minor fixes
Add maintainers in README and CODEOWNERS file

Add additional rules and guidelines to contributing.md

Add examples for commit messages and guidelines for solving issues

Update CONTRIBUTING.md with guidelines about solving issues

Add separate heading about solving issues, and add examples for writing descriptions in commit changes
setup the docs base (StackGuardian#177)

* created the template for the official documentation

* setting up the environment

* cleaned up the documentation setup

* adjusted the color scheme

* setup the basic pages for the tirith documentation

* updated the intro page
Add dev container

Add dev container

Closes StackGuardian#175

Update Readme.MD

Simplify type checking in sort_collections()

Closes StackGuardian#185

Add Variable Replacement Support in Tirith Policies (StackGuardian#171)

* Add support for parameterizing Tirith policies

* Use pydash.get() and check for match only if the value is of type str

* Add variable replacement for meta and eval_expression in a policy

* Add unit tests for policy parameterization, change return type for cases where the path was not found, and change syntax of entering the variable names

* Fix linting

* tirith parametrization

---------

Co-authored-by: Rafid Aslam <[email protected]>
Removed RESULTS text from error

Resolved - Generalize the function get_path_value_from_dict

Refactor get_path_value_from_dict

Moved get_path_value_from_dict to common.py.
Refactored Kubernetes and JSON handler files to import from common.py.

Updated Common.py

Fix linting (StackGuardian#167)

Add a getting started guide in README.md (StackGuardian#139)

* Add a getting started guide in README.md

* Add description of getting started activity, and some minor fixes
Add maintainers in README and CODEOWNERS file

Add additional rules and guidelines to contributing.md

Add examples for commit messages and guidelines for solving issues

Update CONTRIBUTING.md with guidelines about solving issues

Add separate heading about solving issues, and add examples for writing descriptions in commit changes

Merge branch 'main' of https://github.com/StackGuardian/tirith
@refeed refeed closed this as completed in 2f8d64f Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants