FINNGEN / kanta_lab_preprocessing

Repo for kanta lab QC
MIT License
1 stars 0 forks source link

Code review #13

Open vincent-octo opened 5 months ago

vincent-octo commented 5 months ago

Suggestions

  1. Use pathlib instead of os.path.

    • Replacing os.path.join():

      os.path.join(dir_path, "test", "raw_data_test.txt")

      becomes

      dir_path / "test" / "raw_data_test.txt"
    • Using type=Path in argparse:

      parser.add_argument("--out", type=str)

      becomes

      from pathlib import Path
      parser.add_argument("--out", type=Path)
  2. Be consistent about formatting code.

    In the current code there is sometimes 0, or 1, or 2 whitespaces in function calls:

    https://github.com/FINNGEN/kanta_lab_preprocessing/blob/6eef71523f9f9b424751cdce0a073a802b05d435/finngen_qc/main.py#L91

    Sometimes no new line: https://github.com/FINNGEN/kanta_lab_preprocessing/blob/6eef71523f9f9b424751cdce0a073a802b05d435/finngen_qc/main.py#L120 and sometimes yes new line: https://github.com/FINNGEN/kanta_lab_preprocessing/blob/6eef71523f9f9b424751cdce0a073a802b05d435/finngen_qc/main.py#L124-L125

    Could use a code formatter to automatically and consistently fix this (e.g. ruff)