From a0bc0dcb7d3b3fd4ec7716429bd1914756ba201d Mon Sep 17 00:00:00 2001 From: Amrith Kumar Date: Fri, 9 Sep 2016 09:33:49 -0400 Subject: [PATCH] initial chkin of pylint this is a pylint wrapper for Trove's tox tests. This commit includes a basic infrastructure for running pylint through tox. It also fixes some very obvious import errors that are flagged by the tool. One is to handle missing imports for _ and _LE. There is one instance where an exception is being raised but trove.common.exception isn't imported, and another where an exception is being incorrectly thrown. A short readme is also provided. Change-Id: I0a38f5efde3cb491f1f6c27f6c6500ab29987968 Partial-Bug: #1621636 --- pylintrc | 7 + test-requirements.txt | 2 + tools/trove-pylint.README | 167 ++ tools/trove-pylint.config | 2504 +++++++++++++++++ tools/trove-pylint.py | 339 +++ tox.ini | 8 +- trove/common/cfg.py | 1 + trove/common/debug_utils.py | 1 + trove/datastore/models.py | 1 + .../datastore/experimental/mariadb/service.py | 1 + .../datastore/experimental/percona/service.py | 2 + .../experimental/postgresql/pgutil.py | 1 + .../experimental/postgresql/service/status.py | 1 + .../restore/experimental/couchbase_impl.py | 1 + .../restore/experimental/postgresql_impl.py | 3 +- 15 files changed, 3036 insertions(+), 3 deletions(-) create mode 100644 pylintrc create mode 100644 tools/trove-pylint.README create mode 100644 tools/trove-pylint.config create mode 100755 tools/trove-pylint.py diff --git a/pylintrc b/pylintrc new file mode 100644 index 0000000000..4085cd38f1 --- /dev/null +++ b/pylintrc @@ -0,0 +1,7 @@ +# pylintrc +# +# For trove we use the defaults, this file is just to shut up an +# annoying error message from pylint. +# +# Don't set pylint options here. +# diff --git a/test-requirements.txt b/test-requirements.txt index 8a64f0a397..f73ff01eb1 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -28,3 +28,5 @@ cassandra-driver!=3.6.0,>=2.1.4 # Apache-2.0 pycrypto>=2.6 # Public Domain couchdb>=0.8 # Apache-2.0 os-testr>=0.7.0 # Apache-2.0 +astroid<1.4.0 # LGPLv2.1 # breaks pylint 1.4.4 +pylint==1.4.5 # GPLv2 diff --git a/tools/trove-pylint.README b/tools/trove-pylint.README new file mode 100644 index 0000000000..52baa98490 --- /dev/null +++ b/tools/trove-pylint.README @@ -0,0 +1,167 @@ +trove-pylint +------------ + +trove-pylint.py is a wrapper around pylint which allows for some +custom processing relevant to the trove source tree, and suitable to +run as a CI job for trove. + +The purpose is to perform a lint check on the code and detect obvious +(lintable) errors and fix them. + +How trove-pylint works +---------------------- + +trove-pylint is driven by a configuration file which is by default, +located in tools/trove-pylint.config. This file is a json dump of the +configuration. A default configuraiton file looks like this. + + { + "include": ["*.py"], + "folder": "trove", + "options": ["--rcfile=./pylintrc", "-E"], + "ignored_files": ['trove/tests'], + "ignored_codes": [], + "ignored_messages": [], + "ignored_file_codes": [], + "ignored_file_messages": [], + "ignored_file_code_messages": [], + "always_error_messages": [ + "Undefined variable '_'", + "Undefined variable '_LE'", + "Undefined variable '_LI'", + "Undefined variable '_LW'", + "Undefined variable '_LC'" + ] + } + +include +------- + + Provide a list of match specs (passed to fnmatch.fnmatch). The + default is only "*.py". + +folder +------ + + Provide the name of the top level folder to lint. This is a single + value. + +options +------- + + These are the pylint launch options. The default is to specify an + rcfile and only errors. Specifying the rcfile is required, and the + file is a dummy, to suppress an annoying warning. + +ignored_files +------------- + + This is a list of paths that we wish to ignore. When a file is + considered for linting, if the path name begins with any of these + provided prefixes, the file will not be linted. We ignore the + tests directory because it has a high instance of false positives. + +ignored_codes, ignored_messages, ignored_file_codes, +ignored_file_messages, and ignored_file_code_messages +----------------------------------------------------- + + These settings identify specific failures that are to be + ignored. Each is a list, some are lists of single elements, others + are lists of lists. + + ignored_codes, and ignored_messages are lists of single elements + that are to be ignored. You could specify either the code name, or + the code numeric representation. You must specify the exact + message. + + ignored_file_codes and ignored_file_messages are lists of lists + where each element is a code and a message. + + ignored_file_code_messages is a list of lists where each element + consists of a filename, an errorcode, a message, a line number and + a function name. + +always_error_messages +--------------------- + + This is a list of messages which have a low chance of false + positives, which are always flagged as errors. + +Using trove-pylint +------------------ + +You can check your code for errors by simply running: + + tox -e pylint + +The equivalent result can be obtained by running the command: + + tools/trove-pylint.py + +or + + tools/trove-pylint.py check + + +For example, here is the result from such a run. + + $ tools/trove-pylint.py check + ERROR: trove/common/extensions.py 575: E1003 bad-super-call, \ + TroveExtensionMiddleware.__init__: Bad first argument \ + 'ExtensionMiddleware' given to super() + Check failed. 367 files processed, 1 had errors, 1 errors recorded. + +I wish to ignore this error and keep going. To do this, I rebuild the +list of errors to ignore as follows. + + $ tools/trove-pylint.py rebuild + Rebuild completed. 367 files processed, 177 exceptions recorded. + +This caused the tool to add the following two things to the config file. + + [ + "trove/common/extensions.py", + "E1003", + "Bad first argument 'ExtensionMiddleware' given to super()", + "575", + "TroveExtensionMiddleware.__init__" + ], + [ + "trove/common/extensions.py", + "bad-super-call", + "Bad first argument 'ExtensionMiddleware' given to super()", + "575", + "TroveExtensionMiddleware.__init__" + ], + +With that done, I can recheck as shown below. + + $ tools/trove-pylint.py check + Check succeeded. 367 files processed + +You can review the errors that are being currently ignored by reading +the file tools/trove-pylint.config. + +If you want to fix some of these errors, identify the configuration(s) +that are causing those errors to be ignored and re-run the check. Once +you see that the errors are in fact being reported by the tool, go +ahead and fix the problem(s) and retest. + +Known issues +------------ + +1. The tool appears to be very sensitive to the version(s) of pylint +and astroid. In testing, I've found that if the version of either of +these changes, you could either have a failure of the tool (exceptions +thrown, ...) or a different set of errors reported. + +Currently, test-requirements.txt sets these versions in this way. + +astroid<1.4.0 # LGPLv2.1 # breaks pylint 1.4.4 +pylint==1.4.5 # GPLv2 + +If you run the tool on your machine and find that there are no errors, +but find that either the CI generates errors, or that the tool run +through tox generates errors, check what versions of astroid and +pylint are being run in each configuration. + diff --git a/tools/trove-pylint.config b/tools/trove-pylint.config new file mode 100644 index 0000000000..b899ba25e8 --- /dev/null +++ b/tools/trove-pylint.config @@ -0,0 +1,2504 @@ +{ + "ignored_file_code_messages": [ + [ + "trove/db/sqlalchemy/migrate_repo/versions/008_add_instance_fields.py", + "E1101", + "Instance of 'Table' has no 'drop_column' member", + "40", + "downgrade" + ], + [ + "trove/common/extensions.py", + "E1101", + "Module 'lxml.etree' has no 'tostring' member", + "505", + "ExtensionsXMLSerializer._to_xml" + ], + [ + "trove/backup/models.py", + "E1101", + "Instance of 'DBBackup' has no 'location' member", + "343", + "DBBackup.check_swift_object_exist" + ], + [ + "trove/guestagent/strategies/restore/experimental/postgresql_impl.py", + "E1101", + "Instance of 'Popen' has no 'stdin' member", + "73", + "PgDump._execute_postgres_restore" + ], + [ + "trove/module/models.py", + "E1101", + "Class 'DBModule' has no 'datastore_id' member", + "102", + "Modules.add_datastore_filter" + ], + [ + "trove/guestagent/strategies/restore/base.py", + "no-member", + "Instance of 'Popen' has no 'stdin' member", + "88", + "RestoreRunner._unpack" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/009_add_deleted_flag_to_instances.py", + "no-member", + "Instance of 'Table' has no 'drop_column' member", + "39", + "downgrade" + ], + [ + "trove/quota/quota.py", + "no-member", + "Class 'Enum' has no 'ROLLEDBACK' member", + "218", + "DbQuotaDriver.rollback" + ], + [ + "trove/module/models.py", + "E1101", + "Class 'DBModule' has no 'datastore_version_id' member", + "107", + "Modules.add_ds_version_filter" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/016_add_datastore_type.py", + "no-member", + "Instance of 'Table' has no 'create_column' member", + "60", + "upgrade" + ], + [ + "trove/guestagent/strategies/restore/base.py", + "no-member", + "Instance of 'Popen' has no 'stdin' member", + "90", + "RestoreRunner._unpack" + ], + [ + "trove/taskmanager/manager.py", + "E1101", + "Instance of 'BuiltInstance' has no 'restart' member", + "80", + "Manager.restart" + ], + [ + "trove/extensions/security_group/models.py", + "no-member", + "Instance of 'SecurityGroupRule' has no 'id' member", + "178", + "SecurityGroupRule.delete" + ], + [ + "trove/taskmanager/models.py", + "E1123", + "Unexpected keyword argument 'recover_func' in method call", + "1672", + "ResizeVolumeAction._resize_active_volume" + ], + [ + "trove/taskmanager/models.py", + "no-member", + "Instance of 'ResizeActionBase' has no '_assert_nova_action_was_successful' member", + "1826", + "ResizeActionBase._perform_nova_action" + ], + [ + "trove/module/models.py", + "E1101", + "Class 'DBModule' has no 'tenant_id' member", + "67", + "Modules.load" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/007_add_volume_flavor.py", + "E1101", + "Instance of 'Table' has no 'create_column' member", + "33", + "upgrade" + ], + [ + "trove/backup/models.py", + "no-member", + "Class 'DBBackup' has no 'state' member", + "140", + "Backup.running" + ], + [ + "trove/module/models.py", + "E1101", + "Class 'DBModule' has no 'id' member", + "126", + "Modules.load_by_ids" + ], + [ + "trove/module/models.py", + "E1101", + "Class 'DBModule' has no 'tenant_id' member", + "96", + "Modules.add_tenant_filter" + ], + [ + "trove/backup/models.py", + "no-member", + "Instance of 'BuiltInstance' has no 'validate_can_perform_action' member", + "73", + "Backup.create._create_resources" + ], + [ + "trove/configuration/models.py", + "E1101", + "Instance of 'DBConfigurationParameter' has no 'configuration_key' member", + "238", + "DBConfigurationParameter.__hash__" + ], + [ + "trove/taskmanager/manager.py", + "no-member", + "Instance of 'BuiltInstance' has no 'restart' member", + "80", + "Manager.restart" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/016_add_datastore_type.py", + "no-member", + "Instance of 'Table' has no 'drop_column' member", + "80", + "downgrade" + ], + [ + "trove/extensions/security_group/models.py", + "no-member", + "Instance of 'SecurityGroupRule' has no 'group_id' member", + "171", + "SecurityGroupRule.get_security_group" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/032_clusters.py", + "E1101", + "Instance of 'Table' has no 'drop_column' member", + "92", + "downgrade" + ], + [ + "trove/backup/models.py", + "no-member", + "Instance of 'DBBackup' has no 'location' member", + "324", + "DBBackup.filename" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/017_update_datastores.py", + "no-member", + "Instance of 'Table' has no 'create_column' member", + "44", + "upgrade" + ], + [ + "trove/taskmanager/manager.py", + "no-member", + "Instance of 'BuiltInstance' has no 'migrate' member", + "251", + "Manager.migrate" + ], + [ + "trove/guestagent/strategies/backup/base.py", + "no-member", + "Instance of 'Popen' has no 'stdout' member", + "136", + "BackupRunner.read" + ], + [ + "trove/module/models.py", + "E1101", + "Class 'DBModule' has no 'datastore_version_id' member", + "108", + "Modules.add_ds_version_filter" + ], + [ + "trove/backup/models.py", + "no-member", + "Instance of 'DBBackup' has no 'state' member", + "312", + "DBBackup.is_done" + ], + [ + "trove/common/extensions.py", + "no-member", + "Module 'lxml.etree' has no 'Element' member", + "479", + "ExtensionsXMLSerializer.index" + ], + [ + "trove/taskmanager/models.py", + "E1101", + "Instance of 'str' has no 'render' member", + "735", + "FreshInstanceTasks._create_server_volume_heat" + ], + [ + "trove/extensions/common/service.py", + "no-member", + "Instance of 'DefaultRootController' has no '_find_root_user' member", + "97", + "DefaultRootController.root_delete" + ], + [ + "trove/module/models.py", + "no-member", + "Class 'DBModule' has no 'id' member", + "126", + "Modules.load_by_ids" + ], + [ + "trove/backup/models.py", + "no-member", + "Instance of 'DBBackup' has no 'location' member", + "343", + "DBBackup.check_swift_object_exist" + ], + [ + "trove/taskmanager/manager.py", + "no-member", + "Instance of 'BuiltInstance' has no 'unassign_configuration' member", + "388", + "Manager.unassign_configuration" + ], + [ + "trove/common/extensions.py", + "E1101", + "Module 'lxml.etree' has no 'Element' member", + "492", + "ExtensionsXMLSerializer._populate_ext" + ], + [ + "trove/guestagent/datastore/experimental/cassandra/service.py", + "no-name-in-module", + "No name 'NoHostAvailable' in module 'cassandra.cluster'", + "22", + null + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/017_update_datastores.py", + "E1101", + "Instance of 'Table' has no 'create_column' member", + "63", + "downgrade" + ], + [ + "trove/guestagent/strategies/restore/experimental/postgresql_impl.py", + "no-member", + "Instance of 'Popen' has no 'stdin' member", + "71", + "PgDump._execute_postgres_restore" + ], + [ + "trove/backup/models.py", + "E1101", + "Instance of 'DBBackup' has no 'location' member", + "325", + "DBBackup.filename" + ], + [ + "trove/common/extensions.py", + "E1003", + "Bad first argument 'ExtensionMiddleware' given to super()", + "575", + "TroveExtensionMiddleware.__init__" + ], + [ + "trove/module/models.py", + "no-member", + "Class 'DBModule' has no 'datastore_id' member", + "102", + "Modules.add_datastore_filter" + ], + [ + "trove/guestagent/datastore/experimental/postgresql/service/config.py", + "E1101", + "Instance of 'PgSqlConfig' has no 'configuration_manager' member", + "125", + "PgSqlConfig.start_db_with_conf_changes" + ], + [ + "trove/backup/models.py", + "E1101", + "Class 'DBBackup' has no 'state' member", + "248", + "Backup.fail_for_instance" + ], + [ + "trove/guestagent/datastore/experimental/postgresql/service/config.py", + "E1101", + "Instance of 'PgSqlConfig' has no 'configuration_manager' member", + "102", + "PgSqlConfig.update_overrides" + ], + [ + "trove/common/wsgi.py", + "E0102", + "class already defined line 43", + "152", + "Router" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/031_add_timestamps_to_configurations.py", + "E1101", + "Instance of 'Table' has no 'create_column' member", + "27", + "upgrade" + ], + [ + "trove/cmd/fakemode.py", + "E0602", + "Undefined variable 'os'", + "37", + "main" + ], + [ + "trove/taskmanager/manager.py", + "E1101", + "Instance of 'BuiltInstance' has no 'resize_flavor' member", + "68", + "Manager.resize_flavor" + ], + [ + "trove/extensions/common/service.py", + "E1101", + "Instance of 'DefaultRootController' has no '_find_root_user' member", + "97", + "DefaultRootController.root_delete" + ], + [ + "trove/taskmanager/manager.py", + "no-member", + "Instance of 'BuiltInstance' has no 'resize_flavor' member", + "68", + "Manager.resize_flavor" + ], + [ + "trove/common/utils.py", + "invalid-slice-index", + "Slice index is not an int, None, or instance with __index__", + "162", + "MethodInspector.optional_args" + ], + [ + "trove/configuration/models.py", + "E1101", + "Instance of 'DBConfiguration' has no 'datastore_version_id' member", + "228", + "DBConfiguration.datastore_version" + ], + [ + "trove/guestagent/strategies/restore/experimental/postgresql_impl.py", + "no-member", + "Module 'eventlet.green.subprocess' has no 'PIPE' member", + "67", + "PgDump._execute_postgres_restore" + ], + [ + "trove/guestagent/strategies/backup/base.py", + "E1101", + "Instance of 'Popen' has no 'pid' member", + "86", + "BackupRunner.__exit__" + ], + [ + "trove/taskmanager/models.py", + "E1101", + "Instance of 'ResizeActionBase' has no '_assert_nova_action_was_successful' member", + "1826", + "ResizeActionBase._perform_nova_action" + ], + [ + "trove/module/models.py", + "E1101", + "Class 'DBModule' has no 'tenant_id' member", + "68", + "Modules.load" + ], + [ + "trove/guestagent/strategies/restore/base.py", + "E1101", + "Instance of 'Popen' has no 'stdin' member", + "90", + "RestoreRunner._unpack" + ], + [ + "trove/dns/designate/driver.py", + "E1101", + "Instance of 'Client' has no 'records' member", + "138", + "DesignateDriver._get_records" + ], + [ + "trove/backup/models.py", + "E1101", + "Instance of 'DBBackup' has no 'location' member", + "324", + "DBBackup.filename" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/029_add_backup_datastore.py", + "E1101", + "Instance of 'Table' has no 'drop_column' member", + "49", + "downgrade" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/022_add_backup_parent_id.py", + "no-member", + "Instance of 'Table' has no 'create_column' member", + "28", + "upgrade" + ], + [ + "trove/extensions/security_group/models.py", + "no-member", + "Instance of 'SecurityGroup' has no 'id' member", + "101", + "SecurityGroup.get_rules" + ], + [ + "trove/guestagent/datastore/experimental/postgresql/service/config.py", + "E1101", + "Instance of 'PgSqlConfig' has no 'configuration_manager' member", + "198", + "PgSqlConfig.enable_backups" + ], + [ + "trove/instance/service.py", + "E1101", + "Instance of 'BuiltInstance' has no 'get_default_configuration_template' member", + "395", + "InstanceController.configuration" + ], + [ + "trove/common/extensions.py", + "bad-super-call", + "Bad first argument 'ExtensionMiddleware' given to super()", + "575", + "TroveExtensionMiddleware.__init__" + ], + [ + "trove/guestagent/strategies/restore/base.py", + "E1101", + "Module 'eventlet.green.subprocess' has no 'PIPE' member", + "85", + "RestoreRunner._unpack" + ], + [ + "trove/common/utils.py", + "invalid-slice-index", + "Slice index is not an int, None, or instance with __index__", + "158", + "MethodInspector.required_args" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/007_add_volume_flavor.py", + "E1101", + "Instance of 'Table' has no 'create_column' member", + "32", + "upgrade" + ], + [ + "trove/guestagent/strategies/restore/experimental/postgresql_impl.py", + "E1101", + "Module 'eventlet.green.subprocess' has no 'PIPE' member", + "68", + "PgDump._execute_postgres_restore" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/017_update_datastores.py", + "E1101", + "Instance of 'Table' has no 'drop_column' member", + "48", + "upgrade" + ], + [ + "trove/extensions/mgmt/instances/service.py", + "no-member", + "Instance of 'BuiltInstance' has no 'rpc_ping' member", + "214", + "MgmtInstanceController.rpc_ping" + ], + [ + "trove/dns/designate/driver.py", + "no-member", + "Instance of 'Client' has no 'domains' member", + "122", + "DesignateDriver.get_dns_zones" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/016_add_datastore_type.py", + "E1101", + "Instance of 'Table' has no 'create_column' member", + "82", + "downgrade" + ], + [ + "trove/taskmanager/manager.py", + "E1101", + "Instance of 'BuiltInstance' has no 'reboot' member", + "74", + "Manager.reboot" + ], + [ + "trove/common/models.py", + "E1101", + "Instance of 'ModelBase' has no 'id' member", + "69", + "ModelBase.__eq__" + ], + [ + "trove/guestagent/datastore/experimental/cassandra/service.py", + "E0611", + "No name 'NoHostAvailable' in module 'cassandra.cluster'", + "22", + null + ], + [ + "trove/dns/designate/driver.py", + "no-member", + "Instance of 'Client' has no 'records' member", + "96", + "DesignateDriver.create_entry" + ], + [ + "trove/guestagent/datastore/experimental/postgresql/service/config.py", + "no-member", + "Instance of 'PgSqlConfig' has no 'configuration_manager' member", + "100", + "PgSqlConfig.update_overrides" + ], + [ + "trove/guestagent/strategies/restore/base.py", + "E1101", + "Module 'eventlet.green.subprocess' has no 'PIPE' member", + "84", + "RestoreRunner._unpack" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/015_add_service_type.py", + "no-value-for-parameter", + "No value for argument 'dml' in method call", + "28", + "upgrade" + ], + [ + "trove/common/extensions.py", + "no-member", + "Module 'lxml.etree' has no 'Element' member", + "474", + "ExtensionsXMLSerializer.show" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/029_add_backup_datastore.py", + "no-member", + "Instance of 'Table' has no 'drop_column' member", + "49", + "downgrade" + ], + [ + "trove/module/models.py", + "no-member", + "Class 'DBModule' has no 'datastore_id' member", + "101", + "Modules.add_datastore_filter" + ], + [ + "trove/backup/models.py", + "E1101", + "Instance of 'DBBackup' has no 'state' member", + "312", + "DBBackup.is_done" + ], + [ + "trove/backup/models.py", + "no-member", + "Instance of 'DBBackup' has no 'state' member", + "316", + "DBBackup.is_done_successfuly" + ], + [ + "trove/backup/models.py", + "no-member", + "Class 'DBBackup' has no 'instance_id' member", + "139", + "Backup.running" + ], + [ + "trove/guestagent/datastore/experimental/postgresql/service/config.py", + "E1101", + "Instance of 'PgSqlConfig' has no 'configuration_manager' member", + "100", + "PgSqlConfig.update_overrides" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/022_add_backup_parent_id.py", + "no-member", + "Instance of 'Table' has no 'drop_column' member", + "37", + "downgrade" + ], + [ + "trove/guestagent/datastore/experimental/postgresql/service/access.py", + "no-member", + "Instance of 'PgSqlAccess' has no 'user_exists' member", + "81", + "PgSqlAccess.list_access" + ], + [ + "trove/guestagent/datastore/experimental/redis/service.py", + "bad-except-order", + "Bad except clauses order (ConnectionError is an ancestor class of BusyLoadingError)", + "61", + "RedisAppStatus._get_actual_db_status" + ], + [ + "trove/db/sqlalchemy/migration.py", + "no-value-for-parameter", + "No value for argument 'repo_path' in function call", + "91", + "version_control" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/017_update_datastores.py", + "E1101", + "Instance of 'Table' has no 'create_column' member", + "44", + "upgrade" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/008_add_instance_fields.py", + "E1101", + "Instance of 'Table' has no 'drop_column' member", + "39", + "downgrade" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/009_add_deleted_flag_to_instances.py", + "no-member", + "Instance of 'Table' has no 'drop_column' member", + "40", + "downgrade" + ], + [ + "trove/module/models.py", + "no-member", + "Class 'DBModule' has no 'tenant_id' member", + "68", + "Modules.load" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/017_update_datastores.py", + "no-member", + "Instance of 'Table' has no 'drop_column' member", + "48", + "upgrade" + ], + [ + "trove/taskmanager/manager.py", + "E1101", + "Instance of 'FreshInstance' has no 'wait_for_instance' member", + "362", + "Manager._create_instance" + ], + [ + "trove/taskmanager/models.py", + "unexpected-keyword-arg", + "Unexpected keyword argument 'recover_func' in method call", + "1677", + "ResizeVolumeAction._resize_active_volume" + ], + [ + "trove/taskmanager/models.py", + "E1101", + "Instance of 'ResizeActionBase' has no '_record_action_success' member", + "1850", + "ResizeActionBase._perform_nova_action" + ], + [ + "trove/guestagent/datastore/experimental/postgresql/service/access.py", + "E1101", + "Instance of 'PgSqlAccess' has no 'user_exists' member", + "81", + "PgSqlAccess.list_access" + ], + [ + "trove/cmd/manage.py", + "no-member", + "Class 'Commands' has no 'has' member", + "122", + "Commands.params_of" + ], + [ + "trove/guestagent/strategies/restore/experimental/postgresql_impl.py", + "no-member", + "Instance of 'Popen' has no 'stdin' member", + "73", + "PgDump._execute_postgres_restore" + ], + [ + "trove/common/single_tenant_remote.py", + "no-name-in-module", + "No name 'v1_1' in module 'novaclient'", + "22", + null + ], + [ + "trove/quota/quota.py", + "E1101", + "Class 'Enum' has no 'RESERVED' member", + "186", + "DbQuotaDriver.reserve" + ], + [ + "trove/taskmanager/models.py", + "E1101", + "Instance of 'ResizeActionBase' has no '_start_datastore' member", + "1752", + "ResizeActionBase._assert_datastore_is_ok" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/020_configurations.py", + "no-member", + "Instance of 'Table' has no 'create_column' member", + "60", + "upgrade" + ], + [ + "trove/backup/models.py", + "E1101", + "Instance of 'DBBackup' has no 'state' member", + "316", + "DBBackup.is_done_successfuly" + ], + [ + "trove/taskmanager/manager.py", + "E1101", + "Instance of 'BuiltInstance' has no 'resize_volume' member", + "62", + "Manager.resize_volume" + ], + [ + "trove/guestagent/strategies/backup/base.py", + "no-member", + "Instance of 'Popen' has no 'pid' member", + "86", + "BackupRunner.__exit__" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/032_clusters.py", + "no-member", + "Instance of 'Table' has no 'create_column' member", + "59", + "upgrade" + ], + [ + "trove/backup/models.py", + "no-member", + "Instance of 'DBBackup' has no 'location' member", + "320", + "DBBackup.filename" + ], + [ + "trove/backup/models.py", + "E1101", + "Class 'DBBackup' has no 'deleted' member", + "195", + "Backup.list" + ], + [ + "trove/guestagent/strategies/restore/experimental/postgresql_impl.py", + "no-member", + "Instance of 'PgBaseBackup' has no 'pgsql_restore_cmd' member", + "137", + "PgBaseBackup.write_recovery_file" + ], + [ + "trove/extensions/security_group/models.py", + "E1101", + "Instance of 'SecurityGroupRule' has no 'id' member", + "178", + "SecurityGroupRule.delete" + ], + [ + "trove/guestagent/strategies/restore/base.py", + "E1101", + "Instance of 'Popen' has no 'stdin' member", + "88", + "RestoreRunner._unpack" + ], + [ + "trove/guestagent/datastore/experimental/postgresql/service/config.py", + "E1101", + "Instance of 'PgSqlConfig' has no 'configuration_manager' member", + "220", + "PgSqlConfig.enable_backups" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/032_clusters.py", + "E1101", + "Instance of 'Table' has no 'create_column' member", + "58", + "upgrade" + ], + [ + "trove/instance/models.py", + "no-member", + "Class 'InstanceStatus' has no 'LOGGING' member", + "306", + "SimpleInstance.status" + ], + [ + "trove/dns/designate/driver.py", + "E1101", + "Instance of 'Client' has no 'records' member", + "107", + "DesignateDriver.delete_entry" + ], + [ + "trove/extensions/mgmt/instances/service.py", + "E1101", + "Instance of 'BuiltInstance' has no 'get_hwinfo' member", + "186", + "MgmtInstanceController.hwinfo" + ], + [ + "trove/taskmanager/models.py", + "no-member", + "Instance of 'ResizeActionBase' has no '_start_datastore' member", + "1752", + "ResizeActionBase._assert_datastore_is_ok" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/009_add_deleted_flag_to_instances.py", + "E1101", + "Instance of 'Table' has no 'drop_column' member", + "40", + "downgrade" + ], + [ + "trove/backup/models.py", + "no-member", + "Class 'DBBackup' has no 'state' member", + "248", + "Backup.fail_for_instance" + ], + [ + "trove/common/single_tenant_remote.py", + "E0611", + "No name 'v1_1' in module 'novaclient'", + "22", + null + ], + [ + "trove/taskmanager/manager.py", + "E1101", + "Instance of 'BuiltInstance' has no 'update_overrides' member", + "383", + "Manager.update_overrides" + ], + [ + "trove/backup/models.py", + "E1101", + "Instance of 'DBBackup' has no 'checksum' member", + "355", + "DBBackup.check_swift_object_exist" + ], + [ + "trove/dns/designate/driver.py", + "no-member", + "Instance of 'Client' has no 'records' member", + "107", + "DesignateDriver.delete_entry" + ], + [ + "trove/backup/models.py", + "no-member", + "Instance of 'DBBackup' has no 'state' member", + "308", + "DBBackup.is_running" + ], + [ + "trove/extensions/security_group/models.py", + "E1101", + "Instance of 'SecurityGroupRule' has no 'group_id' member", + "171", + "SecurityGroupRule.get_security_group" + ], + [ + "trove/backup/models.py", + "E1101", + "Class 'DBBackup' has no 'instance_id' member", + "247", + "Backup.fail_for_instance" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/031_add_timestamps_to_configurations.py", + "no-member", + "Instance of 'Table' has no 'create_column' member", + "27", + "upgrade" + ], + [ + "trove/taskmanager/models.py", + "unexpected-keyword-arg", + "Unexpected keyword argument 'recover_func' in method call", + "1678", + "ResizeVolumeAction._resize_active_volume" + ], + [ + "trove/taskmanager/models.py", + "E1123", + "Unexpected keyword argument 'recover_func' in method call", + "1678", + "ResizeVolumeAction._resize_active_volume" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/020_configurations.py", + "no-member", + "Instance of 'Table' has no 'drop_column' member", + "77", + "downgrade" + ], + [ + "trove/backup/models.py", + "E1101", + "Instance of 'DBBackup' has no 'state' member", + "308", + "DBBackup.is_running" + ], + [ + "trove/guestagent/datastore/experimental/postgresql/service/config.py", + "no-member", + "Instance of 'PgSqlConfig' has no 'configuration_manager' member", + "220", + "PgSqlConfig.enable_backups" + ], + [ + "trove/module/models.py", + "no-member", + "Class 'DBModule' has no 'tenant_id' member", + "67", + "Modules.load" + ], + [ + "trove/extensions/mgmt/instances/service.py", + "E1101", + "Instance of 'BuiltInstance' has no 'get_diagnostics' member", + "200", + "MgmtInstanceController.diagnostics" + ], + [ + "trove/common/extensions.py", + "no-member", + "Module 'lxml.etree' has no 'SubElement' member", + "481", + "ExtensionsXMLSerializer.index" + ], + [ + "trove/guestagent/datastore/experimental/cassandra/service.py", + "E1101", + "Instance of 'list' has no 'split' member", + "635", + "CassandraApp.get_seeds" + ], + [ + "trove/backup/models.py", + "no-member", + "Instance of 'DBBackup' has no 'datastore_version_id' member", + "337", + "DBBackup.datastore_version" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/009_add_deleted_flag_to_instances.py", + "no-member", + "Instance of 'Table' has no 'create_column' member", + "30", + "upgrade" + ], + [ + "trove/common/models.py", + "no-member", + "Instance of 'ModelBase' has no 'id' member", + "69", + "ModelBase.__eq__" + ], + [ + "trove/quota/quota.py", + "no-member", + "Class 'Enum' has no 'COMMITTED' member", + "204", + "DbQuotaDriver.commit" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/030_add_master_slave.py", + "E1101", + "Instance of 'Table' has no 'drop_column' member", + "50", + "downgrade" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/016_add_datastore_type.py", + "no-member", + "Instance of 'Table' has no 'create_column' member", + "82", + "downgrade" + ], + [ + "trove/guestagent/datastore/experimental/redis/service.py", + "E0701", + "Bad except clauses order (ConnectionError is an ancestor class of BusyLoadingError)", + "61", + "RedisAppStatus._get_actual_db_status" + ], + [ + "trove/taskmanager/manager.py", + "no-member", + "Instance of 'BuiltInstance' has no 'reboot' member", + "74", + "Manager.reboot" + ], + [ + "trove/extensions/security_group/models.py", + "no-member", + "Instance of 'SecurityGroupInstanceAssociation' has no 'security_group_id' member", + "191", + "SecurityGroupInstanceAssociation.get_security_group" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/017_update_datastores.py", + "no-member", + "Instance of 'Table' has no 'create_column' member", + "63", + "downgrade" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/022_add_backup_parent_id.py", + "E1101", + "Instance of 'Table' has no 'create_column' member", + "28", + "upgrade" + ], + [ + "trove/instance/service.py", + "no-member", + "Instance of 'BuiltInstance' has no 'get_default_configuration_template' member", + "395", + "InstanceController.configuration" + ], + [ + "trove/taskmanager/models.py", + "E1123", + "Unexpected keyword argument 'recover_func' in method call", + "1674", + "ResizeVolumeAction._resize_active_volume" + ], + [ + "trove/common/strategies/cluster/experimental/mongodb/api.py", + "E1101", + "Instance of 'API' has no 'mongodb_add_shard_cluster' member", + "300", + "MongoDbCluster.add_shard" + ], + [ + "trove/taskmanager/manager.py", + "no-member", + "Instance of 'BuiltInstance' has no 'resize_volume' member", + "62", + "Manager.resize_volume" + ], + [ + "trove/module/models.py", + "no-member", + "Class 'DBModule' has no 'datastore_version_id' member", + "108", + "Modules.add_ds_version_filter" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/016_add_datastore_type.py", + "no-value-for-parameter", + "No value for argument 'dml' in method call", + "83", + "downgrade" + ], + [ + "trove/module/models.py", + "no-member", + "Class 'DBModule' has no 'tenant_id' member", + "97", + "Modules.add_tenant_filter" + ], + [ + "trove/taskmanager/models.py", + "unexpected-keyword-arg", + "Unexpected keyword argument 'recover_func' in method call", + "1679", + "ResizeVolumeAction._resize_active_volume" + ], + [ + "trove/guestagent/strategies/backup/base.py", + "no-member", + "Module 'eventlet.green.subprocess' has no 'PIPE' member", + "64", + "BackupRunner._run" + ], + [ + "trove/taskmanager/manager.py", + "no-member", + "Instance of 'FreshInstance' has no 'create_instance' member", + "353", + "Manager._create_instance" + ], + [ + "trove/datastore/models.py", + "E1101", + "Class 'DBDatastoreVersion' has no 'active' member", + "376", + "Datastores.load" + ], + [ + "trove/module/models.py", + "no-member", + "Class 'DBModule' has no 'datastore_version_id' member", + "107", + "Modules.add_ds_version_filter" + ], + [ + "trove/extensions/security_group/models.py", + "E1101", + "Instance of 'SecurityGroup' has no 'id' member", + "101", + "SecurityGroup.get_rules" + ], + [ + "trove/guestagent/strategies/restore/base.py", + "no-member", + "Instance of 'RestoreRunner' has no 'base_restore_cmd' member", + "61", + "RestoreRunner.__init__" + ], + [ + "trove/quota/quota.py", + "no-member", + "Class 'Enum' has no 'RESERVED' member", + "186", + "DbQuotaDriver.reserve" + ], + [ + "trove/backup/models.py", + "no-member", + "Class 'DBBackup' has no 'id' member", + "144", + "Backup.running" + ], + [ + "trove/guestagent/strategies/backup/base.py", + "E1101", + "Module 'eventlet.green.subprocess' has no 'PIPE' member", + "65", + "BackupRunner._run" + ], + [ + "trove/taskmanager/manager.py", + "E1101", + "Instance of 'FreshInstance' has no 'create_instance' member", + "353", + "Manager._create_instance" + ], + [ + "trove/taskmanager/manager.py", + "E1101", + "Instance of 'FreshInstance' has no 'create_instance' member", + "310", + "Manager._create_replication_slave" + ], + [ + "trove/guestagent/datastore/experimental/postgresql/service/config.py", + "no-member", + "Instance of 'PgSqlConfig' has no 'configuration_manager' member", + "198", + "PgSqlConfig.enable_backups" + ], + [ + "trove/taskmanager/models.py", + "E1123", + "Unexpected keyword argument 'recover_func' in method call", + "1677", + "ResizeVolumeAction._resize_active_volume" + ], + [ + "trove/backup/models.py", + "E1101", + "Instance of 'DBBackup' has no 'location' member", + "320", + "DBBackup.filename" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/008_add_instance_fields.py", + "no-member", + "Instance of 'Table' has no 'create_column' member", + "29", + "upgrade" + ], + [ + "trove/taskmanager/models.py", + "E1101", + "Instance of 'BuiltInstance' has no 'get_replication_snapshot' member", + "568", + "FreshInstanceTasks.get_replication_master_snapshot" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/007_add_volume_flavor.py", + "no-member", + "Instance of 'Table' has no 'drop_column' member", + "44", + "downgrade" + ], + [ + "trove/taskmanager/manager.py", + "no-member", + "Instance of 'FreshInstance' has no 'wait_for_instance' member", + "362", + "Manager._create_instance" + ], + [ + "trove/common/extensions.py", + "E1101", + "Module 'lxml.etree' has no 'Element' member", + "479", + "ExtensionsXMLSerializer.index" + ], + [ + "trove/guestagent/datastore/experimental/cassandra/service.py", + "no-name-in-module", + "No name 'Cluster' in module 'cassandra.cluster'", + "21", + null + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/015_add_service_type.py", + "E1101", + "Instance of 'Table' has no 'create_column' member", + "27", + "upgrade" + ], + [ + "trove/common/wsgi.py", + "function-redefined", + "class already defined line 43", + "152", + "Router" + ], + [ + "trove/backup/models.py", + "E1101", + "Class 'DBBackup' has no 'state' member", + "140", + "Backup.running" + ], + [ + "trove/common/strategies/cluster/experimental/mongodb/api.py", + "E1101", + "Instance of 'API' has no 'get_key' member", + "277", + "MongoDbCluster.add_shard" + ], + [ + "trove/taskmanager/manager.py", + "no-member", + "Instance of 'FreshInstance' has no 'create_instance' member", + "310", + "Manager._create_replication_slave" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/016_add_datastore_type.py", + "E1101", + "Instance of 'Table' has no 'drop_column' member", + "80", + "downgrade" + ], + [ + "trove/common/strategies/cluster/experimental/mongodb/api.py", + "no-member", + "Instance of 'API' has no 'mongodb_add_shard_cluster' member", + "300", + "MongoDbCluster.add_shard" + ], + [ + "trove/common/models.py", + "E1101", + "Instance of 'ModelBase' has no 'id' member", + "77", + "ModelBase.__hash__" + ], + [ + "trove/common/extensions.py", + "no-member", + "Module 'lxml.etree' has no 'tostring' member", + "505", + "ExtensionsXMLSerializer._to_xml" + ], + [ + "trove/configuration/models.py", + "E1101", + "Instance of 'DBConfiguration' has no 'datastore_version_id' member", + "220", + "DBConfiguration.datastore" + ], + [ + "trove/backup/models.py", + "E1101", + "Instance of 'DBBackup' has no 'datastore_version_id' member", + "337", + "DBBackup.datastore_version" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/008_add_instance_fields.py", + "E1101", + "Instance of 'Table' has no 'create_column' member", + "28", + "upgrade" + ], + [ + "trove/guestagent/strategies/backup/base.py", + "no-member", + "Module 'eventlet.green.subprocess' has no 'PIPE' member", + "65", + "BackupRunner._run" + ], + [ + "trove/guestagent/datastore/experimental/postgresql/service/process.py", + "no-member", + "Instance of 'PgSqlProcess' has no 'set_guest_log_status' member", + "57", + "PgSqlProcess.restart" + ], + [ + "trove/dns/designate/driver.py", + "E1101", + "Instance of 'Client' has no 'records' member", + "96", + "DesignateDriver.create_entry" + ], + [ + "trove/taskmanager/models.py", + "E1123", + "Unexpected keyword argument 'recover_func' in method call", + "1673", + "ResizeVolumeAction._resize_active_volume" + ], + [ + "trove/configuration/models.py", + "no-member", + "Instance of 'DBConfiguration' has no 'datastore_version_id' member", + "220", + "DBConfiguration.datastore" + ], + [ + "trove/configuration/models.py", + "no-member", + "Instance of 'DBConfiguration' has no 'datastore_version_id' member", + "228", + "DBConfiguration.datastore_version" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/022_add_backup_parent_id.py", + "E1101", + "Instance of 'Table' has no 'drop_column' member", + "37", + "downgrade" + ], + [ + "trove/taskmanager/manager.py", + "E1101", + "Instance of 'BuiltInstance' has no 'detach_replica' member", + "87", + "Manager.detach_replica" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/030_add_master_slave.py", + "no-member", + "Instance of 'Table' has no 'drop_column' member", + "50", + "downgrade" + ], + [ + "trove/guestagent/strategies/backup/base.py", + "E1101", + "Instance of 'Popen' has no 'pid' member", + "67", + "BackupRunner._run" + ], + [ + "trove/backup/models.py", + "E1101", + "Instance of 'DBBackup' has no 'datastore_version_id' member", + "331", + "DBBackup.datastore" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/015_add_service_type.py", + "no-member", + "Instance of 'Table' has no 'drop_column' member", + "36", + "downgrade" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/017_update_datastores.py", + "E1101", + "Instance of 'Table' has no 'drop_column' member", + "59", + "downgrade" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/029_add_backup_datastore.py", + "E1101", + "Instance of 'Table' has no 'create_column' member", + "31", + "upgrade" + ], + [ + "trove/guestagent/strategies/restore/base.py", + "no-member", + "Module 'eventlet.green.subprocess' has no 'PIPE' member", + "85", + "RestoreRunner._unpack" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/007_add_volume_flavor.py", + "E1101", + "Instance of 'Table' has no 'drop_column' member", + "43", + "downgrade" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/032_clusters.py", + "no-member", + "Instance of 'Table' has no 'drop_column' member", + "92", + "downgrade" + ], + [ + "trove/backup/models.py", + "E1101", + "Instance of 'DBBackup' has no 'id' member", + "357", + "DBBackup.check_swift_object_exist" + ], + [ + "trove/guestagent/strategies/restore/base.py", + "E1101", + "Instance of 'RestoreRunner' has no 'base_restore_cmd' member", + "61", + "RestoreRunner.__init__" + ], + [ + "trove/guestagent/strategies/restore/base.py", + "no-member", + "Module 'eventlet.green.subprocess' has no 'PIPE' member", + "84", + "RestoreRunner._unpack" + ], + [ + "trove/taskmanager/models.py", + "no-member", + "Instance of 'BuiltInstance' has no 'backup_required_for_replication' member", + "510", + "FreshInstanceTasks.get_replication_master_snapshot" + ], + [ + "trove/module/models.py", + "no-member", + "Class 'DBModule' has no 'tenant_id' member", + "96", + "Modules.add_tenant_filter" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/016_add_datastore_type.py", + "E1120", + "No value for argument 'dml' in method call", + "83", + "downgrade" + ], + [ + "trove/datastore/models.py", + "no-member", + "Class 'DBDatastoreVersion' has no 'active' member", + "376", + "Datastores.load" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/007_add_volume_flavor.py", + "no-member", + "Instance of 'Table' has no 'drop_column' member", + "43", + "downgrade" + ], + [ + "trove/backup/models.py", + "no-member", + "Class 'DBBackup' has no 'instance_id' member", + "247", + "Backup.fail_for_instance" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/031_add_timestamps_to_configurations.py", + "E1101", + "Instance of 'Table' has no 'drop_column' member", + "34", + "downgrade" + ], + [ + "trove/configuration/service.py", + "no-member", + "Instance of 'BuiltInstance' has no 'update_overrides' member", + "210", + "ConfigurationsController._refresh_on_all_instances" + ], + [ + "trove/backup/models.py", + "no-member", + "Instance of 'DBBackup' has no 'id' member", + "351", + "DBBackup.check_swift_object_exist" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/016_add_datastore_type.py", + "E1101", + "Instance of 'Table' has no 'drop_column' member", + "61", + "upgrade" + ], + [ + "trove/guestagent/strategies/restore/experimental/postgresql_impl.py", + "E1101", + "Instance of 'PgBaseBackup' has no 'pgsql_restore_cmd' member", + "137", + "PgBaseBackup.write_recovery_file" + ], + [ + "trove/configuration/models.py", + "no-member", + "Instance of 'DBConfigurationParameter' has no 'configuration_key' member", + "238", + "DBConfigurationParameter.__hash__" + ], + [ + "trove/guestagent/strategies/restore/experimental/postgresql_impl.py", + "no-member", + "Module 'eventlet.green.subprocess' has no 'PIPE' member", + "68", + "PgDump._execute_postgres_restore" + ], + [ + "trove/quota/quota.py", + "E1101", + "Class 'Enum' has no 'COMMITTED' member", + "204", + "DbQuotaDriver.commit" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/008_add_instance_fields.py", + "no-member", + "Instance of 'Table' has no 'drop_column' member", + "40", + "downgrade" + ], + [ + "trove/quota/quota.py", + "E1101", + "Class 'Enum' has no 'ROLLEDBACK' member", + "218", + "DbQuotaDriver.rollback" + ], + [ + "trove/datastore/models.py", + "E1101", + "Instance of 'BaseCapability' has no 'name' member", + "161", + "BaseCapability.__repr__" + ], + [ + "trove/cmd/manage.py", + "E1101", + "Class 'Commands' has no 'has' member", + "122", + "Commands.params_of" + ], + [ + "trove/backup/models.py", + "E1101", + "Instance of 'DBBackup' has no 'location' member", + "321", + "DBBackup.filename" + ], + [ + "trove/common/strategies/cluster/experimental/mongodb/api.py", + "no-member", + "Instance of 'API' has no 'get_key' member", + "277", + "MongoDbCluster.add_shard" + ], + [ + "trove/guestagent/strategies/restore/experimental/postgresql_impl.py", + "E1101", + "Module 'eventlet.green.subprocess' has no 'PIPE' member", + "67", + "PgDump._execute_postgres_restore" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/009_add_deleted_flag_to_instances.py", + "no-member", + "Instance of 'Table' has no 'create_column' member", + "29", + "upgrade" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/009_add_deleted_flag_to_instances.py", + "E1101", + "Instance of 'Table' has no 'drop_column' member", + "39", + "downgrade" + ], + [ + "trove/db/sqlalchemy/migration.py", + "no-name-in-module", + "No name 'exceptions' in module 'migrate.versioning'", + "22", + null + ], + [ + "trove/taskmanager/manager.py", + "no-member", + "Instance of 'BuiltInstance' has no 'detach_replica' member", + "87", + "Manager.detach_replica" + ], + [ + "trove/cmd/fakemode.py", + "E0602", + "Undefined variable 'CONF'", + "42", + "main" + ], + [ + "trove/backup/models.py", + "no-member", + "Class 'DBDatastoreVersion' has no 'datastore_id' member", + "198", + "Backup.list" + ], + [ + "trove/backup/models.py", + "E1101", + "Class 'DBBackup' has no 'id' member", + "144", + "Backup.running" + ], + [ + "trove/guestagent/datastore/experimental/postgresql/service/config.py", + "E1101", + "Instance of 'PgSqlConfig' has no 'configuration_manager' member", + "118", + "PgSqlConfig.reset_configuration" + ], + [ + "trove/backup/models.py", + "no-member", + "Class 'DBBackup' has no 'updated' member", + "173", + "Backup._paginate" + ], + [ + "trove/guestagent/strategies/backup/base.py", + "no-member", + "Instance of 'Popen' has no 'terminate' member", + "87", + "BackupRunner.__exit__" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/017_update_datastores.py", + "no-member", + "Instance of 'Table' has no 'drop_column' member", + "59", + "downgrade" + ], + [ + "trove/taskmanager/manager.py", + "E1101", + "Instance of 'BuiltInstance' has no 'migrate' member", + "251", + "Manager.migrate" + ], + [ + "trove/db/sqlalchemy/migration.py", + "E0611", + "No name 'exceptions' in module 'migrate.versioning'", + "22", + null + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/031_add_timestamps_to_configurations.py", + "no-member", + "Instance of 'Table' has no 'drop_column' member", + "35", + "downgrade" + ], + [ + "trove/taskmanager/manager.py", + "E1101", + "Instance of 'BuiltInstance' has no 'create_backup' member", + "272", + "Manager.create_backup" + ], + [ + "trove/common/models.py", + "no-member", + "Instance of 'ModelBase' has no 'id' member", + "77", + "ModelBase.__hash__" + ], + [ + "trove/extensions/mgmt/instances/service.py", + "no-member", + "Instance of 'BuiltInstance' has no 'get_diagnostics' member", + "200", + "MgmtInstanceController.diagnostics" + ], + [ + "trove/taskmanager/manager.py", + "no-member", + "Instance of 'FreshInstance' has no 'get_replication_master_snapshot' member", + "305", + "Manager._create_replication_slave" + ], + [ + "trove/common/utils.py", + "E1127", + "Slice index is not an int, None, or instance with __index__", + "162", + "MethodInspector.optional_args" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/032_clusters.py", + "E1101", + "Instance of 'Table' has no 'drop_column' member", + "93", + "downgrade" + ], + [ + "trove/taskmanager/manager.py", + "E1101", + "Instance of 'BuiltInstance' has no 'unassign_configuration' member", + "388", + "Manager.unassign_configuration" + ], + [ + "trove/extensions/mgmt/instances/service.py", + "E1101", + "Instance of 'BuiltInstance' has no 'rpc_ping' member", + "214", + "MgmtInstanceController.rpc_ping" + ], + [ + "trove/guestagent/datastore/experimental/postgresql/service/config.py", + "no-member", + "Instance of 'PgSqlConfig' has no 'configuration_manager' member", + "102", + "PgSqlConfig.update_overrides" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/032_clusters.py", + "E1101", + "Instance of 'Table' has no 'drop_column' member", + "91", + "downgrade" + ], + [ + "trove/cmd/fakemode.py", + "undefined-variable", + "Undefined variable 'os'", + "37", + "main" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/032_clusters.py", + "E1101", + "Instance of 'Table' has no 'create_column' member", + "56", + "upgrade" + ], + [ + "trove/dns/designate/driver.py", + "E1101", + "Instance of 'Client' has no 'domains' member", + "122", + "DesignateDriver.get_dns_zones" + ], + [ + "trove/backup/models.py", + "no-member", + "Instance of 'DBBackup' has no 'id' member", + "357", + "DBBackup.check_swift_object_exist" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/008_add_instance_fields.py", + "no-member", + "Instance of 'Table' has no 'drop_column' member", + "39", + "downgrade" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/032_clusters.py", + "no-member", + "Instance of 'Table' has no 'create_column' member", + "58", + "upgrade" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/015_add_service_type.py", + "E1120", + "No value for argument 'dml' in method call", + "28", + "upgrade" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/008_add_instance_fields.py", + "no-member", + "Instance of 'Table' has no 'create_column' member", + "28", + "upgrade" + ], + [ + "trove/backup/models.py", + "no-member", + "Instance of 'DBBackup' has no 'location' member", + "325", + "DBBackup.filename" + ], + [ + "trove/taskmanager/models.py", + "unexpected-keyword-arg", + "Unexpected keyword argument 'recover_func' in method call", + "1672", + "ResizeVolumeAction._resize_active_volume" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/015_add_service_type.py", + "no-member", + "Instance of 'Table' has no 'create_column' member", + "27", + "upgrade" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/009_add_deleted_flag_to_instances.py", + "E1101", + "Instance of 'Table' has no 'create_column' member", + "30", + "upgrade" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/032_clusters.py", + "no-member", + "Instance of 'Table' has no 'create_column' member", + "56", + "upgrade" + ], + [ + "trove/common/extensions.py", + "E1101", + "Module 'lxml.etree' has no 'Element' member", + "474", + "ExtensionsXMLSerializer.show" + ], + [ + "trove/backup/models.py", + "no-member", + "Instance of 'DBBackup' has no 'checksum' member", + "355", + "DBBackup.check_swift_object_exist" + ], + [ + "trove/extensions/security_group/models.py", + "E1101", + "Instance of 'SecurityGroupInstanceAssociation' has no 'security_group_id' member", + "191", + "SecurityGroupInstanceAssociation.get_security_group" + ], + [ + "trove/module/models.py", + "E1101", + "Class 'DBModule' has no 'datastore_id' member", + "101", + "Modules.add_datastore_filter" + ], + [ + "trove/backup/models.py", + "no-member", + "Instance of 'DBBackup' has no 'datastore_version_id' member", + "331", + "DBBackup.datastore" + ], + [ + "trove/db/sqlalchemy/migration.py", + "E1120", + "No value for argument 'repo_path' in function call", + "91", + "version_control" + ], + [ + "trove/backup/models.py", + "E1101", + "Instance of 'DBBackup' has no 'location' member", + "347", + "DBBackup.check_swift_object_exist" + ], + [ + "trove/backup/models.py", + "E1101", + "Instance of 'DBBackup' has no 'datastore_version_id' member", + "339", + "DBBackup.datastore_version" + ], + [ + "trove/taskmanager/manager.py", + "E1101", + "Instance of 'FreshInstance' has no 'get_replication_master_snapshot' member", + "305", + "Manager._create_replication_slave" + ], + [ + "trove/guestagent/datastore/experimental/postgresql/service/config.py", + "E1101", + "Instance of 'PgSqlConfig' has no 'configuration_manager' member", + "143", + "PgSqlConfig.apply_initial_guestagent_configuration" + ], + [ + "trove/extensions/security_group/models.py", + "E1101", + "Instance of 'SecurityGroup' has no 'id' member", + "49", + "SecurityGroup.instance_id" + ], + [ + "trove/taskmanager/models.py", + "no-member", + "Instance of 'ResizeActionBase' has no '_initiate_nova_action' member", + "1818", + "ResizeActionBase._perform_nova_action" + ], + [ + "trove/taskmanager/models.py", + "no-member", + "Instance of 'ResizeActionBase' has no '_record_action_success' member", + "1850", + "ResizeActionBase._perform_nova_action" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/015_add_service_type.py", + "E1101", + "Instance of 'Table' has no 'drop_column' member", + "36", + "downgrade" + ], + [ + "trove/extensions/mgmt/instances/service.py", + "no-member", + "Instance of 'BuiltInstance' has no 'get_hwinfo' member", + "186", + "MgmtInstanceController.hwinfo" + ], + [ + "trove/taskmanager/models.py", + "unexpected-keyword-arg", + "Unexpected keyword argument 'recover_func' in method call", + "1673", + "ResizeVolumeAction._resize_active_volume" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/009_add_deleted_flag_to_instances.py", + "E1101", + "Instance of 'Table' has no 'create_column' member", + "29", + "upgrade" + ], + [ + "trove/cmd/fakemode.py", + "undefined-variable", + "Undefined variable 'CONF'", + "42", + "main" + ], + [ + "trove/backup/models.py", + "E1101", + "Class 'DBBackup' has no 'instance_id' member", + "139", + "Backup.running" + ], + [ + "trove/guestagent/datastore/experimental/postgresql/service/process.py", + "E1101", + "Instance of 'PgSqlProcess' has no 'set_guest_log_status' member", + "57", + "PgSqlProcess.restart" + ], + [ + "trove/guestagent/datastore/experimental/postgresql/service/config.py", + "no-member", + "Instance of 'PgSqlConfig' has no 'configuration_manager' member", + "143", + "PgSqlConfig.apply_initial_guestagent_configuration" + ], + [ + "trove/taskmanager/models.py", + "no-member", + "Instance of 'BuiltInstance' has no 'get_replication_snapshot' member", + "568", + "FreshInstanceTasks.get_replication_master_snapshot" + ], + [ + "trove/extensions/security_group/models.py", + "no-member", + "Instance of 'SecurityGroup' has no 'id' member", + "49", + "SecurityGroup.instance_id" + ], + [ + "trove/instance/models.py", + "E1101", + "Class 'InstanceStatus' has no 'LOGGING' member", + "306", + "SimpleInstance.status" + ], + [ + "trove/backup/models.py", + "no-member", + "Class 'DBBackup' has no 'deleted' member", + "195", + "Backup.list" + ], + [ + "trove/guestagent/datastore/experimental/cassandra/service.py", + "E0611", + "No name 'Cluster' in module 'cassandra.cluster'", + "21", + null + ], + [ + "trove/common/utils.py", + "E1127", + "Slice index is not an int, None, or instance with __index__", + "158", + "MethodInspector.required_args" + ], + [ + "trove/guestagent/datastore/experimental/postgresql/service/config.py", + "no-member", + "Instance of 'PgSqlConfig' has no 'configuration_manager' member", + "118", + "PgSqlConfig.reset_configuration" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/007_add_volume_flavor.py", + "no-member", + "Instance of 'Table' has no 'create_column' member", + "33", + "upgrade" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/016_add_datastore_type.py", + "E1101", + "Instance of 'Table' has no 'create_column' member", + "60", + "upgrade" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/030_add_master_slave.py", + "no-member", + "Instance of 'Table' has no 'create_column' member", + "31", + "upgrade" + ], + [ + "trove/backup/models.py", + "no-member", + "Class 'DBBackup' has no 'tenant_id' member", + "194", + "Backup.list" + ], + [ + "trove/taskmanager/manager.py", + "no-member", + "Instance of 'BuiltInstance' has no 'create_backup' member", + "272", + "Manager.create_backup" + ], + [ + "trove/common/extensions.py", + "no-member", + "Module 'lxml.etree' has no 'SubElement' member", + "496", + "ExtensionsXMLSerializer._populate_ext" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/031_add_timestamps_to_configurations.py", + "no-member", + "Instance of 'Table' has no 'drop_column' member", + "34", + "downgrade" + ], + [ + "trove/guestagent/strategies/backup/base.py", + "E1101", + "Instance of 'Popen' has no 'stdout' member", + "136", + "BackupRunner.read" + ], + [ + "trove/backup/models.py", + "E1101", + "Instance of 'BuiltInstance' has no 'validate_can_perform_action' member", + "73", + "Backup.create._create_resources" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/032_clusters.py", + "E1101", + "Instance of 'Table' has no 'create_column' member", + "59", + "upgrade" + ], + [ + "trove/taskmanager/models.py", + "E1101", + "Instance of 'BuiltInstance' has no 'backup_required_for_replication' member", + "510", + "FreshInstanceTasks.get_replication_master_snapshot" + ], + [ + "trove/taskmanager/models.py", + "E1123", + "Unexpected keyword argument 'recover_func' in method call", + "1679", + "ResizeVolumeAction._resize_active_volume" + ], + [ + "trove/datastore/models.py", + "no-member", + "Instance of 'BaseCapability' has no 'name' member", + "161", + "BaseCapability.__repr__" + ], + [ + "trove/guestagent/strategies/backup/base.py", + "no-member", + "Instance of 'Popen' has no 'pid' member", + "67", + "BackupRunner._run" + ], + [ + "trove/guestagent/strategies/restore/experimental/postgresql_impl.py", + "E1101", + "Instance of 'Popen' has no 'stdin' member", + "71", + "PgDump._execute_postgres_restore" + ], + [ + "trove/guestagent/strategies/backup/base.py", + "E1101", + "Instance of 'Popen' has no 'terminate' member", + "87", + "BackupRunner.__exit__" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/032_clusters.py", + "no-member", + "Instance of 'Table' has no 'drop_column' member", + "91", + "downgrade" + ], + [ + "trove/common/extensions.py", + "E1101", + "Module 'lxml.etree' has no 'SubElement' member", + "496", + "ExtensionsXMLSerializer._populate_ext" + ], + [ + "trove/common/extensions.py", + "E1101", + "Module 'lxml.etree' has no 'SubElement' member", + "481", + "ExtensionsXMLSerializer.index" + ], + [ + "trove/taskmanager/models.py", + "unexpected-keyword-arg", + "Unexpected keyword argument 'recover_func' in method call", + "1674", + "ResizeVolumeAction._resize_active_volume" + ], + [ + "trove/module/models.py", + "E1101", + "Class 'DBModule' has no 'tenant_id' member", + "97", + "Modules.add_tenant_filter" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/032_clusters.py", + "no-member", + "Instance of 'Table' has no 'drop_column' member", + "93", + "downgrade" + ], + [ + "trove/extensions/security_group/models.py", + "no-member", + "Instance of 'SecurityGroup' has no 'id' member", + "111", + "SecurityGroup.delete" + ], + [ + "trove/taskmanager/models.py", + "no-member", + "Instance of 'str' has no 'render' member", + "735", + "FreshInstanceTasks._create_server_volume_heat" + ], + [ + "trove/backup/models.py", + "E1101", + "Class 'DBBackup' has no 'updated' member", + "173", + "Backup._paginate" + ], + [ + "trove/backup/models.py", + "E1101", + "Class 'DBDatastoreVersion' has no 'datastore_id' member", + "198", + "Backup.list" + ], + [ + "trove/common/wsgi.py", + "function-redefined", + "class already defined line 46", + "658", + "JSONDictSerializer" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/008_add_instance_fields.py", + "E1101", + "Instance of 'Table' has no 'create_column' member", + "29", + "upgrade" + ], + [ + "trove/guestagent/datastore/experimental/cassandra/service.py", + "no-member", + "Instance of 'list' has no 'split' member", + "635", + "CassandraApp.get_seeds" + ], + [ + "trove/extensions/security_group/models.py", + "E1101", + "Instance of 'SecurityGroup' has no 'id' member", + "111", + "SecurityGroup.delete" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/029_add_backup_datastore.py", + "no-member", + "Instance of 'Table' has no 'create_column' member", + "31", + "upgrade" + ], + [ + "trove/configuration/service.py", + "E1101", + "Instance of 'BuiltInstance' has no 'update_overrides' member", + "210", + "ConfigurationsController._refresh_on_all_instances" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/020_configurations.py", + "E1101", + "Instance of 'Table' has no 'drop_column' member", + "77", + "downgrade" + ], + [ + "trove/backup/models.py", + "E1101", + "Instance of 'DBBackup' has no 'id' member", + "351", + "DBBackup.check_swift_object_exist" + ], + [ + "trove/guestagent/datastore/experimental/postgresql/service/config.py", + "no-member", + "Instance of 'PgSqlConfig' has no 'configuration_manager' member", + "125", + "PgSqlConfig.start_db_with_conf_changes" + ], + [ + "trove/dns/designate/driver.py", + "no-member", + "Instance of 'Client' has no 'records' member", + "138", + "DesignateDriver._get_records" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/031_add_timestamps_to_configurations.py", + "E1101", + "Instance of 'Table' has no 'create_column' member", + "28", + "upgrade" + ], + [ + "trove/backup/models.py", + "E1101", + "Class 'DBBackup' has no 'tenant_id' member", + "194", + "Backup.list" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/007_add_volume_flavor.py", + "E1101", + "Instance of 'Table' has no 'drop_column' member", + "44", + "downgrade" + ], + [ + "trove/taskmanager/models.py", + "E1101", + "Instance of 'ResizeActionBase' has no '_initiate_nova_action' member", + "1818", + "ResizeActionBase._perform_nova_action" + ], + [ + "trove/taskmanager/manager.py", + "no-member", + "Instance of 'BuiltInstance' has no 'update_overrides' member", + "383", + "Manager.update_overrides" + ], + [ + "trove/backup/models.py", + "no-member", + "Instance of 'DBBackup' has no 'location' member", + "321", + "DBBackup.filename" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/016_add_datastore_type.py", + "no-member", + "Instance of 'Table' has no 'drop_column' member", + "61", + "upgrade" + ], + [ + "trove/backup/models.py", + "no-member", + "Instance of 'DBBackup' has no 'location' member", + "347", + "DBBackup.check_swift_object_exist" + ], + [ + "trove/guestagent/strategies/backup/base.py", + "E1101", + "Module 'eventlet.green.subprocess' has no 'PIPE' member", + "64", + "BackupRunner._run" + ], + [ + "trove/backup/models.py", + "no-member", + "Instance of 'DBBackup' has no 'datastore_version_id' member", + "339", + "DBBackup.datastore_version" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/020_configurations.py", + "E1101", + "Instance of 'Table' has no 'create_column' member", + "60", + "upgrade" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/031_add_timestamps_to_configurations.py", + "E1101", + "Instance of 'Table' has no 'drop_column' member", + "35", + "downgrade" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/030_add_master_slave.py", + "E1101", + "Instance of 'Table' has no 'create_column' member", + "31", + "upgrade" + ], + [ + "trove/common/wsgi.py", + "E0102", + "class already defined line 46", + "658", + "JSONDictSerializer" + ], + [ + "trove/common/extensions.py", + "no-member", + "Module 'lxml.etree' has no 'Element' member", + "492", + "ExtensionsXMLSerializer._populate_ext" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/007_add_volume_flavor.py", + "no-member", + "Instance of 'Table' has no 'create_column' member", + "32", + "upgrade" + ], + [ + "trove/db/sqlalchemy/migrate_repo/versions/031_add_timestamps_to_configurations.py", + "no-member", + "Instance of 'Table' has no 'create_column' member", + "28", + "upgrade" + ] + ], + "ignored_messages": [], + "ignored_files": [ + "trove/tests" + ], + "ignored_codes": [], + "always_error_messages": [ + "Undefined variable '_'", + "Undefined variable '_LE'", + "Undefined variable '_LI'", + "Undefined variable '_LW'", + "Undefined variable '_LC'" + ], + "folder": "trove", + "include": [ + "*.py" + ], + "options": [ + "--rcfile=./pylintrc", + "-E" + ], + "ignored_file_codes": [], + "ignored_file_messages": [] +} \ No newline at end of file diff --git a/tools/trove-pylint.py b/tools/trove-pylint.py new file mode 100755 index 0000000000..6406f8e736 --- /dev/null +++ b/tools/trove-pylint.py @@ -0,0 +1,339 @@ +#!/usr/bin/env python +# Copyright 2016 Tesora, Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from __future__ import print_function + +import fnmatch +import json +import os +import re +import sys + +from pylint import lint +from pylint.reporters import text +from six.moves import cStringIO as csio + +DEFAULT_CONFIG_FILE = "tools/trove-pylint.config" +DEFAULT_IGNORED_FILES = ['trove/tests'] +DEFAULT_IGNORED_CODES = [] +DEFAULT_IGNORED_MESSAGES = [] +DEFAULT_ALWAYS_ERROR = [ + "Undefined variable '_'", + "Undefined variable '_LE'", + "Undefined variable '_LI'", + "Undefined variable '_LW'", + "Undefined variable '_LC'"] + +MODE_CHECK = "check" +MODE_REBUILD = "rebuild" + +class Config(object): + def __init__(self, filename=DEFAULT_CONFIG_FILE): + + self.default_config = { + "include": ["*.py"], + "folder": "trove", + "options": ["--rcfile=./pylintrc", "-E"], + "ignored_files": DEFAULT_IGNORED_FILES, + "ignored_codes": DEFAULT_IGNORED_CODES, + "ignored_messages": DEFAULT_IGNORED_MESSAGES, + "ignored_file_codes": [], + "ignored_file_messages": [], + "ignored_file_code_messages": [], + "always_error_messages": DEFAULT_ALWAYS_ERROR + } + + self.config = self.default_config + + def save(self, filename=DEFAULT_CONFIG_FILE): + if os.path.isfile(filename): + os.rename(filename, "%s~" % filename) + + with open(filename, 'w') as fp: + json.dump(self.config, fp, encoding="utf-8", + indent=2, separators=(',', ': ')) + + def load(self, filename=DEFAULT_CONFIG_FILE): + self.config = self.default_config + + try: + with open(filename) as fp: + _c = json.load(fp, encoding="utf-8") + + self.config = _c + except Exception: + print("An error occured loading configuration, using default.") + return self + + def get(self, attribute): + return self.config[attribute] + + def is_file_ignored(self, f): + if any(f.startswith(i) + for i in self.config['ignored_files']): + return True + + return False + + def is_file_included(self, f): + if any(fnmatch.fnmatch(f, wc) for wc in self.config['include']): + return True + + return False + + def is_always_error(self, message): + if message in self.config['always_error_messages']: + return True + + return False + + def ignore(self, filename, code, codename, message): + # the high priority checks + if self.is_file_ignored(filename): + return True + + # never ignore messages + if self.is_always_error(message): + return False + + if code in self.config['ignored_codes']: + return True + + if codename in self.config['ignored_codes']: + return True + + if message and any(message.startswith(ignore_message) + for ignore_message + in self.config['ignored_messages']): + return True + + if filename and message and ( + [filename, message] in self.config['ignored_file_messages']): + return True + + if filename and code and ( + [filename, code] in self.config['ignored_file_codes']): + return True + + if filename and codename and ( + [filename, codename] in self.config['ignored_file_codes']): + return True + + fcm_ignore1 = [filename, codename, message] + fcm_ignore2 = [filename, codename, message] + for fcm in self.config['ignored_file_code_messages']: + if fcm_ignore1 == [fcm[0], fcm[1], fcm[2]]: + return True + + if fcm_ignore2 == [fcm[0], fcm[1], fcm[2]]: + return True + + return False + + def ignore_code(self, c): + _c = set(self.config['ignored_codes']) + _c.add(c) + self.config['ignored_codes'] = list(_c) + + def ignore_files(self, f): + _c = set(self.config['ignored_files']) + _c.add(f) + self.config['ignored_files'] = list(_c) + + def ignore_message(self, m): + _c = set(self.config['ignored_messages']) + _c.add(m) + self.config['ignored_messages'] = list(_c) + + def ignore_file_code(self, f, c): + _c = set(self.config['ignored_file_codes']) + _c.add((f, c)) + self.config['ignored_file_codes'] = list(_c) + + def ignore_file_message(self, f, m): + _c = set(self.config['ignored_file_messages']) + _c.add((f, m)) + self.config['ignored_file_messages'] = list(_c) + + def ignore_file_code_message(self, f, c, m, l, fn): + _c = set(self.config['ignored_file_code_messages']) + _c.add((f, c, m, l, fn)) + self.config['ignored_file_code_messages'] = list(_c) + +def main(): + if len(sys.argv) == 1 or sys.argv[1] == "check": + return check() + elif sys.argv[1] == "rebuild": + return rebuild() + elif sys.argv[1] == "initialize": + return initialize() + else: + return usage() + +def usage(): + print("Usage: %s [check|rebuild]" % sys.argv[0]) + print("\tUse this tool to perform a lint check of the trove project.") + print("\t check: perform the lint check.") + print("\t rebuild: rebuild the list of exceptions to ignore.") + return 0 + +class LintRunner(object): + def __init__(self): + self.config = Config() + self.idline = re.compile("^[*]* Module .*") + self.detail = re.compile("(\S+):(\d+): \[(\S+)\((\S+)\), (\S+)?] (.*)") + + def dolint(self, filename): + exceptions = set() + + buffer = csio() + reporter = text.ParseableTextReporter(output=buffer) + options = list(self.config.get('options')) + options.append(filename) + lint.Run(options, reporter=reporter, exit=False) + + output = buffer.getvalue() + buffer.close() + + for line in output.splitlines(): + if self.idline.match(line): + continue + + if self.detail.match(line): + mo = self.detail.search(line) + tokens = mo.groups() + fn = tokens[0] + ln = tokens[1] + code = tokens[2] + codename = tokens[3] + func = tokens[4] + message = tokens[5] + + if not self.config.ignore(fn, code, codename, message): + exceptions.add((fn, ln, code, codename, func, message)) + + return exceptions + + def process(self, mode=MODE_CHECK): + files_processed = 0 + files_with_errors = 0 + errors_recorded = 0 + exceptions_recorded = 0 + + for (root, dirs, files) in os.walk(self.config.get('folder')): + # if we shouldn't even bother about this part of the + # directory structure, we can punt quietly + if self.config.is_file_ignored(root): + continue + + # since we are walking top down, let's clean up the dirs + # that we will walk by eliminating any dirs that will + # end up getting ignored + for d in dirs: + p = os.path.join(root, d) + if self.config.is_file_ignored(p): + dirs.remove(d) + + # check if we can ignore the file and process if not + for f in files: + p = os.path.join(root, f) + if self.config.is_file_ignored(p): + continue + + if not self.config.is_file_included(f): + continue + + files_processed += 1 + exceptions = self.dolint(p) + file_had_errors = 0 + + for e in exceptions: + # what we do with this exception depents on the + # kind of exception, and the mode + if self.config.is_always_error(e[5]): + print("ERROR: %s %s: %s %s, %s: %s" % + (e[0], e[1], e[2], e[3], e[4], e[5])) + errors_recorded += 1 + file_had_errors += 1 + elif mode == MODE_REBUILD: + # parameters to ignore_file_code_message are + # filename, code, message, linenumber, and function + self.config.ignore_file_code_message(e[0], e[2], e[-1], e[1], e[4]) + self.config.ignore_file_code_message(e[0], e[3], e[-1], e[1], e[4]) + exceptions_recorded += 1 + elif mode == MODE_CHECK: + print("ERROR: %s %s: %s %s, %s: %s" % + (e[0], e[1], e[2], e[3], e[4], e[5])) + errors_recorded += 1 + file_had_errors += 1 + + + if file_had_errors: + files_with_errors += 1 + + return (files_processed, files_with_errors, errors_recorded, + exceptions_recorded) + + def rebuild(self): + self.initialize() + (files_processed, + files_with_errors, + errors_recorded, + exceptions_recorded) = self.process(mode=MODE_REBUILD) + + if files_with_errors > 0: + print("Rebuild failed. %s files processed, %s had errors, " + "%s errors recorded." % ( + files_processed, files_with_errors, errors_recorded)) + + return 1 + + self.config.save() + print("Rebuild completed. %s files processed, %s exceptions recorded." % + (files_processed, exceptions_recorded)) + return 0 + + def check(self): + self.config.load() + (files_processed, + files_with_errors, + errors_recorded, + exceptions_recorded) = self.process(mode=MODE_CHECK) + + if files_with_errors > 0: + print("Check failed. %s files processed, %s had errors, " + "%s errors recorded." % ( + files_processed, files_with_errors, errors_recorded)) + return 1 + + print("Check succeeded. %s files processed" % files_processed) + return 0 + + def initialize(self): + self.config.save() + return 0 + +def check(): + exit(LintRunner().check()) + +def rebuild(): + exit(LintRunner().rebuild()) + +def initialize(): + exit(LintRunner().initialize()) + + +if __name__ == "__main__": + main() + diff --git a/tox.ini b/tox.ini index 47445ad271..1f104ed226 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py{27,34,35},pep8,apiexamples,cover,api-ref,releasenotes,bandit,fakemodetests +envlist = py{27,34,35},pep8,apiexamples,cover,api-ref,releasenotes,bandit,fakemodetests,pylint minversion = 1.6 skipsdist = True @@ -91,3 +91,9 @@ commands = bandit -r trove -n5 -x tests [testenv:install-guide] commands = sphinx-build -a -E -W -d install-guide/build/doctrees -b html install-guide/source install-guide/build/html + +[testenv:pylint] +deps = -r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt +commands = {[testenv]commands} + python tools/trove-pylint.py check diff --git a/trove/common/cfg.py b/trove/common/cfg.py index c1e8af10ed..d75e92874d 100644 --- a/trove/common/cfg.py +++ b/trove/common/cfg.py @@ -23,6 +23,7 @@ from oslo_log import log as logging from oslo_middleware import cors from osprofiler import opts as profiler +from trove.common.i18n import _ from trove.version import version_info as version diff --git a/trove/common/debug_utils.py b/trove/common/debug_utils.py index 11c94c62e6..a2d4813782 100644 --- a/trove/common/debug_utils.py +++ b/trove/common/debug_utils.py @@ -21,6 +21,7 @@ import sys from oslo_config import cfg from oslo_log import log as logging +from trove.common.i18n import _ LOG = logging.getLogger(__name__) CONF = cfg.CONF diff --git a/trove/datastore/models.py b/trove/datastore/models.py index cd67019d67..07d70554d3 100644 --- a/trove/datastore/models.py +++ b/trove/datastore/models.py @@ -19,6 +19,7 @@ from oslo_log import log as logging from trove.common import cfg from trove.common import exception +from trove.common.i18n import _ from trove.common.remote import create_nova_client from trove.common import utils from trove.db import get_db_api diff --git a/trove/guestagent/datastore/experimental/mariadb/service.py b/trove/guestagent/datastore/experimental/mariadb/service.py index 8695bb5703..b1bb4f053c 100644 --- a/trove/guestagent/datastore/experimental/mariadb/service.py +++ b/trove/guestagent/datastore/experimental/mariadb/service.py @@ -16,6 +16,7 @@ from oslo_log import log as logging +from trove.common.i18n import _ from trove.guestagent.common import operating_system from trove.guestagent.datastore.galera_common import service as galera_service from trove.guestagent.datastore.mysql_common import service as mysql_service diff --git a/trove/guestagent/datastore/experimental/percona/service.py b/trove/guestagent/datastore/experimental/percona/service.py index 04ae20136a..b65e07585f 100644 --- a/trove/guestagent/datastore/experimental/percona/service.py +++ b/trove/guestagent/datastore/experimental/percona/service.py @@ -15,6 +15,8 @@ # from oslo_log import log as logging + +from trove.common.i18n import _ from trove.guestagent.datastore.mysql_common import service LOG = logging.getLogger(__name__) diff --git a/trove/guestagent/datastore/experimental/postgresql/pgutil.py b/trove/guestagent/datastore/experimental/postgresql/pgutil.py index dfaea065b5..43eb6376c9 100644 --- a/trove/guestagent/datastore/experimental/postgresql/pgutil.py +++ b/trove/guestagent/datastore/experimental/postgresql/pgutil.py @@ -16,6 +16,7 @@ import psycopg2 from trove.common import exception +from trove.common.i18n import _ PG_ADMIN = 'os_admin' diff --git a/trove/guestagent/datastore/experimental/postgresql/service/status.py b/trove/guestagent/datastore/experimental/postgresql/service/status.py index aee4d37eea..826f44b0f6 100644 --- a/trove/guestagent/datastore/experimental/postgresql/service/status.py +++ b/trove/guestagent/datastore/experimental/postgresql/service/status.py @@ -16,6 +16,7 @@ from oslo_log import log as logging import psycopg2 +from trove.common.i18n import _ from trove.common import instance from trove.common import utils from trove.guestagent.datastore.experimental.postgresql import pgutil diff --git a/trove/guestagent/strategies/restore/experimental/couchbase_impl.py b/trove/guestagent/strategies/restore/experimental/couchbase_impl.py index 7898d3991e..b2d387516b 100644 --- a/trove/guestagent/strategies/restore/experimental/couchbase_impl.py +++ b/trove/guestagent/strategies/restore/experimental/couchbase_impl.py @@ -21,6 +21,7 @@ import time from oslo_log import log as logging from trove.common import exception +from trove.common.i18n import _ from trove.common import utils from trove.guestagent.common import operating_system from trove.guestagent.datastore.experimental.couchbase import service diff --git a/trove/guestagent/strategies/restore/experimental/postgresql_impl.py b/trove/guestagent/strategies/restore/experimental/postgresql_impl.py index 9c213f6200..1459b76295 100644 --- a/trove/guestagent/strategies/restore/experimental/postgresql_impl.py +++ b/trove/guestagent/strategies/restore/experimental/postgresql_impl.py @@ -20,7 +20,6 @@ from eventlet.green import subprocess from oslo_log import log as logging from trove.common import cfg -from trove.common import exception from trove.common.i18n import _ from trove.common import stream_codecs from trove.guestagent.common import operating_system @@ -89,7 +88,7 @@ class PgDump(base.RestoreRunner): for message in err.splitlines(False): if not any(regex.match(message) for regex in self.IGNORED_ERROR_PATTERNS): - raise exception(message) + raise Exception(message) except OSError: pass