AmEv7Fam/familysearch-python-sdk-opensource

PyLint not happy

Closed this issue · 3 comments

So, I decided to run PyLint on the SDK, just to see what happened. Apparently... It could use some work... With a beginning score of -21.85/10, all I can say is, wow. I did so bad, I owe points! It still functions in the meantime, but it shows that us imperfect people are developing imperfect code.

This is the current results. I will edit below this line as I improve it.

pylint familysearch --disable=no-member,cyclic-import,import-error,missing-final-newline,undefined-variable

Why each of these?
*no-member, cyclic-import due to the deliberate nature of the SDK

  • import-error for simultaneous 2/3 support
  • missing-final-newline due to the files being generated cross-platform.
  • undefined-variable also part of nature of SDK, but to be used with caution.
************* Module familysearch
C:182, 0: Wrong hanging indentation.
    url, data, headers, "GET", nojson), nojson)

    ^       | (bad-continuation)
C:187, 0: Wrong hanging indentation.
    url, data, headers, "POST", nojson), nojson)

    ^       | (bad-continuation)
C:192, 0: Wrong hanging indentation.
    url, data, headers, "PUT", nojson), nojson)

    ^       | (bad-continuation)
C:197, 0: Wrong hanging indentation.
    url, data, headers, "HEAD", nojson), nojson)

    ^       | (bad-continuation)
C:202, 0: Wrong hanging indentation.
    url, data, headers, "OPTIONS", nojson), nojson)

    ^       | (bad-continuation)
C:207, 0: Wrong hanging indentation.
    url, data, headers, "DELETE", nojson), nojson)

    ^       | (bad-continuation)
C:214, 0: Trailing whitespace (trailing-whitespace)
C:214, 0: Exactly one space required after comma
              discussions_, memories_,parentsAndChildren_, ordinances_, 

                                     ^ (bad-whitespace)
E: 41, 4: No name 'urlencode' in module 'urllib' (no-name-in-module)
R: 51, 0: Too few public methods (1/2) (too-few-public-methods)
C: 68, 0: Missing class docstring (missing-docstring)
C: 68,22: More than one statement on a single line (multiple-statements)
R: 68, 0: Too few public methods (0/2) (too-few-public-methods)
R: 69, 0: Too many instance attributes (9/7) (too-many-instance-attributes)
R:102, 4: Too many arguments (6/5) (too-many-arguments)
C:131,12: Invalid variable name "eh" (invalid-name)
R:139, 4: Method could be a function (no-self-use)
R:151, 4: Method could be a function (no-self-use)
R:165, 4: Method could be a function (no-self-use)
************* Module familysearch.authentication_
W:100, 0: TODO: make IP address generiation automatic
 (fixme)
C: 44, 0: Wrong continued indentation.
                                 })

                                |^ (bad-continuation)
C: 48, 0: Wrong continued indentation.
                                 "Accept": "application/json"}, nojson=True)

                                 ^| (bad-continuation)
C: 65, 0: Wrong continued indentation.
                                     'client_id': self.key,

                                     ^     | (bad-continuation)
C: 66, 0: Wrong continued indentation.
                                     'redirect_uri': "http://localhost:63342/fslogin"

                                     ^     | (bad-continuation)
C: 67, 0: Wrong continued indentation.
                                     })

                                     ^    | (bad-continuation)
C: 82, 0: Wrong continued indentation.
                                  })

                                | ^ (bad-continuation)
C: 86, 0: Wrong continued indentation.
                                 "Accept": "application/json"}, nojson=True)

                                 ^| (bad-continuation)
C:100, 0: Line too long (103/100) (line-too-long)
C:103, 0: Wrong continued indentation.
                                 })

                                |^ (bad-continuation)
C:107, 0: Wrong continued indentation.
                                 "Accept": "application/json"}, nojson=True)

                                 ^| (bad-continuation)
E: 11, 4: No name 'urlencode' in module 'urllib' (no-name-in-module)
C: 20, 0: Missing class docstring (missing-docstring)
W: 49,13: Attribute 'session_id' defined outside __init__ (attribute-defined-outside-init)
W: 87,13: Attribute 'session_id' defined outside __init__ (attribute-defined-outside-init)
W:108,13: Attribute 'session_id' defined outside __init__ (attribute-defined-outside-init)
W:119,13: Attribute 'session_id' defined outside __init__ (attribute-defined-outside-init)
W: 37,13: Attribute 'logged_in' defined outside __init__ (attribute-defined-outside-init)
W: 50,13: Attribute 'logged_in' defined outside __init__ (attribute-defined-outside-init)
W: 60,13: Attribute 'logged_in' defined outside __init__ (attribute-defined-outside-init)
W: 88,13: Attribute 'logged_in' defined outside __init__ (attribute-defined-outside-init)
W: 97,13: Attribute 'logged_in' defined outside __init__ (attribute-defined-outside-init)
W:109,13: Attribute 'logged_in' defined outside __init__ (attribute-defined-outside-init)
W:116,13: Attribute 'logged_in' defined outside __init__ (attribute-defined-outside-init)
C:123, 0: Invalid class name "getter" (invalid-name)
C:123, 0: Missing class docstring (missing-docstring)
C:124, 4: Invalid method name "do_GET" (invalid-name)
C:130, 8: Invalid constant name "qs" (invalid-name)
W:130, 8: Global variable 'qs' undefined at the module level (global-variable-undefined)
R:123, 0: Too few public methods (1/2) (too-few-public-methods)
************* Module familysearch.authorities_
C:  3, 0: Trailing whitespace (trailing-whitespace)
R:  6, 0: Too few public methods (1/2) (too-few-public-methods)
************* Module familysearch.changeHistory_
C: 17, 0: Line too long (119/100) (line-too-long)
C: 22, 0: Line too long (107/100) (line-too-long)
C:  1, 0: Invalid module name "changeHistory_" (invalid-name)
W: 14,72: Missing keyword argument 'pid' for format string (missing-format-argument-key)
************* Module familysearch.discovery_
W: 10, 0: TODO: Set it up so that it doesn't need to call the sumbodules
 (fixme)
W: 19, 0: Bad indentation. Found 12 spaces, expected 8 (bad-indentation)
C: 18, 4: Missing method docstring (missing-docstring)
W: 29,16: No exception type(s) specified (bare-except)
E: 28, 0: Sequence index is not an int, slice, or instance with __index__ (invalid-sequence-index)
W: 37, 8: No exception type(s) specified (bare-except)
************* Module familysearch.discussions_
W: 11, 8: Unnecessary pass statement (unnecessary-pass)
************* Module familysearch.memories_
C: 27, 0: Trailing whitespace (trailing-whitespace)
C: 31, 0: Trailing whitespace (trailing-whitespace)
************* Module familysearch.ordinances_
C: 11, 0: Trailing whitespace (trailing-whitespace)
R:  6, 0: Too few public methods (0/2) (too-few-public-methods)
************* Module familysearch.parentsAndChildren_
C: 12, 0: Line too long (103/100) (line-too-long)
C: 16, 0: Line too long (110/100) (line-too-long)
C: 20, 0: Line too long (114/100) (line-too-long)
C: 22, 0: Wrong hanging indentation.
        self.child_base + crid + "/" + role + "/conclusions/" + cid)

        ^   | (bad-continuation)
C: 23, 0: Trailing whitespace (trailing-whitespace)
C: 25, 0: Line too long (109/100) (line-too-long)
C: 27, 0: Trailing whitespace (trailing-whitespace)
C: 29, 0: Line too long (109/100) (line-too-long)
C: 33, 0: Line too long (111/100) (line-too-long)
C:  1, 0: Invalid module name "parentsAndChildren_" (invalid-name)
C:  6, 0: Missing class docstring (missing-docstring)
E: 28, 4: method already defined line 24 (function-redefined)
************* Module familysearch.pedigree_
C:  6, 0: Missing class docstring (missing-docstring)
W: 11,28: Unused argument 'query' (unused-argument)
************* Module familysearch.person_
C: 32, 0: Line too long (104/100) (line-too-long)
C: 50, 0: Trailing whitespace (trailing-whitespace)
C: 58, 0: Trailing whitespace (trailing-whitespace)
C: 68, 0: Line too long (101/100) (line-too-long)
C: 72, 0: Line too long (101/100) (line-too-long)
C: 92, 0: Line too long (102/100) (line-too-long)
C: 97, 0: Line too long (102/100) (line-too-long)
C:  6, 0: Missing class docstring (missing-docstring)
W: 11,22: Unused argument 'data' (unused-argument)
W:113,39: Unused argument 'pid' (unused-argument)
W:117,31: Unused argument 'pid' (unused-argument)
R:  6, 0: Too many public methods (27/20) (too-many-public-methods)
************* Module familysearch.places_
C: 29, 0: Line too long (101/100) (line-too-long)
************* Module familysearch.records_
C: 15, 0: Trailing whitespace (trailing-whitespace)
R:  6, 0: Too few public methods (0/2) (too-few-public-methods)
************* Module familysearch.searchAndMatch_
C: 10, 0: Trailing whitespace (trailing-whitespace)
C:  1, 0: Invalid module name "searchAndMatch_" (invalid-name)
************* Module familysearch.sources_
C: 29, 0: Line too long (109/100) (line-too-long)
C: 28, 4: Invalid method name "source_folder_source_descriptions" (invalid-name)
************* Module familysearch.spouses_
C: 21, 0: Line too long (103/100) (line-too-long)
C: 23, 0: Trailing whitespace (trailing-whitespace)
************* Module familysearch.user_
C: 16, 0: Trailing whitespace (trailing-whitespace)
C:  8, 0: Missing class docstring (missing-docstring)
************* Module familysearch.utilities_
C: 20, 0: Wrong hanging indentation.
          self.base + "platform/redirect", params, **kwargs)

          ^ | (bad-continuation)
C:  6, 0: Missing class docstring (missing-docstring)
W: 18,22: Used * or ** magic (star-args)
************* Module familysearch.vocabularies_
C: 19, 0: Trailing whitespace (trailing-whitespace)

Report

448 statements analysed.

Duplication

now previous difference
nb duplicated lines 0 0 =
percent duplicated lines 0.000 0.000 =

Duplication

Statistics by type

|type |number |old number |difference |%documented |%badname |
|module |19 |19 |= |100.00 |15.79 |
|class |22 |22 |= |63.64 |4.55 |
|method |125 |125 |= |99.20 |1.60 |
|function |0 |0 |= |0 |0 |

Raw metrics

|code |649 |56.43 |648 |+1.00 |
|docstring |296 |25.83 |296 |-1.00 |
|comment |61 |5.30 |58 |+3.00 |
|empty |143 |12.43 |141 |-2.00 |

Messages by category

type number previous difference
code 491 54.98 491
docstring 252 28.22 252
comment 33 3.70 33
empty 117 13.10 117

% errors / warnings by module

module error warning refactor convention
familysearch.authentication_ 25.00 54.17 8.33 22.39
familysearch.discovery_ 25.00 16.67 0.00 1.49
familysearch 25.00 0.00 58.33 16.42
familysearch.parentsAndChildren_ 25.00 0.00 0.00 16.42
familysearch.person_ 0.00 12.50 8.33 11.94
familysearch.changeHistory_ 0.00 4.17 0.00 4.48
familysearch.utilities_ 0.00 4.17 0.00 2.99
familysearch.pedigree_ 0.00 4.17 0.00 1.49
familysearch.discussions_ 0.00 4.17 0.00 0.00
familysearch.records_ 0.00 0.00 8.33 1.49
familysearch.ordinances_ 0.00 0.00 8.33 1.49
familysearch.authorities_ 0.00 0.00 8.33 1.49
familysearch.user_ 0.00 0.00 0.00 2.99
familysearch.spouses_ 0.00 0.00 0.00 2.99
familysearch.sources_ 0.00 0.00 0.00 2.99
familysearch.searchAndMatch_ 0.00 0.00 0.00 2.99
familysearch.memories_ 0.00 0.00 0.00 2.99
familysearch.vocabularies_ 0.00 0.00 0.00 1.49
familysearch.places_ 0.00 0.00 0.00 1.49

Messages

message id occurrences
line-too-long 17
bad-continuation 17
trailing-whitespace 14
attribute-defined-outside-init 11
missing-docstring 9
invalid-name 8
too-few-public-methods 6
unused-argument 4
no-self-use 3
no-name-in-module 2
fixme 2
bare-except 2
unnecessary-pass 1
too-many-public-methods 1
too-many-instance-attributes 1
too-many-arguments 1
star-args 1
multiple-statements 1
missing-format-argument-key 1
invalid-sequence-index 1
global-variable-undefined 1
function-redefined 1
bad-whitespace 1
bad-indentation 1

External dependencies

::

familysearch (familysearch.sources_,familysearch.authorities_,familysearch.places_,familysearch.records_,familysearch.vocabularies_,familysearch.changeHistory_,familysearch.utilities_,familysearch.ordinances_,familysearch.discussions_,familysearch.parentsAndChildren_,familysearch.discovery_,familysearch.sourceBox_,familysearch.searchAndMatch_,familysearch.spouses_,familysearch.memories_,familysearch.notes_,familysearch.pedigree_,familysearch.user_,familysearch.authentication_,familysearch.person_) 
  \-authentication_ (familysearch) 
  \-authorities_ (familysearch) 
  \-changeHistory_ (familysearch) 
  \-discovery_ (familysearch) 
  \-discussions_ (familysearch) 
  \-memories_ (familysearch) 
  \-notes_ (familysearch) 
  \-ordinances_ (familysearch) 
  \-parentsAndChildren_ (familysearch) 
  \-pedigree_ (familysearch) 
  \-person_ (familysearch) 
  \-places_ (familysearch) 
  \-records_ (familysearch) 
  \-searchAndMatch_ (familysearch) 
  \-sourceBox_ (familysearch) 
  \-sources_ (familysearch) 
  \-spouses_ (familysearch) 
  \-user_ (familysearch) 
  \-utilities_ (familysearch) 
http  
  \-server (familysearch.authentication_) 
json (familysearch) 
urllib (familysearch.authentication_,familysearch) 
  \-error (familysearch) 
  \-parse (familysearch.authentication_,familysearch) 
  \-request (familysearch.authentication_,familysearch) 
webbrowser (familysearch.authentication_) 

Global evaluation

Your code has been rated at 7.25/10 (previous run: 6.92/10, +0.33)

I think there are some things that may need to be disabled (such as cyclic dependencies and the no-members, as this is a case where having everything in one file would create a huge file, but we don't need a fs.person.post_person_memory(), just fs.post_person_memory()). The import errors are Python 2 imports, which Python 3 will never touch, so that also needs to be disabled.

The biggest thing I get from this is, is that I may need a smidgeon more documentation.

Well, the redux definitely fixed a lot of this! Closing, as happy with PyLint rating for now!