`AntsArgParser` has conditional which is always `True`

Open Beginner friendly
#164 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
85/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
python
Domain
cli

Research direction

Start in lib/ants/command_parse.py at the command_parse entry point and line 92, then trace how target_obj is used when arguments are added. Confirm the conditional does not depend on a value that cannot change, and verify that command parsing still adds the expected arguments.

Written by the indexing model from the issue text.

Description

🐜 Bug Report

In command_parse there is a line declaring target_obj=self which creates a reference to self

https://github.com/MetOffice/ANTS/blob/70dbeb2d3c802076bfd3d4d61cb6d4f6f381044e/lib/ants/command_parse.py#L92

Later arguments are added depending on if target_obj is self which always evaluates to True. It would be simpler to change the requirements of arguments to True.

How to reproduce

Step by step guide to reproduce the behaviour:

  1. target_obj assigned to self
  2. target_obj is never re-assigned or copied in any execution path

Environment

I am using the ANTS 3.2.0 environment.

Version

This bug exists in ANTS 3.2.0/head of main

Dominant language
Python
Stars
7
Forks
10
Avg merge
1d 19h
Merged PRs (30d)
5

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from MetOffice/ANTS

All issues in MetOffice/ANTS

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.