diff options
author | Lars Wirzenius <liw@liw.fi> | 2015-04-18 17:06:52 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2015-04-18 17:13:28 +0300 |
commit | 5dce4e1d7000ab08e30ef71f874db0e40e8889b1 (patch) | |
tree | 5496bd992379c9b892a020d5f4104b66b933f236 | |
parent | 13aad69bcb3027e5d1b28ef8c1b316767e8b0b10 (diff) | |
download | distix-5dce4e1d7000ab08e30ef71f874db0e40e8889b1.tar.gz |
Run pylint as well as pep8 on the source; fix things
-rw-r--r-- | distixlib/plugins/import_mail_plugin.py | 4 | ||||
-rw-r--r-- | distixlib/structurederror.py | 5 | ||||
-rw-r--r-- | distixlib/ticket_saver_tests.py | 1 | ||||
-rw-r--r-- | pylint.conf | 29 | ||||
-rw-r--r-- | setup.py | 13 |
5 files changed, 46 insertions, 6 deletions
diff --git a/distixlib/plugins/import_mail_plugin.py b/distixlib/plugins/import_mail_plugin.py index e5bcfb0..080f5e4 100644 --- a/distixlib/plugins/import_mail_plugin.py +++ b/distixlib/plugins/import_mail_plugin.py @@ -64,7 +64,7 @@ class ImportMailPlugin(cliapp.Plugin): return email.message_from_file(f) def _import_msg_to_ticket_store( - self, repo, ticket_store, all_tickets, msg, cache): + self, repo, ticket_store, all_tickets, msg, cache): tickets = self._find_tickets_with_mails_referenced_by_msg( all_tickets, msg, cache) @@ -83,7 +83,7 @@ class ImportMailPlugin(cliapp.Plugin): return ticket_store.add_ticket(ticket) def _find_tickets_with_mails_referenced_by_msg( - self, all_tickets, msg, cache): + self, all_tickets, msg, cache): tickets = [] msg_ids = self._get_message_ids(msg) diff --git a/distixlib/structurederror.py b/distixlib/structurederror.py index 11e2491..bd73710 100644 --- a/distixlib/structurederror.py +++ b/distixlib/structurederror.py @@ -58,6 +58,7 @@ class StructuredError(Exception): ''' def __init__(self, **kwargs): + Exception.__init__(self) self.kwargs = kwargs @property @@ -80,8 +81,8 @@ class StructuredError(Exception): summer = hashlib.md5() summer.update(self.__class__.__name__) summer.update(self.__class__.__module__) - hash = summer.hexdigest()[:5] - return 'R{0}X'.format(hash.upper()) + hash_value = summer.hexdigest()[:5] + return 'R{0}X'.format(hash_value.upper()) def _format_msg(self, template): try: diff --git a/distixlib/ticket_saver_tests.py b/distixlib/ticket_saver_tests.py index cb63848..d2e680f 100644 --- a/distixlib/ticket_saver_tests.py +++ b/distixlib/ticket_saver_tests.py @@ -85,7 +85,6 @@ class TicketSaverTests(unittest.TestCase): loader = distixlib.TicketLoader() loaded_ticket = loader.load_from_directory(dirname) - metadata = loaded_ticket.get_ticket_metadata() self.assertEqual( self.serialise_ticket(self.ticket), self.serialise_ticket(loaded_ticket)) diff --git a/pylint.conf b/pylint.conf new file mode 100644 index 0000000..dc45d80 --- /dev/null +++ b/pylint.conf @@ -0,0 +1,29 @@ +[MASTER] +persistent=no + +[MESSAGES CONTROL] +disable= + attribute-defined-outside-init, + bad-builtin, + blacklisted-name, + cyclic-import, + fixme, + invalid-name, + missing-docstring, + no-self-use, + protected-access, + star-args, + too-few-public-methods, + too-many-arguments, + too-many-branches, + too-many-instance-attributes, + too-many-locals, + too-many-public-methods, + too-many-statements, + unused-argument + +[REPORTS] +reports=no + +[SIMILARITIES] +min-similarity-lines=999 @@ -33,12 +33,14 @@ class Check(Command): ('unit-tests', 'u', 'run unit tests?'), ('yarns', 'y', 'run yarn tests locally?'), ('pep8', '8', 'run pep8 on the source?'), + ('pylint', 'l', 'run pylint on the source?'), ] def set_all_options(self, new_value): self.unit_tests = new_value self.yarns = new_value self.pep8 = new_value + self.pylint = new_value def initialize_options(self): self.set_all_options(False) @@ -47,7 +49,8 @@ class Check(Command): any_set = ( self.unit_tests or self.yarns or - self.pep8) + self.pep8 or + self.pylint) if not any_set: self.set_all_options(True) @@ -61,6 +64,9 @@ class Check(Command): if self.pep8 and self.command_is_available('pep8'): self.run_pep8() + if self.pylint and self.command_is_available('pylint'): + self.run_pylint() + def run_unit_tests(self): cliapp.runcmd( ['python', '-m', 'CoverageTestRunner', @@ -81,6 +87,11 @@ class Check(Command): def run_pep8(self): cliapp.runcmd(['pep8', 'distixlib'], stdout=None, stderr=None) + def run_pylint(self): + cliapp.runcmd( + ['pylint', '--rcfile=pylint.conf', 'distixlib'], + stdout=None, stderr=None) + setup(name='distix', version=distixlib.version.version_string, |