Skip to content

Conversation

@ruck94301
Copy link
Contributor

Months ago when I started using pylint for static analysis, I began using pylint pragmas to disable/enable some types of observations.
I'm scrubbing a lot of those now, but not all.
The ones I'm scrubbing I've reviewed and decided it's better to disable or enable globally, so I've moved them to settings in pylintrc.
Especially my attempt to be very specific with disabling/enabling "wrong-import-position" was futile, because pytest has a bug in the current implementation of that rule. :-/

Merging this PR will have no effect on LabGym behavior.

@ruck94301
Copy link
Contributor Author

ruck94301 commented Dec 18, 2025

FWIW, 26 py-files scored by pylint.
For my own work, my goals are not make any existing file "worse", and for new files that I'm authoring I want them to be 8+ before asking Henry to accept PR.

% sh pylint.sh --summarize
     1	10.00/10  2     __init__.py
     2	9.21/10   6     __main__.py
     3	8.96/10   104   analyzebehavior.py
     4	9.02/10   165   analyzebehavior_dt.py
     5	8.59/10   136   categorizer.py
     6	8.96/10   8     central_logging.py
     7	9.54/10   8     config.py
     8	7.66/10   25    detector.py
     9	9.02/10   115   gui_analyzer.py
    10	6.49/10   11    gui_app_icon.py
    11	8.93/10   131   gui_categorizer.py
    12	8.74/10   52    gui_detector.py
    13	8.98/10   28    gui_main.py
    14	8.96/10   58    gui_preprocessor.py
    15	9.23/10   4     gui_utils.py
    16	8.72/10   15    minedata.py
    17	9.67/10   5     myargparse.py
    18	9.13/10   12    mylogging.py
    19	8.57/10   4     mypkg_resources.py
    20	10.00/10  2     mywx.__init__.py
    21	6.32/10   9     mywx.custom.py
    22	9.33/10   5     mywx.patch.py
    23	8.49/10   11    probes.py
    24	9.14/10   14    registration.py
    25	9.09/10   68    tools.py
    26	8.71/10   10    userdata_survey.py

This tells me I've fallen short of my goal for one of my files, mywx/custom.py (6.32).

Also,
approx 25 warnings for detector.py (7.66) could be reviewed. This is why I thought you had a bug on line 174. I don't know if that's a false alarm from pylint, or unreachable code, since your testing indicated no problem.

     1	************* Module LabGym.detector
     2	/Users/john/LabGymRepo/LabGym/detector.py:41:0: C0115: Missing class docstring (missing-class-docstring)
     3	/Users/john/LabGymRepo/LabGym/detector.py:50:4: C0116: Missing function or method docstring (missing-function-docstring)
     4	/Users/john/LabGymRepo/LabGym/detector.py:50:4: R0913: Too many arguments (6/5) (too-many-arguments)
     5	/Users/john/LabGymRepo/LabGym/detector.py:50:4: R0917: Too many positional arguments (6/5) (too-many-positional-arguments)
     6	/Users/john/LabGymRepo/LabGym/detector.py:50:4: R0914: Too many local variables (19/15) (too-many-locals)
     7	/Users/john/LabGymRepo/LabGym/detector.py:71:34: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
     8	/Users/john/LabGymRepo/LabGym/detector.py:71:34: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
     9	/Users/john/LabGymRepo/LabGym/detector.py:112:8: C0200: Consider using enumerate instead of iterating with range and len (consider-using-enumerate)
    10	/Users/john/LabGymRepo/LabGym/detector.py:115:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
    11	/Users/john/LabGymRepo/LabGym/detector.py:126:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
    12	/Users/john/LabGymRepo/LabGym/detector.py:50:4: R0915: Too many statements (54/50) (too-many-statements)
    13	/Users/john/LabGymRepo/LabGym/detector.py:63:8: W0612: Unused variable 'datasetcat' (unused-variable)
    14	/Users/john/LabGymRepo/LabGym/detector.py:132:4: C0116: Missing function or method docstring (missing-function-docstring)
    15	/Users/john/LabGymRepo/LabGym/detector.py:132:4: R0914: Too many local variables (21/15) (too-many-locals)
    16	/Users/john/LabGymRepo/LabGym/detector.py:149:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
    17	/Users/john/LabGymRepo/LabGym/detector.py:174:19: E1121: Too many positional arguments for function call (too-many-function-args)
    18	/Users/john/LabGymRepo/LabGym/detector.py:174:19: E1125: Missing mandatory keyword argument 'mapper' in function call (missing-kwoa)
    19	/Users/john/LabGymRepo/LabGym/detector.py:178:12: W0212: Access to a protected member _results of a client class (protected-access)
    20	/Users/john/LabGymRepo/LabGym/detector.py:184:4: C0116: Missing function or method docstring (missing-function-docstring)
    21	/Users/john/LabGymRepo/LabGym/detector.py:191:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
    22	/Users/john/LabGymRepo/LabGym/detector.py:210:4: C0116: Missing function or method docstring (missing-function-docstring)
    23	/Users/john/LabGymRepo/LabGym/detector.py:35:0: C0411: third party import "torch" should be placed before local imports "detectron2.model_zoo", "detectron2.checkpoint.DetectionCheckpointer", "detectron2.config.get_cfg" (...) "detectron2.evaluation.COCOEvaluator", "detectron2.modeling.build_model", "detectron2.utils.visualizer.Visualizer" (wrong-import-order)
    24	
    25	------------------------------------------------------------------
    26	Your code has been rated at 7.66/10 (previous run: 7.66/10, +0.00)
    27

approx 11 warnings for gui_app_icon.py (6.49) could be reviewed.

     1	************* Module LabGym.gui_app_icon
     2	/Users/john/LabGymRepo/LabGym/gui_app_icon.py:19:0: W0105: String statement has no effect (pointless-string-statement)
     3	/Users/john/LabGymRepo/LabGym/gui_app_icon.py:59:8: R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
     4	/Users/john/LabGymRepo/LabGym/gui_app_icon.py:78:11: W0718: Catching too general exception Exception (broad-exception-caught)
     5	/Users/john/LabGymRepo/LabGym/gui_app_icon.py:93:11: W0718: Catching too general exception Exception (broad-exception-caught)
     6	/Users/john/LabGymRepo/LabGym/gui_app_icon.py:92:8: E0606: Possibly using variable 'ctypes' before assignment (possibly-used-before-assignment)
     7	/Users/john/LabGymRepo/LabGym/gui_app_icon.py:101:39: E0606: Possibly using variable 'NSApplication' before assignment (possibly-used-before-assignment)
     8	/Users/john/LabGymRepo/LabGym/gui_app_icon.py:112:11: W0718: Catching too general exception Exception (broad-exception-caught)
     9	/Users/john/LabGymRepo/LabGym/gui_app_icon.py:109:14: E0606: Possibly using variable 'NSImage' before assignment (possibly-used-before-assignment)
    10	
    11	------------------------------------------------------------------
    12	Your code has been rated at 6.49/10 (previous run: 6.49/10, +0.00)
    13	

@ruck94301
Copy link
Contributor Author

b22794c adds a config to pylintrc, namely, don't bother warning us about being unable to see names in AppKit.
This eliminates two false alarms in mywx/custom.py

mywx/custom.py:29:4: E0611: No name 'NSApp' in module 'AppKit' (no-name-in-module)
mywx/custom.py:29:4: E0611: No name 'NSApplication' in module 'AppKit' (no-name-in-module)

bringing its pylint score above 9.

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.

1 participant