[pitivi] Update pylint rules
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] Update pylint rules
- Date: Mon, 11 Nov 2019 22:04:28 +0000 (UTC)
commit 8c4b01d681152b88bb808103f80d64573c5034d5
Author: Alexandru Băluț <alexandru balut gmail com>
Date: Wed Oct 30 00:06:44 2019 +0100
Update pylint rules
pitivi/utils/custom_effect_widgets.py | 2 -
pylint.rc | 127 ++++++++++++++++++++++++++++------
2 files changed, 107 insertions(+), 22 deletions(-)
---
diff --git a/pitivi/utils/custom_effect_widgets.py b/pitivi/utils/custom_effect_widgets.py
index d7bdcb21..041d4fb9 100644
--- a/pitivi/utils/custom_effect_widgets.py
+++ b/pitivi/utils/custom_effect_widgets.py
@@ -382,7 +382,6 @@ def create_alphaspot_widget(effect_prop_manager, element_setting_widget, element
def shape_picker_value_changed_cb(unused):
"""Handles the selection of shape via combobox."""
- # pylint: disable=unsubscriptable-object
v = shape_list[shape_picker.get_active()][1]
from pitivi.undo.timeline import CommitTimelineFinalizingAction
@@ -424,7 +423,6 @@ def create_alphaspot_widget(effect_prop_manager, element_setting_widget, element
def op_picker_value_changed_cb(unused):
"""Handles the selection of op via combobox."""
- # pylint: disable=unsubscriptable-object
v = op_list[op_picker.get_active()][1]
from pitivi.undo.timeline import CommitTimelineFinalizingAction
diff --git a/pylint.rc b/pylint.rc
index e5ca43ef..77e872c5 100644
--- a/pylint.rc
+++ b/pylint.rc
@@ -1,32 +1,117 @@
-# lint Python modules using external checkers.
-#
-# This is the main checker controlling the other ones and the reports
-# generation. It is itself both a raw checker and an astng checker in order
-# to:
-# * handle message activation / deactivation at the module level
-# * handle some basic but necessary stats'data (number of classes, methods...)
-#
[MASTER]
-# Python code to execute, usually for sys.path manipulation such as
+# Python code to execute
init-hook='import gi; gi.require_version("Gtk", "3.0"); gi.require_version("Gst", "1.0"); from gi.repository
import Gst; Gst.init(None); gi.require_version("GES", "1.0"); from gi.repository import GES; GES.init()'
+# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the
+# number of processors available to use.
+jobs=0
+
+# Control the amount of potential inferred values when inferring a single
+# object. This can help the performance when dealing with large functions or
+# complex, nested conditions.
+limit-inference-results=100
+
+# List of plugins (as comma separated values of python module names) to load,
+# usually to register additional checkers.
+load-plugins=
+
+# Pickle collected data for later comparisons.
+persistent=no
+
+# When enabled, pylint would attempt to guess common misconfiguration and emit
+# user-friendly hints instead of false-positive error messages.
+suggestion-mode=yes
+
[MESSAGES CONTROL]
-# Disable useless messages:
-# import-outside-toplevel
-# no-member - Instance ... has no member ...
-# similarities - Expensive detection of copy/pasted code
-# too-few-public-methods
-# too-many-lines - Modules have more than max-line-length lines
-disable=import-outside-toplevel,no-member,similarities,too-few-public-methods,too-many-lines
+# Disable the message, report, category or checker with the given id(s). You
+# can either give multiple identifiers separated by comma (,) or put this
+# option multiple times (only on the command line, not in the configuration
+# file where it should appear only once). You can also use "--disable=all" to
+# disable everything first and then reenable specific checks. For example, if
+# you want to run only the similarities checker, you can use "--disable=all
+# --enable=similarities". If you want to run only the classes checker, but have
+# no Warning level messages displayed, use "--disable=all --enable=classes
+# --disable=W".
+disable=access-member-before-definition,
+ arguments-differ, # Pylint fails at this with the Gtk do_* methods, so no thanks.
+ assignment-from-none, # Most probably subclasses return something else.
+ global-statement,
+ import-outside-toplevel,
+ no-else-return, # Looks better in some cases.
+ no-member,
+ no-self-use, # We love self.
+ not-an-iterable,
+ possibly-unused-variable,
+ similarities, # It's expensive and not very useful.
+ too-few-public-methods,
+ too-many-ancestors,
+ too-many-arguments,
+ too-many-boolean-expressions,
+ too-many-branches,
+ too-many-instance-attributes,
+ too-many-lines,
+ too-many-locals,
+ too-many-nested-blocks,
+ too-many-public-methods,
+ too-many-return-statements,
+ too-many-statements,
+ ungrouped-imports, # We have a different tool for imports.
+ unsubscriptable-object,
+ C0114, # We have a different tool for docstrings.
+ C0115,
+ C0116
+
+
+[REPORTS]
+
+# Python expression which should return a score less than or equal to 10. You
+# have access to the variables 'error', 'warning', 'refactor', and 'convention'
+# which contain the number of messages in each category, as well as 'statement'
+# which is the total number of statements analyzed. This score is used by the
+# global evaluation report (RP0004).
+evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
+
+# Template used to display messages. This is a python new-style format string
+# used to format the message information. See doc for all details.
+#msg-template=
+
+# Set the output format. Available formats are text, parseable, colorized, json
+# and msvs (visual studio). You can also give a reporter class, e.g.
+# mypackage.mymodule.MyReporterClass.
+output-format=text
+
+# Tells whether to display a full report or only the messages.
+reports=no
+
+# Activate the evaluation score.
+score=yes
+
+
+[REFACTORING]
+
+# Maximum number of nested blocks for function / method body
+max-nested-blocks=5
+
+# Complete name of functions that never returns. When checking for
+# inconsistent-return-statements if a never returning function is called then
+# it will be considered as an explicit return statement and no message will be
+# printed.
+never-returning-functions=sys.exit
[VARIABLES]
+# List of strings which can identify a callback function by name. A callback
+# name must start or end with one of those strings.
+callbacks=do_,
+ _cb,
+ _func
+
# A regular expression matching names used for dummy variables (i.e. not used).
-dummy-variables-rgx=_|dummy|unused_.*
+dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored|^unused
[BASIC]
@@ -39,7 +124,8 @@ no-docstring-rgx=((_.*)|(do_.*))
module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
# Regular expression which should only match correct module level names
-const-rgx=(([A-Z_][A-Z1-9_]*)|(__.*__))$
+# This includes variable-rgx!
+const-rgx=(([A-Z_][A-Z1-9_]*)|(__.*__))$|[a-z_][a-z0-9_]{1,30}$
# Regular expression which should only match correct class names
class-rgx=[A-Z_][a-zA-Z0-9]+$
@@ -48,7 +134,7 @@ class-rgx=[A-Z_][a-zA-Z0-9]+$
function-rgx=[a-z_][a-z0-9_]{2,30}$
# Regular expression which should only match correct method names
-method-rgx=[a-z_][a-zA-Z0-9_]{2,30}$
+method-rgx=[a-z_][a-zA-Z0-9_]{2,50}$|__[a-z_]{2,100}|test_[a-z_]{2,100}$|do$
# Naming hint for method names
method-name-hint=[a-z_][a-zA-Z0-9_]{2,30}$
@@ -60,6 +146,7 @@ attr-rgx=[a-z_][a-z0-9_]{2,30}$
argument-rgx=[a-z_][a-z0-9_]{1,30}$
# Regular expression which should only match correct variable names
+# If you change this, update the const-rgx suffix!
variable-rgx=[a-z_][a-z0-9_]{1,30}$
# Regular expression which should only match correct list comprehension /
@@ -67,7 +154,7 @@ variable-rgx=[a-z_][a-z0-9_]{1,30}$
inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
# Good variable names which should always be accepted, separated by a comma
-good-names=x,y,z,i,j,k,ex,Run,_
+good-names=x,y,z,i,j,k,e,w,h,_
# Bad variable names which should always be refused, separated by a comma
bad-names=foo,bar,baz,toto,tutu,tata
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]