OLD | NEW |
1 # Copyright 2014 Michal Nowikowski. | 1 # Copyright 2014 Michal Nowikowski. |
2 # | 2 # |
3 # This program is free software; you can redistribute it and/or modify it under | 3 # This program is free software; you can redistribute it and/or modify it under |
4 # the terms of the GNU General Public License as published by the Free Software | 4 # the terms of the GNU General Public License as published by the Free Software |
5 # Foundation; either version 2 of the License, or (at your option) any later | 5 # Foundation; either version 2 of the License, or (at your option) any later |
6 # version. | 6 # version. |
7 # | 7 # |
8 # This program is distributed in the hope that it will be useful, but WITHOUT | 8 # This program is distributed in the hope that it will be useful, but WITHOUT |
9 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | 9 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
10 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details | 10 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 def open(self): | 90 def open(self): |
91 self.initialized = False | 91 self.initialized = False |
92 self.private_dict_file = None | 92 self.private_dict_file = None |
93 | 93 |
94 if enchant is None: | 94 if enchant is None: |
95 return | 95 return |
96 dict_name = self.config.spelling_dict | 96 dict_name = self.config.spelling_dict |
97 if not dict_name: | 97 if not dict_name: |
98 return | 98 return |
99 | 99 |
100 self.ignore_list = self.config.spelling_ignore_words.split(",") | 100 self.ignore_list = [w.strip() for w in self.config.spelling_ignore_words
.split(",")] |
101 # "param" appears in docstring in param description and | 101 # "param" appears in docstring in param description and |
102 # "pylint" appears in comments in pylint pragmas. | 102 # "pylint" appears in comments in pylint pragmas. |
103 self.ignore_list.extend(["param", "pylint"]) | 103 self.ignore_list.extend(["param", "pylint"]) |
104 | 104 |
105 if self.config.spelling_private_dict_file: | 105 if self.config.spelling_private_dict_file: |
106 self.spelling_dict = enchant.DictWithPWL( | 106 self.spelling_dict = enchant.DictWithPWL( |
107 dict_name, self.config.spelling_private_dict_file) | 107 dict_name, self.config.spelling_private_dict_file) |
108 self.private_dict_file = open( | 108 self.private_dict_file = open( |
109 self.config.spelling_private_dict_file, "a") | 109 self.config.spelling_private_dict_file, "a") |
110 else: | 110 else: |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 | 232 |
233 # Go through lines of docstring | 233 # Go through lines of docstring |
234 for idx, line in enumerate(docstring.splitlines()): | 234 for idx, line in enumerate(docstring.splitlines()): |
235 self._check_spelling('wrong-spelling-in-docstring', | 235 self._check_spelling('wrong-spelling-in-docstring', |
236 line, start_line + idx) | 236 line, start_line + idx) |
237 | 237 |
238 | 238 |
239 def register(linter): | 239 def register(linter): |
240 """required method to auto register this checker """ | 240 """required method to auto register this checker """ |
241 linter.register_checker(SpellingChecker(linter)) | 241 linter.register_checker(SpellingChecker(linter)) |
OLD | NEW |