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

cylc lint non zero code from warnings #5546

Conversation

ColemanTom
Copy link
Contributor

@ColemanTom ColemanTom commented May 16, 2023

Closes #5545

Check List

  • I have read CONTRIBUTING.md and added my name as a Code Contributor.
  • Contains logically grouped changes (else tidy your branch by rebase).
  • Does not contain off-topic changes (use other PRs for other changes).
  • Applied any dependency changes to both setup.cfg (and conda-environment.yml if present).
  • Tests are included (or explain why tests are not needed).
  • CHANGES.md entry included if this is a change that can affect users
  • Cylc-Doc pull request opened if required at cylc/cylc-doc/pull/XXXX.

No tests - I didn't think they were needed for this change.

I have not updated docs as I didn't see where it would be appropriate to add anything about this.

Targetting the 8.1.x branch, but can change if required.

@ColemanTom ColemanTom force-pushed the 5545-cylc-lint-non-zero-code-from-warnings branch from fb3e9a3 to 40a1f64 Compare May 16, 2023 06:38
@oliver-sanders oliver-sanders added this to the cylc-8.1.5 milestone May 16, 2023
@oliver-sanders
Copy link
Member

oliver-sanders commented May 16, 2023

Not a bugfix but small and isolated enough to go into 8.1.5 IMO.

@hjoliver
Copy link
Member

(I agree, this should be the default behaviour)

@ColemanTom ColemanTom force-pushed the 5545-cylc-lint-non-zero-code-from-warnings branch from 40a1f64 to f91c568 Compare May 17, 2023 00:28
@ColemanTom
Copy link
Contributor Author

Ok. Updated

  • return non-0 by default.
  • --exit-zero flag added
  • functional tests updated and a few new ones added
  • renamed some test case names to be more descriptive (and one of them was a duplicate name)
  • changed exit() to sys.exit() as exit is meant for interactive shells, not for scripts, and I was modifying the lines anyway (see the documentation on this here)

Previously it would provide a return code 0 always.
By default, it will now return 1 if an issue is found.
New flag --exit-zero changes back to original behaviour.
@ColemanTom ColemanTom force-pushed the 5545-cylc-lint-non-zero-code-from-warnings branch from f91c568 to e8e2389 Compare May 17, 2023 00:37
@hjoliver
Copy link
Member

changed exit() to sys.exit() as exit is meant for interactive shells, not for script

Huh, I was not even aware of (non-sys) exit() !

Copy link
Member

@hjoliver hjoliver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@oliver-sanders
Copy link
Member

Huh, I was not even aware of (non-sys) exit() !

It's how you get out of interactive sessions, not sure how that got into the code.

Copy link
Member

@oliver-sanders oliver-sanders left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@oliver-sanders oliver-sanders merged commit 4e86e6b into cylc:8.1.x May 17, 2023
@hjoliver
Copy link
Member

It's how you get out of interactive sessions, not sure how that got into the code.

It's not how I get out (Ctrl-D).

@MetRonnie MetRonnie linked an issue May 18, 2023 that may be closed by this pull request
wxtim added a commit to wxtim/cylc that referenced this pull request May 19, 2023
…github.com:wxtim/cylc into fix.sort_lint_listing--correct_number_for_line_len

* 'fix.sort_lint_listing--correct_number_for_line_len' of github.com:wxtim/cylc:
  `cylc play`: add suggestion for `--upgrade` in non-interactive terminal (cylc#5535)
  centralize number used for line length check.
  Respond to review
  Fix cylc lint commented-out Jinja2 bug
  Logging: say command actioned instead of succeeded
  cylc lint non zero code from warnings (cylc#5546)
  Fix S011 lint (cylc#5536)
@hjoliver hjoliver modified the milestones: cylc-8.1.5, cylc-8.2.0 Jun 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cylc lint - ability to return non-zero code when warnings raised?
3 participants