8000 Pylint: global-statement, no-else-raise, unneccessary-pass · Issue #5 · adafruit/Adafruit_CircuitPython_RPLIDAR · GitHub
[go: up one dir, main page]

Skip to content
Pylint: global-statement, no-else-raise, unneccessary-pass #5
Closed
@evaherrada

Description

@evaherrada

Here's pylint's output:

************* Module adafruit_rplidar
adafruit_rplidar.py:108:0: R0205: Class 'RPLidar' inherits from object, can be safely removed from bases in python3 (useless-object-inheritance)
adafruit_rplidar.py:143:12: W0603: Using the global statement (global-statement)
adafruit_rplidar.py:144:12: C0415: Import outside toplevel (serial) (import-outside-toplevel)
adafruit_rplidar.py:239:8: R1720: Unnecessary "elif" after "raise" (no-else-raise)
adafruit_rplidar.py:314:8: W0107: Unnecessary pass statement (unnecessary-pass)

As far as the useless-object-inheritance goes, @brentru I should be able to do the same thing you did in adafruit/Adafruit_CircuitPython_CursorControl#17, correct?

For global-statement and import-outside-toplevel, here's the offending code:

140        if self.is_CP:
141            _serial_port = port
142        else:
143           global serial
144           import serial

If I understand correctly, this checks if the board is a circuitpython board and if it isn't, it imports serial, although I'm not sure why line 143 is necessary.

For no-else-raise:

239        if len(descriptor) != DESCRIPTOR_LEN:
240            raise RPLidarException("Descriptor length mismatch")
241        elif not descriptor.startswith(SYNC_BYTE + SYNC_BYTE2):
242            raise RPLidarException("Incorrect descriptor starting bytes")

I'm not sure why this is an issue, it makes sense to me why this would be done, although I don't understand this code well enough to make an informed decision on that.

For unneccessary-pass

314    def clear_input(self):
315       """Clears input buffer by reading all available data"""
316       pass

Unless there's some weird python mechanic I don't understand going on here, I think that this would be the right place to raise a NotImplementedError.

Referencing main issue: adafruit/Adafruit_CircuitPython_Bundle#232

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0