skulpturenz / shared-resources

MIT License
0 stars 0 forks source link

feat: order stats and clear any existing envs for GetEnvs #251

Closed nmathew98 closed 2 weeks ago

github-actions[bot] commented 2 weeks ago

Title

feat: order stats and clear any existing envs for GetEnvs


PR Type

enhancement


Description


Changes walkthrough ๐Ÿ“

Relevant files
Enhancement
kryptos.go
Enhance stats ordering and environment clearing in functions

kryptos/kryptos/kryptos.go
  • Added ordering to the SQL query results in the Stats function.
  • Cleared existing environment variables in the GetEnvs function.
  • +2/-0     

    ๐Ÿ’ก PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    github-actions[bot] commented 2 weeks ago

    PR Reviewer Guide ๐Ÿ”

    Here are some key observations to aid the review process:

    โฑ๏ธ Estimated effort to review: 2 ๐Ÿ”ต๐Ÿ”ตโšชโšชโšช
    ๐Ÿ… Score: 85
    ๐Ÿงช No relevant tests
    ๐Ÿ”’ No security concerns identified
    โšก Recommended focus areas for review

    Code Smell
    The variable `ENVS` is being declared as a global variable without clear encapsulation, which may lead to unintended side effects. Consider using a local variable or a more controlled scope. Possible Bug
    The addition of `ORDER BY counts.key COLLATE NOCASE` may have performance implications depending on the size of the dataset. Ensure that this is necessary and test the performance impact.
    github-actions[bot] commented 2 weeks ago

    PR Code Suggestions โœจ

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    Possible issue
    Improve error handling during data scanning to ensure robustness ___ **Consider handling the error from rows.Scan to avoid silent failures during data
    retrieval.** [kryptos/kryptos/kryptos.go [153]](https://github.com/skulpturenz/shared-resources/pull/251/files#diff-52d822dfcf5c61ba100975219c933d7bf9d7eb252bc0bbd2c88c408bb68855edR153-R153) ```diff -err = rows.Scan(&key, &encrypted) +if err = rows.Scan(&key, &encrypted); err != nil { ++ return err ++ } ```
    Suggestion importance[1-10]: 8 Why: This suggestion enhances error handling by checking for errors during the scanning process, which is crucial for robustness and preventing silent failures. Implementing this change would significantly improve the code's reliability.
    8
    Possible bug
    Prevent potential nil dereference by ensuring the map is initialized before use ___ **Ensure that ENVS is properly initialized before use to avoid potential nil map
    dereference.** [kryptos/kryptos/kryptos.go [149]](https://github.com/skulpturenz/shared-resources/pull/251/files#diff-52d822dfcf5c61ba100975219c933d7bf9d7eb252bc0bbd2c88c408bb68855edR149-R149) ```diff -+ ENVS = map[string]string{} ++ if ENVS == nil { ++ ENVS = make(map[string]string) ++ } ```
    Suggestion importance[1-10]: 3 Why: The suggestion addresses a potential nil dereference issue, but the current initialization of ENVS as an empty map is sufficient. The proposed change is unnecessary since ENVS is already initialized.
    3
    github-actions[bot] commented 2 weeks ago

    :tropical_drink: preview on authnz/skulpture/shared-authnz

    Pulumi report
    Previewing update (shared-authnz)
    
    View Live: https://app.pulumi.com/skulpture/authnz/shared-authnz/previews/798a4554-76b0-4540-a53f-509c89f0bd09
    
    @ Previewing update.....
    Downloading plugin gcp-7.38.0: starting
    Downloading plugin cloudflare-5.42.0: starting
    Downloading plugin cloudflare-5.42.0: done
    Downloading plugin gcp-7.38.0: done
    Installing plugin cloudflare-5.42.0: starting
    Installing plugin gcp-7.38.0: starting
    @ Previewing update....
    Installing plugin cloudflare-5.42.0: done
    Installing plugin gcp-7.38.0: done
    
    @ Previewing update.............................................................................
    pulumi:pulumi:Stack authnz-shared-authnz running 
    @ Previewing update....
    pulumi:pulumi:Stack authnz-shared-authnz  
    Resources:
    4 unchanged
    
    
    github-actions[bot] commented 2 weeks ago

    :tropical_drink: preview on rollout/skulpture/shared-rollout

    Pulumi report
    Previewing update (shared-rollout)
    
    View Live: https://app.pulumi.com/skulpture/rollout/shared-rollout/previews/ce130d3e-fd26-4926-97b3-b21bb1af182a
    
    @ Previewing update....
    Downloading plugin gcp-7.38.0: starting
    Downloading plugin cloudflare-5.42.0: starting
    Downloading plugin gcp-7.38.0: done
    Downloading plugin cloudflare-5.42.0: done
    Installing plugin gcp-7.38.0: starting
    Installing plugin cloudflare-5.42.0: starting
    @ Previewing update....
    Installing plugin cloudflare-5.42.0: done
    Installing plugin gcp-7.38.0: done
    
    @ Previewing update...............................................................................
    pulumi:pulumi:Stack rollout-shared-rollout running 
    @ Previewing update....
    pulumi:pulumi:Stack rollout-shared-rollout  
    Resources:
    4 unchanged
    
    
    github-actions[bot] commented 2 weeks ago

    :tropical_drink: preview on network/skulpture/shared-infrastructure

    Pulumi report
    Previewing update (shared-infrastructure)
    
    View Live: https://app.pulumi.com/skulpture/network/shared-infrastructure/previews/713f38fa-9d54-4980-81c2-540cdc7d29b8
    
    @ Previewing update.....
    Downloading plugin gcp-7.38.0: starting
    Downloading plugin digitalocean-4.34.0: starting
    Downloading plugin digitalocean-4.34.0: done
    Installing plugin digitalocean-4.34.0: starting
    Downloading plugin gcp-7.38.0: done
    @ Previewing update....
    Installing plugin gcp-7.38.0: starting
    Installing plugin digitalocean-4.34.0: done
    @ Previewing update....
    Installing plugin gcp-7.38.0: done
    
    @ Previewing update....................................................................
    pulumi:pulumi:Stack network-shared-infrastructure running 
    @ Previewing update.....
    pulumi:pulumi:Stack network-shared-infrastructure  
    Resources:
    12 unchanged
    
    
    github-actions[bot] commented 2 weeks ago

    :tropical_drink: preview on telemetry/skulpture/shared-telemetry

    Pulumi report
    Previewing update (shared-telemetry)
    
    View Live: https://app.pulumi.com/skulpture/telemetry/shared-telemetry/previews/cf6a2533-ed9f-447e-a08b-3e9871a38cef
    
    @ Previewing update.....
    Downloading plugin gcp-7.38.0: starting
    Downloading plugin cloudflare-5.42.0: starting
    @ Previewing update....
    Downloading plugin cloudflare-5.42.0: done
    Downloading plugin gcp-7.38.0: done
    Installing plugin cloudflare-5.42.0: starting
    Installing plugin gcp-7.38.0: starting
    Installing plugin cloudflare-5.42.0: done
    @ Previewing update....
    Installing plugin gcp-7.38.0: done
    
    @ Previewing update...........................................................................
    pulumi:pulumi:Stack telemetry-shared-telemetry running 
    @ Previewing update....
    pulumi:pulumi:Stack telemetry-shared-telemetry  
    Resources:
    4 unchanged