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

Is it worth linting the toolchain/? #230

Closed
sbryngelson opened this issue Nov 15, 2023 · 0 comments · Fixed by #291
Closed

Is it worth linting the toolchain/? #230

sbryngelson opened this issue Nov 15, 2023 · 0 comments · Fixed by #291
Assignees
Labels
enhancement New feature or request

Comments

@sbryngelson
Copy link
Member

Using pylint with some ignore flags for obviously unhelpful comments, I find these messages from the tool chain. I suspect some must still be ignored, but perhaps some are valid points. We can add a linter like pylint and/or auto-formatter like black to the CI if it is helpful.

$ MFC/toolchain $ pylint -d C0106,C0116,C0103,C0301,C0303,C0410 mfc.py ./*/*.py
************* Module Command line
Command line:1:0: W0012: Unknown option value for '-d', expected a valid pylint message and got 'C0106' (unknown-option-value)
************* Module mfc
mfc.py:19:31: W1401: Anomalous backslash in string: '\['. String constant might be missing an r prefix. (anomalous-backslash-in-string)
mfc.py:1:0: C0114: Missing module docstring (missing-module-docstring)
mfc.py:10:0: W0622: Redefining built-in 'quit' (redefined-builtin)
mfc.py:15:27: R1728: Consider using a generator instead 'max(len(line) for line in MFC_LOGO_LINES)' (consider-using-generator)
mfc.py:78:11: W0718: Catching too general exception Exception (broad-exception-caught)
mfc.py:75:8: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
mfc.py:77:8: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
mfc.py:87:8: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
************* Module mfc.args
mfc/args.py:1:0: C0114: Missing module docstring (missing-module-docstring)
mfc/args.py:8:0: R0914: Too many local variables (24/15) (too-many-locals)
mfc/args.py:29:4: W0621: Redefining name 'packer' from outer scope (line 6) (redefined-outer-name)
mfc/args.py:9:4: C0415: Import outside toplevel (run.engines.ENGINES) (import-outside-toplevel)
mfc/args.py:10:4: C0415: Import outside toplevel (run.mpi_bins.BINARIES) (import-outside-toplevel)
mfc/args.py:14:20: W1309: Using an f-string that does not have any interpolated variables (f-string-without-interpolation)
mfc/args.py:133:18: W0612: Unused variable 'errs' (unused-variable)
mfc/args.py:144:8: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
mfc/args.py:8:0: R0915: Too many statements (92/50) (too-many-statements)
mfc/args.py:6:0: W0611: Unused packer imported from packer (unused-import)
************* Module mfc.bench
mfc/bench.py:1:0: C0114: Missing module docstring (missing-module-docstring)
mfc/bench.py:9:0: E0611: No name 'sched' in module 'mfc' (no-name-in-module)
mfc/bench.py:24:28: W0613: Unused argument 'devices' (unused-argument)
mfc/bench.py:59:9: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
************* Module mfc.build
mfc/build.py:239:0: C0305: Trailing newlines (trailing-newlines)
mfc/build.py:1:0: C0114: Missing module docstring (missing-module-docstring)
mfc/build.py:10:0: C0115: Missing class docstring (missing-class-docstring)
mfc/build.py:12:4: C0115: Missing class docstring (missing-class-docstring)
mfc/build.py:133:8: W0621: Redefining name 'build' from outer scope (line 233) (redefined-outer-name)
mfc/build.py:107:12: W1309: Using an f-string that does not have any interpolated variables (f-string-without-interpolation)
mfc/build.py:111:12: W1309: Using an f-string that does not have any interpolated variables (f-string-without-interpolation)
mfc/build.py:171:8: W0621: Redefining name 'clean' from outer scope (line 237) (redefined-outer-name)
************* Module mfc.case
mfc/case.py:1:0: C0114: Missing module docstring (missing-module-docstring)
mfc/case.py:4:0: C0115: Missing class docstring (missing-class-docstring)
mfc/case.py:14:74: C0208: Use a sequence type when iterating over values (use-sequence-for-iteration)
************* Module mfc.common
mfc/common.py:51:0: C0325: Unnecessary parens after 'not' keyword (superfluous-parens)
mfc/common.py:1:0: C0114: Missing module docstring (missing-module-docstring)
mfc/common.py:191:0: W0622: Redefining built-in 'quit' (redefined-builtin)
mfc/common.py:1:0: E0401: Unable to import 'yaml' (import-error)
mfc/common.py:15:11: W1309: Using an f-string that does not have any interpolated variables (f-string-without-interpolation)
mfc/common.py:28:0: C0115: Missing class docstring (missing-class-docstring)
mfc/common.py:32:0: R0913: Too many arguments (8/5) (too-many-arguments)
mfc/common.py:46:8: W1510: 'subprocess.run' used without explicitly defining the value for 'check'. (subprocess-run-check)
mfc/common.py:62:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
mfc/common.py:65:8: W0707: Consider explicitly re-raising using 'raise MFCException(f'Failed to write to "{filepath}": {exc}') from exc' (raise-missing-from)
mfc/common.py:70:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
mfc/common.py:73:8: W0707: Consider explicitly re-raising using 'raise MFCException(f'Failed to read from "{filepath}": {exc}') from exc' (raise-missing-from)
mfc/common.py:78:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
mfc/common.py:81:8: W0707: Consider explicitly re-raising using 'raise MFCException(f'Failed to load YAML from "{filepath}": {exc}') from exc' (raise-missing-from)
mfc/common.py:86:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
mfc/common.py:89:8: W0707: Consider explicitly re-raising using 'raise MFCException(f'Failed to dump YAML to "{filepath}": {exc}.') from exc' (raise-missing-from)
mfc/common.py:100:12: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
mfc/common.py:100:12: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
mfc/common.py:102:12: W0707: Consider explicitly re-raising using 'raise MFCException(f'Failed to create file {filepath}: {exc}') from exc' (raise-missing-from)
mfc/common.py:118:11: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
mfc/common.py:135:7: C0121: Comparison 's == None' should be 's is None' (singleton-comparison)
mfc/common.py:215:7: R1701: Consider merging these isinstance calls to isinstance(x, (float, int)) (consider-merging-isinstance)
mfc/common.py:5:0: C0411: standard import "from os.path import abspath, normpath, dirname, realpath" should be placed before "from .printer import cons" (wrong-import-order)
mfc/common.py:1:0: W0611: Unused import dataclasses (unused-import)
************* Module mfc.count
mfc/count.py:46:0: C0305: Trailing newlines (trailing-newlines)
mfc/count.py:1:0: C0114: Missing module docstring (missing-module-docstring)
mfc/count.py:15:12: W0621: Redefining name 'count' from outer scope (line 23) (redefined-outer-name)
mfc/count.py:14:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
mfc/count.py:36:22: W0621: Redefining name 'count' from outer scope (line 23) (redefined-outer-name)
mfc/count.py:7:0: C0411: third party import "import rich.table" should be placed before "from .state import ARG" (wrong-import-order)
************* Module mfc.lock
mfc/lock.py:1:0: C0114: Missing module docstring (missing-module-docstring)
mfc/lock.py:3:0: E0611: No name 'common' in module 'mfc' (no-name-in-module)
mfc/lock.py:12:0: C0115: Missing class docstring (missing-class-docstring)
mfc/lock.py:21:4: W0603: Using the global statement (global-statement)
mfc/lock.py:35:4: W0603: Using the global statement (global-statement)
mfc/lock.py:54:4: W0602: Using global for 'data' but no assignment is done (global-variable-not-assigned)
mfc/lock.py:60:4: W0602: Using global for 'data' but no assignment is done (global-variable-not-assigned)
************* Module mfc.printer
mfc/printer.py:1:0: C0114: Missing module docstring (missing-module-docstring)
mfc/printer.py:6:0: C0115: Missing class docstring (missing-class-docstring)
mfc/printer.py:20:11: C0121: Comparison 'times == None' should be 'times is None' (singleton-comparison)
mfc/printer.py:26:4: W1113: Keyword argument before variable positional arguments list in the definition of print function (keyword-arg-before-vararg)
************* Module mfc.sched
mfc/sched.py:1:0: C0114: Missing module docstring (missing-module-docstring)
mfc/sched.py:8:0: C0115: Missing class docstring (missing-class-docstring)
mfc/sched.py:18:15: W0718: Catching too general exception Exception (broad-exception-caught)
mfc/sched.py:23:0: C0115: Missing class docstring (missing-class-docstring)
mfc/sched.py:31:0: C0115: Missing class docstring (missing-class-docstring)
mfc/sched.py:49:19: C0121: Comparison 'threadHolder.thread.exc != None' should be 'threadHolder.thread.exc is not None' (singleton-comparison)
mfc/sched.py:5:0: C0411: third party import "import rich, rich.progress" should be placed before "from .printer import cons" (wrong-import-order)
mfc/sched.py:5:0: C0411: third party import "import rich, rich.progress" should be placed before "from .printer import cons" (wrong-import-order)
************* Module mfc.state
mfc/state.py:1:0: C0114: Missing module docstring (missing-module-docstring)
mfc/state.py:5:0: C0115: Missing class docstring (missing-class-docstring)
mfc/state.py:10:4: E0213: Method 'from_dict' should have "self" as first argument (no-self-argument)
mfc/state.py:52:4: W0602: Using global for 'gARG' but no assignment is done (global-variable-not-assigned)
mfc/state.py:56:4: W0602: Using global for 'gARG' but no assignment is done (global-variable-not-assigned)
mfc/state.py:60:4: W0602: Using global for 'gCFG' but no assignment is done (global-variable-not-assigned)

------------------------------------------------------------------
Your code has been rated at 8.40/10 (previous run: 8.21/10, +0.18)
@sbryngelson sbryngelson added the enhancement New feature or request label Nov 15, 2023
henryleberre added a commit to henryleberre/ChemMFC that referenced this issue Dec 18, 2023
henryleberre added a commit to henryleberre/ChemMFC that referenced this issue Dec 18, 2023
@henryleberre henryleberre linked a pull request Dec 18, 2023 that will close this issue
henryleberre added a commit to henryleberre/ChemMFC that referenced this issue Dec 18, 2023
henryleberre added a commit to henryleberre/ChemMFC that referenced this issue Dec 18, 2023
henryleberre added a commit to henryleberre/ChemMFC that referenced this issue Dec 18, 2023
henryleberre added a commit to henryleberre/ChemMFC that referenced this issue Dec 18, 2023
henryleberre added a commit to henryleberre/ChemMFC that referenced this issue Dec 19, 2023
henryleberre added a commit to henryleberre/ChemMFC that referenced this issue Jan 5, 2024
henryleberre added a commit to henryleberre/ChemMFC that referenced this issue Jan 5, 2024
henryleberre added a commit to henryleberre/ChemMFC that referenced this issue Jan 5, 2024
henryleberre added a commit to henryleberre/ChemMFC that referenced this issue Jan 5, 2024
henryleberre added a commit to henryleberre/ChemMFC that referenced this issue Jan 5, 2024
henryleberre added a commit to henryleberre/ChemMFC that referenced this issue Jan 5, 2024
Co-authored-by: Spencer Bryngelson <[email protected]>
@henryleberre henryleberre removed a link to a pull request Jan 5, 2024
henryleberre added a commit to henryleberre/ChemMFC that referenced this issue Jan 5, 2024
Co-authored-by: Spencer Bryngelson <[email protected]>
henryleberre added a commit to henryleberre/ChemMFC that referenced this issue Jan 5, 2024
Co-authored-by: Spencer Bryngelson <[email protected]>
henryleberre added a commit that referenced this issue Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging a pull request may close this issue.

2 participants