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

Pylint warnings #307

Open
1 task
JamesParrott opened this issue Sep 19, 2024 · 0 comments
Open
1 task

Pylint warnings #307

JamesParrott opened this issue Sep 19, 2024 · 0 comments

Comments

@JamesParrott
Copy link
Collaborator

JamesParrott commented Sep 19, 2024

Describe the feature request

Great to have. The broad except:s in particular should be made more specific.

pylint --disable=R,C,E *shapefile.py 
************* Module shapefile
shapefile.py:1870:13: W0511: TODO: internal __record method should be faster but would have to (fixme)
shapefile.py:186:12: W0702: No exception type(s) specified (bare-except)
shapefile.py:342:4: W0120: Else clause on loop without a break statement, remove the else and de-indent all the code inside it (useless-else-on-loop)
shapefile.py:343:8: W0719: Raising too general exception: Exception (broad-exception-raised)
shapefile.py:552:16: W0120: Else clause on loop without a break statement, remove the else and de-indent all the code inside it (useless-else-on-loop)
shapefile.py:613:12: W0719: Raising too general exception: Exception (broad-exception-raised)
shapefile.py:639:12: W0719: Raising too general exception: Exception (broad-exception-raised)
shapefile.py:1374:12: W0201: Attribute 'bbox' defined outside __init__ (attribute-defined-outside-init)
shapefile.py:1400:12: W0201: Attribute 'z' defined outside __init__ (attribute-defined-outside-init)
shapefile.py:1427:12: W0201: Attribute 'z' defined outside __init__ (attribute-defined-outside-init)
shapefile.py:1407:16: W0201: Attribute 'm' defined outside __init__ (attribute-defined-outside-init)
shapefile.py:1414:16: W0201: Attribute 'm' defined outside __init__ (attribute-defined-outside-init)
shapefile.py:1436:16: W0201: Attribute 'm' defined outside __init__ (attribute-defined-outside-init)
shapefile.py:1438:16: W0201: Attribute 'm' defined outside __init__ (attribute-defined-outside-init)
shapefile.py:761:12: W0707: Consider explicitly re-raising using 'except KeyError as exc' and 'raise AttributeError('{} is not a field name'.format(item)) from exc' (raise-missing-from)
shapefile.py:763:12: W0707: Consider explicitly re-raising using 'except IndexError as exc' and 'raise IndexError('{} found as a field but not enough values available.'.format(item)) from exc' (raise-missing-from)
shapefile.py:781:12: W0707: Consider explicitly re-raising using 'except KeyError as exc' and 'raise AttributeError('{} is not a field name'.format(key)) from exc' (raise-missing-from)
shapefile.py:820:16: W0707: Consider explicitly re-raising using 'except TypeError as exc' and 'raise IndexError('{} is not a field name and not an int'.format(key)) from exc' (raise-missing-from)
shapefile.py:918:4: W0107: Unnecessary pass statement (unnecessary-pass)
shapefile.py:1034:28: W0702: No exception type(s) specified (bare-except)
shapefile.py:1039:20: W0702: No exception type(s) specified (bare-except)
shapefile.py:1192:20: W0621: Redefining name 'unpack' from outer scope (line 20) (redefined-outer-name)
shapefile.py:1198:25: W0612: Unused variable 'recNum' (unused-variable)
shapefile.py:1235:24: W0612: Unused variable 'ext' (unused-variable)
shapefile.py:1366:8: W0622: Redefining built-in 'next' (redefined-builtin)
shapefile.py:1363:27: W0612: Unused variable 'zmin' (unused-variable)
shapefile.py:1363:34: W0612: Unused variable 'zmax' (unused-variable)
shapefile.py:1363:41: W0612: Unused variable 'mmin' (unused-variable)
shapefile.py:1363:48: W0612: Unused variable 'mmax' (unused-variable)
shapefile.py:1364:9: W0612: Unused variable 'recNum' (unused-variable)
shapefile.py:1500:12: W0621: Redefining name 'unpack' from outer scope (line 20) (redefined-outer-name)
shapefile.py:1508:17: W0612: Unused variable 'recNum' (unused-variable)
shapefile.py:1590:12: W0612: Unused variable 'field' (unused-variable)
shapefile.py:1619:8: W0612: Unused variable 'fieldTuples' (unused-variable)
shapefile.py:1661:17: W0612: Unused variable 'fmtSize' (unused-variable)
shapefile.py:1752:20: W0702: No exception type(s) specified (bare-except)
shapefile.py:1710:13: W0612: Unused variable 'name' (unused-variable)
shapefile.py:1710:24: W0612: Unused variable 'size' (unused-variable)
shapefile.py:1345:8: W0201: Attribute 'shapeType' defined outside __init__ (attribute-defined-outside-init)
shapefile.py:1347:8: W0201: Attribute 'bbox' defined outside __init__ (attribute-defined-outside-init)
shapefile.py:1349:8: W0201: Attribute 'zbox' defined outside __init__ (attribute-defined-outside-init)
shapefile.py:1351:8: W0201: Attribute 'mbox' defined outside __init__ (attribute-defined-outside-init)
shapefile.py:1585:46: W0201: Attribute '__recordLength' defined outside __init__ (attribute-defined-outside-init)
shapefile.py:1620:8: W0201: Attribute '__fullRecStruct' defined outside __init__ (attribute-defined-outside-init)
shapefile.py:1621:8: W0201: Attribute '__fullRecLookup' defined outside __init__ (attribute-defined-outside-init)
shapefile.py:1894:16: W0719: Raising too general exception: Exception (broad-exception-raised)
shapefile.py:1911:12: W0719: Raising too general exception: Exception (broad-exception-raised)
shapefile.py:2038:12: W0719: Raising too general exception: Exception (broad-exception-raised)
shapefile.py:2148:16: W0707: Consider explicitly re-raising using 'except error as exc' and 'raise ShapefileException('Failed to write shapefile bounding box. Floats required.') from exc' (raise-missing-from)
shapefile.py:2177:12: W0707: Consider explicitly re-raising using 'except error as exc' and 'raise ShapefileException('Failed to write shapefile elevation and measure values. Floats required.') from exc' (raise-missing-from)
shapefile.py:2238:16: W0719: Raising too general exception: Exception (broad-exception-raised)
shapefile.py:2259:12: W0719: Raising too general exception: Exception (broad-exception-raised)
shapefile.py:2273:16: W0707: Consider explicitly re-raising using 'except error as exc' and 'raise ShapefileException('Failed to write bounding box for record %s. Expected floats.' % self.shpNum) from exc' (raise-missing-from)
shapefile.py:2298:16: W0707: Consider explicitly re-raising using 'except error as exc' and 'raise ShapefileException('Failed to write points for record %s. Expected floats.' % self.shpNum) from exc' (raise-missing-from)
shapefile.py:2308:16: W0707: Consider explicitly re-raising using 'except error as exc' and 'raise ShapefileException('Failed to write elevation extremes for record %s. Expected floats.' % self.shpNum) from exc' (raise-missing-from)
shapefile.py:2318:20: W0106: Expression "[f.write(pack('<d', p[2] if len(p) > 2 else 0)) for p in s.points]" is assigned to nothing (expression-not-assigned)
shapefile.py:2320:16: W0707: Consider explicitly re-raising using 'except error as exc' and 'raise ShapefileException('Failed to write elevation values for record %s. Expected floats.' % self.shpNum) from exc' (raise-missing-from)
shapefile.py:2331:16: W0707: Consider explicitly re-raising using 'except error as exc' and 'raise ShapefileException('Failed to write measure extremes for record %s. Expected floats' % self.shpNum) from exc' (raise-missing-from)
shapefile.py:2350:20: W0106: Expression "[f.write(pack('<d', p[mpos] if len(p) > mpos and p[mpos] is not None else NODATA)) for p in s.points]" is assigned to nothing (expression-not-assigned)
shapefile.py:2362:16: W0707: Consider explicitly re-raising using 'except error as exc' and 'raise ShapefileException('Failed to write measure values for record %s. Expected floats' % self.shpNum) from exc' (raise-missing-from)
shapefile.py:2371:16: W0707: Consider explicitly re-raising using 'except error as exc' and 'raise ShapefileException('Failed to write point for record %s. Expected floats.' % self.shpNum) from exc' (raise-missing-from)
shapefile.py:2388:20: W0707: Consider explicitly re-raising using 'except error as exc' and 'raise ShapefileException('Failed to write elevation value for record %s. Expected floats.' % self.shpNum) from exc' (raise-missing-from)
shapefile.py:2399:20: W0707: Consider explicitly re-raising using 'except error as exc' and 'raise ShapefileException('Failed to write elevation value for record %s. Expected floats.' % self.shpNum) from exc' (raise-missing-from)
shapefile.py:2416:20: W0707: Consider explicitly re-raising using 'except error as exc' and 'raise ShapefileException('Failed to write measure value for record %s. Expected floats.' % self.shpNum) from exc' (raise-missing-from)
shapefile.py:2431:20: W0707: Consider explicitly re-raising using 'except error as exc' and 'raise ShapefileException('Failed to write measure value for record %s. Expected floats.' % self.shpNum) from exc' (raise-missing-from)
shapefile.py:2450:12: W0707: Consider explicitly re-raising using 'except error as exc' and 'raise ShapefileException('The .shp file has reached its file size limit > 4294967294 bytes (4.29 GB). To fix this, break up your file into multiple smaller ones.') from exc' (raise-missing-from)
shapefile.py:2779:8: W0621: Redefining name 'test' from outer scope (line 2754) (redefined-outer-name)
shapefile.py:2786:4: W0621: Redefining name 'failure_count' from outer scope (line 2805) (redefined-outer-name)
shapefile.py:2786:19: W0612: Unused variable 'test_count' (unused-variable)
shapefile.py:2801:4: W0105: String statement has no effect (pointless-string-statement)

------------------------------------------------------------------
Your code has been rated at 9.68/10 (previous run: 9.82/10, -0.14)

https://github.com/GeospatialPython/pyshp/actions/runs/10946054033/job/30391645722

Contributions

  • I am interested in implementing the described feature request and submit as a PR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant