3 # Copyright 2010 The Closure Linter Authors. All Rights Reserved.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS-IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 """Linter error rules class for Closure Linter."""
19 __author__ = 'robbyw@google.com (Robert Walker)'
21 import gflags as flags
22 from closure_linter import errors
26 flags.DEFINE_boolean('jsdoc', True,
27 'Whether to report errors for missing JsDoc.')
30 def ShouldReportError(error):
31 """Whether the given error should be reported.
34 True for all errors except missing documentation errors. For these,
35 it returns the value of the jsdoc flag.
37 return FLAGS.jsdoc or error not in (
38 errors.MISSING_PARAMETER_DOCUMENTATION,
39 errors.MISSING_RETURN_DOCUMENTATION,
40 errors.MISSING_MEMBER_DOCUMENTATION,
41 errors.MISSING_PRIVATE,
42 errors.MISSING_JSDOC_TAG_THIS)