1# -*- coding: utf-8 -*- 2 3# Copyright (c) 2020 - 2021 Detlev Offenbach <detlev@die-offenbachs.de> 4# 5 6 7""" 8Module implementing message translations for the code style plugin messages 9(code documentation part). 10""" 11 12from PyQt5.QtCore import QCoreApplication 13 14_docStyleMessages = { 15 "D101": QCoreApplication.translate( 16 "DocStyleChecker", "module is missing a docstring"), 17 "D102": QCoreApplication.translate( 18 "DocStyleChecker", 19 "public function/method is missing a docstring"), 20 "D103": QCoreApplication.translate( 21 "DocStyleChecker", 22 "private function/method may be missing a docstring"), 23 "D104": QCoreApplication.translate( 24 "DocStyleChecker", "public class is missing a docstring"), 25 "D105": QCoreApplication.translate( 26 "DocStyleChecker", "private class may be missing a docstring"), 27 "D111": QCoreApplication.translate( 28 "DocStyleChecker", 'docstring not surrounded by """'), 29 "D112": QCoreApplication.translate( 30 "DocStyleChecker", 31 'docstring containing \\ not surrounded by r"""'), 32 "D121": QCoreApplication.translate( 33 "DocStyleChecker", "one-liner docstring on multiple lines"), 34 "D122": QCoreApplication.translate( 35 "DocStyleChecker", "docstring has wrong indentation"), 36 "D130": QCoreApplication.translate( 37 "DocStyleChecker", "docstring does not contain a summary"), 38 "D131": QCoreApplication.translate( 39 "DocStyleChecker", "docstring summary does not end with a period"), 40 "D132": QCoreApplication.translate( 41 "DocStyleChecker", 42 "docstring summary is not in imperative mood" 43 " (Does instead of Do)"), 44 "D133": QCoreApplication.translate( 45 "DocStyleChecker", 46 "docstring summary looks like a function's/method's signature"), 47 "D134": QCoreApplication.translate( 48 "DocStyleChecker", 49 "docstring does not mention the return value type"), 50 "D141": QCoreApplication.translate( 51 "DocStyleChecker", 52 "function/method docstring is separated by a blank line"), 53 "D142": QCoreApplication.translate( 54 "DocStyleChecker", 55 "class docstring is not preceded by a blank line"), 56 "D143": QCoreApplication.translate( 57 "DocStyleChecker", 58 "class docstring is not followed by a blank line"), 59 "D144": QCoreApplication.translate( 60 "DocStyleChecker", 61 "docstring summary is not followed by a blank line"), 62 "D145": QCoreApplication.translate( 63 "DocStyleChecker", 64 "last paragraph of docstring is not followed by a blank line"), 65 66 "D201": QCoreApplication.translate( 67 "DocStyleChecker", "module docstring is still a default string"), 68 "D202.1": QCoreApplication.translate( 69 "DocStyleChecker", "function docstring is still a default string"), 70 "D202.2": QCoreApplication.translate( 71 "DocStyleChecker", 72 "function docstring still contains some placeholders"), 73 "D203": QCoreApplication.translate( 74 "DocStyleChecker", 75 "private function/method is missing a docstring"), 76 "D205": QCoreApplication.translate( 77 "DocStyleChecker", "private class is missing a docstring"), 78 "D206": QCoreApplication.translate( 79 "DocStyleChecker", "class docstring is still a default string"), 80 "D221": QCoreApplication.translate( 81 "DocStyleChecker", 82 "leading quotes of docstring not on separate line"), 83 "D222": QCoreApplication.translate( 84 "DocStyleChecker", 85 "trailing quotes of docstring not on separate line"), 86 "D231": QCoreApplication.translate( 87 "DocStyleChecker", "docstring summary does not end with a period"), 88 "D232": QCoreApplication.translate( 89 "DocStyleChecker", "docstring summary does not start with '{0}'"), 90 "D234r": QCoreApplication.translate( 91 "DocStyleChecker", 92 "docstring does not contain a @return line but function/method" 93 " returns something"), 94 "D235r": QCoreApplication.translate( 95 "DocStyleChecker", 96 "docstring contains a @return line but function/method doesn't" 97 " return anything"), 98 "D234y": QCoreApplication.translate( 99 "DocStyleChecker", 100 "docstring does not contain a @yield line but function/method" 101 " yields something"), 102 "D235y": QCoreApplication.translate( 103 "DocStyleChecker", 104 "docstring contains a @yield line but function/method doesn't" 105 " yield anything"), 106 "D236": QCoreApplication.translate( 107 "DocStyleChecker", 108 "docstring does not contain enough @param/@keyparam lines"), 109 "D237": QCoreApplication.translate( 110 "DocStyleChecker", 111 "docstring contains too many @param/@keyparam lines"), 112 "D238": QCoreApplication.translate( 113 "DocStyleChecker", 114 "keyword only arguments must be documented with @keyparam lines"), 115 "D239": QCoreApplication.translate( 116 "DocStyleChecker", "order of @param/@keyparam lines does" 117 " not match the function/method signature"), 118 "D242": QCoreApplication.translate( 119 "DocStyleChecker", "class docstring is preceded by a blank line"), 120 "D243": QCoreApplication.translate( 121 "DocStyleChecker", "class docstring is followed by a blank line"), 122 "D244": QCoreApplication.translate( 123 "DocStyleChecker", 124 "function/method docstring is preceded by a blank line"), 125 "D245": QCoreApplication.translate( 126 "DocStyleChecker", 127 "function/method docstring is followed by a blank line"), 128 "D246": QCoreApplication.translate( 129 "DocStyleChecker", 130 "docstring summary is not followed by a blank line"), 131 "D247": QCoreApplication.translate( 132 "DocStyleChecker", 133 "last paragraph of docstring is followed by a blank line"), 134 "D250": QCoreApplication.translate( 135 "DocStyleChecker", 136 "docstring does not contain a @exception line but function/method" 137 " raises an exception"), 138 "D251": QCoreApplication.translate( 139 "DocStyleChecker", 140 "docstring contains a @exception line but function/method doesn't" 141 " raise an exception"), 142 "D252": QCoreApplication.translate( 143 "DocStyleChecker", 144 "raised exception '{0}' is not documented in docstring"), 145 "D253": QCoreApplication.translate( 146 "DocStyleChecker", 147 "documented exception '{0}' is not raised"), 148 "D260": QCoreApplication.translate( 149 "DocStyleChecker", 150 "docstring does not contain a @signal line but class defines signals"), 151 "D261": QCoreApplication.translate( 152 "DocStyleChecker", 153 "docstring contains a @signal line but class doesn't define signals"), 154 "D262": QCoreApplication.translate( 155 "DocStyleChecker", 156 "defined signal '{0}' is not documented in docstring"), 157 "D263": QCoreApplication.translate( 158 "DocStyleChecker", 159 "documented signal '{0}' is not defined"), 160} 161 162_docStyleMessagesSampleArgs = { 163 "D232": ["public"], 164 "D252": ["RuntimeError"], 165 "D253": ["RuntimeError"], 166 "D262": ["buttonClicked"], 167 "D263": ["buttonClicked"], 168} 169