-
Notifications
You must be signed in to change notification settings - Fork 94
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
pyproject.toml: cylc lint settings #5086
pyproject.toml: cylc lint settings #5086
Conversation
35eabf0
to
68529c9
Compare
Waiting for reviewers to check that I've not gone off at teh deep end prior to writing a documentation PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Partial review
1 doctest failure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Partial review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested, working 👍
Please could you add a minimal example pyproject.toml
example to the PR
Oops, |
c494ef1
to
0080c82
Compare
03150c4
to
0a6fbc0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got some surprising behaviour trying to ignore a code:
[cylc-lint]
max-line-length = 20
ignore = ['S008']
$ cylc lint
CylcError: S008 is a not a known linter code.
And there appears to be a missing example in the CLI docs, otherwise fine.
ac1cfd2
to
c6952ca
Compare
cylc/flow/scripts/lint.py
Outdated
def parse_checks(check_args, ignores=None, max_line_len=130, reference=False): | ||
"""Collapse metadata in checks dicts. | ||
|
||
Args: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what "Collapse metadata in checks dicts" means.
The reference
arg is missing a docstring entry
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is 130
the default max_line_len
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, is that a sensible number - I wanted to make it a long but not insane length. I could instead make it v.v. big.
Setting a default meant that the problems you'd been having with it not appearing in the lists of rules went away.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ignore = ['S008']
is now recognised but does not work
cylc/flow/scripts/lint.py
Outdated
argdoc=[COP.optional(('DIR ...', 'Directories to lint'))], | ||
argdoc=[COP.optional(WORKFLOW_ID_OR_PATH_ARG_DOC)], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main
function is not set up to handle workflow IDs, however. It is treating the ID as a relative path. Also I get traceback following this
$ cylc lint foo
2022-09-13T14:49:30+01:00 WARNING - Path foo does not exist.
Traceback (most recent call last):
File "~/.conda/envs/cylc8/bin/cylc", line 33, in <module>
sys.exit(load_entry_point('cylc-flow', 'console_scripts', 'cylc')())
File "~/github/cylc-flow/cylc/flow/scripts/cylc.py", line 657, in main
execute_cmd(command, *cmd_args)
File "~/github/cylc-flow/cylc/flow/scripts/cylc.py", line 284, in execute_cmd
entry_point.resolve()(*args)
File "~/github/cylc-flow/cylc/flow/terminal.py", line 229, in wrapper
wrapped_function(*wrapped_args, **wrapped_kwargs)
File "~/github/cylc-flow/cylc/flow/scripts/lint.py", line 718, in main
f'Checked {target} against {check_names} rules and '
UnboundLocalError: local variable 'check_names' referenced before assignment
I can't replicate this - can you send me the toml file you are using - It took me a wee while to remember that my section heading was |
Just using
and having a line longer than the default 130 |
I think it's too much work to try and anticipate users' typos |
* allow pyproject.toml with cylc lint settings Co-authored-by: Ronnie Dutta <[email protected]> response to review Made cylc lint accept only one argument.
0f8b7c6
to
439df2e
Compare
I see - I think I've fixed it |
Everythging seems to be working apart from ignoring |
Reverted to draft - not priority this afternboon |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
lint: allow pyproject.toml with cylc lint settings (cylc#46) * Support pyproject.toml with cylc lint settings. * Made cylc lint accept only one argument. * Made sure that line length checks are ignored when added to the ignore list. * Remove now unused check
Closes #5052
Check List
CONTRIBUTING.md
and added my name as a Code Contributor.setup.cfg
andconda-environment.yml
-tomli
used, because it will become the standard library's interface.CHANGES.md
entry included if this is a change that can affect users