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

Fix algorithm #16

Closed
rohaquinlop opened this issue Mar 1, 2024 · 0 comments
Closed

Fix algorithm #16

rohaquinlop opened this issue Mar 1, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@rohaquinlop
Copy link
Owner

rohaquinlop commented Mar 1, 2024

When writing a try/except count on the amount of exceptions.

try:
    ...
except ...:
    ...
except: ...:
    ...

Check how is being calculated the elif statement, it should be considered at the "same" level as the previous if statement

def has_sequence(value: str, sequence_size: int = 3) -> bool:
    if len(value) < sequence_size or sequence_size <= 0:
        return False

    sequence: list[int] = [ord(value[0])]
    is_increasing = False
    for char in value[1:]:
        current_ord: int = ord(char)

        if sequence[-1] + 1 == current_ord:
            if len(sequence) == 1:
                is_increasing = True
            sequence = sequence_increasing(
                char, current_ord, sequence, is_increasing
            )
        elif sequence[-1] - 1 == current_ord:
            if len(sequence) == 1:
                is_increasing = False
            sequence = sequence_decreasing(
                char, current_ord, sequence, is_increasing
            )
        else:
            sequence = [current_ord]

        if len(sequence) == sequence_size:
            return True

    return False

When assigning with an increase operation is counting incorrectly

a = a + 1 # 0
b = a + 2 # 0
@rohaquinlop rohaquinlop self-assigned this Mar 2, 2024
@rohaquinlop rohaquinlop added the bug Something isn't working label Mar 2, 2024
rohaquinlop added a commit that referenced this issue Mar 3, 2024
- Update the way that the metric is calculated.
- Update the `test_try` function.
rohaquinlop added a commit that referenced this issue Mar 3, 2024
rohaquinlop added a commit that referenced this issue Mar 3, 2024
rohaquinlop added a commit that referenced this issue Mar 3, 2024
rohaquinlop added a commit that referenced this issue Mar 4, 2024
rohaquinlop added a commit that referenced this issue Mar 4, 2024
rohaquinlop added a commit that referenced this issue Mar 4, 2024
- Consider the case when multiple exceptions are
caught in a single try block.
- Update the test case to cover the new feature.
rohaquinlop added a commit that referenced this issue Mar 4, 2024
- Upgrade the cognitive complexity when multiple
functions are defined in a nested way.
- Also, remove to add the nested level to all the
cases.
- Consider the case when multiple exceptions are
caught in a single try block.
- Update the test case to cover the new feature.
rohaquinlop added a commit that referenced this issue Mar 4, 2024
- Upgrade the cognitive complexity when multiple
functions are defined in a nested way.
- Also, remove to add the nested level to all the
cases.
- Consider the case when multiple exceptions are
caught in a single try block.
- Update the test case to cover the new feature.
rohaquinlop added a commit that referenced this issue Mar 4, 2024
feat(build): #16 enhance try cognitive complexity
rohaquinlop added a commit that referenced this issue Mar 4, 2024
rohaquinlop added a commit that referenced this issue Mar 4, 2024
- Add unit testing for the rust module
rohaquinlop added a commit that referenced this issue Mar 4, 2024
- Add unit testing for the rust module
rohaquinlop added a commit that referenced this issue Mar 4, 2024
- Add unit testing for the rust module
rohaquinlop added a commit that referenced this issue Mar 4, 2024
- Add unit testing for the rust module
rohaquinlop added a commit that referenced this issue Mar 4, 2024
- Add unit testing for the main functionality
- Add a test for each file in the `tests` directory
- Add a test for the `main` function
rohaquinlop added a commit that referenced this issue Mar 4, 2024
- Add unit testing for the main functionality
- Add a test for each file in the `tests` directory
- Add a test for the `main` function
rohaquinlop added a commit that referenced this issue Mar 4, 2024
- Add unit testing for the main functionality
- Add a test for each file in the `tests` directory
- Add a test for the `main` function
rohaquinlop added a commit that referenced this issue Mar 4, 2024
- Add unit testing for the main functionality
- Add a test for each file in the `tests` directory
- Add a test for the `main` function
rohaquinlop added a commit that referenced this issue Mar 4, 2024
- Add unit testing for the main functionality
- Add a test for each file in the `tests` directory
- Add a test for the `main` function
rohaquinlop added a commit that referenced this issue Mar 4, 2024
- Add unit testing for the main functionality
- Add a test for each file in the `tests` directory
- Add a test for the `main` function
rohaquinlop added a commit that referenced this issue Mar 4, 2024
feat(test): #16 add unit testing
@rohaquinlop rohaquinlop reopened this Mar 12, 2024
rohaquinlop pushed a commit that referenced this issue Mar 13, 2024
- Fix cognitive complexity for assign statements
- Fix algorithm for counting boolean operations
- Update version to `0.3.1`
rohaquinlop pushed a commit that referenced this issue Mar 13, 2024
- Fix cognitive complexity for assign statements
- Fix algorithm for counting boolean operations
- Update version to `0.3.1`
rohaquinlop added a commit that referenced this issue Mar 13, 2024
fix(algorithm): #16 fix cognitive complexity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant