Skip to content

Issue 1: Inconsistent Global Variable Usage and Potential Name Collision #11

@PrinceSajjadHussain

Description

@PrinceSajjadHussain

Title: Avoid Global Variables and Potential Name Collisions: Use args Directly

Body:
The script uses global GLOBAL_VERBOSE and global GLOBAL_CONFIG.

  1. Explicitly defining global variables, especially when they can be easily accessed from the args namespace, is generally considered bad practice. It makes the code harder to reason about and can lead to unintended side effects. It's generally best to avoid globals.
  2. There is a potential name collision between GLOBAL_DEBUG in analyze_ccw.py and GLOBAL_FORCE in ata.py files.
    Consider these changes:
  • Instead of using global GLOBAL_VERBOSE and global GLOBAL_CONFIG in main() function, pass the necessary variables as arguments:
def main(results_csv, output_file, verbose, config):
    df = pd.read_csv(results_csv)
    # access the configs via config dict.
    ...

if __name__ == "__main__":
    #...
    main(args.results, args.output, args.verbose, GLOBAL_CONFIG)

File: ata.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions