summaryrefslogtreecommitdiff
path: root/pylint/pyreverse
diff options
context:
space:
mode:
authorRobert Hofer <hofrob@protonmail.com>2022-10-30 16:26:07 +0100
committerDaniƫl van Noord <13665637+DanielNoord@users.noreply.github.com>2022-11-09 20:39:00 +0100
commit0507ee37f45cb3c9dcaf64036dd1b7f3c88ae690 (patch)
tree7ec3b2adc6e9841ec73d7f4aa5ac58ce36e24808 /pylint/pyreverse
parent5ae5842fa02021e086d66218d326c708e6433318 (diff)
downloadpylint-git-0507ee37f45cb3c9dcaf64036dd1b7f3c88ae690.tar.gz
Add R1737 use-dict-literal-without-kwargs
Diffstat (limited to 'pylint/pyreverse')
-rw-r--r--pylint/pyreverse/dot_printer.py16
-rw-r--r--pylint/pyreverse/main.py220
-rw-r--r--pylint/pyreverse/vcg_printer.py35
3 files changed, 142 insertions, 129 deletions
diff --git a/pylint/pyreverse/dot_printer.py b/pylint/pyreverse/dot_printer.py
index 5ec5858fc..7579d2877 100644
--- a/pylint/pyreverse/dot_printer.py
+++ b/pylint/pyreverse/dot_printer.py
@@ -29,13 +29,17 @@ SHAPES: dict[NodeType, str] = {
NodeType.INTERFACE: "record",
NodeType.CLASS: "record",
}
+# pylint: disable-next=consider-using-namedtuple-or-dataclass
ARROWS: dict[EdgeType, dict[str, str]] = {
- EdgeType.INHERITS: dict(arrowtail="none", arrowhead="empty"),
- EdgeType.IMPLEMENTS: dict(arrowtail="node", arrowhead="empty", style="dashed"),
- EdgeType.ASSOCIATION: dict(
- fontcolor="green", arrowtail="none", arrowhead="diamond", style="solid"
- ),
- EdgeType.USES: dict(arrowtail="none", arrowhead="open"),
+ EdgeType.INHERITS: {"arrowtail": "none", "arrowhead": "empty"},
+ EdgeType.IMPLEMENTS: {"arrowtail": "node", "arrowhead": "empty", "style": "dashed"},
+ EdgeType.ASSOCIATION: {
+ "fontcolor": "green",
+ "arrowtail": "none",
+ "arrowhead": "diamond",
+ "style": "solid",
+ },
+ EdgeType.USES: {"arrowtail": "none", "arrowhead": "open"},
}
diff --git a/pylint/pyreverse/main.py b/pylint/pyreverse/main.py
index 043e2a3f3..010ce47e9 100644
--- a/pylint/pyreverse/main.py
+++ b/pylint/pyreverse/main.py
@@ -36,14 +36,14 @@ DIRECTLY_SUPPORTED_FORMATS = (
OPTIONS: Options = (
(
"filter-mode",
- dict(
- short="f",
- default="PUB_ONLY",
- dest="mode",
- type="string",
- action="store",
- metavar="<mode>",
- help="""filter attributes and functions according to
+ {
+ "short": "f",
+ "default": "PUB_ONLY",
+ "dest": "mode",
+ "type": "string",
+ "action": "store",
+ "metavar": "<mode>",
+ "help": """filter attributes and functions according to
<mode>. Correct modes are :
'PUB_ONLY' filter all non public attributes
[DEFAULT], equivalent to PRIVATE+SPECIAL_A
@@ -52,154 +52,154 @@ OPTIONS: Options = (
except constructor
'OTHER' filter protected and private
attributes""",
- ),
+ },
),
(
"class",
- dict(
- short="c",
- action="extend",
- metavar="<class>",
- type="csv",
- dest="classes",
- default=None,
- help="create a class diagram with all classes related to <class>;\
+ {
+ "short": "c",
+ "action": "extend",
+ "metavar": "<class>",
+ "type": "csv",
+ "dest": "classes",
+ "default": None,
+ "help": "create a class diagram with all classes related to <class>;\
this uses by default the options -ASmy",
- ),
+ },
),
(
"show-ancestors",
- dict(
- short="a",
- action="store",
- metavar="<ancestor>",
- type="int",
- default=None,
- help="show <ancestor> generations of ancestor classes not in <projects>",
- ),
+ {
+ "short": "a",
+ "action": "store",
+ "metavar": "<ancestor>",
+ "type": "int",
+ "default": None,
+ "help": "show <ancestor> generations of ancestor classes not in <projects>",
+ },
),
(
"all-ancestors",
- dict(
- short="A",
- default=None,
- action="store_true",
- help="show all ancestors off all classes in <projects>",
- ),
+ {
+ "short": "A",
+ "default": None,
+ "action": "store_true",
+ "help": "show all ancestors off all classes in <projects>",
+ },
),
(
"show-associated",
- dict(
- short="s",
- action="store",
- metavar="<association_level>",
- type="int",
- default=None,
- help="show <association_level> levels of associated classes not in <projects>",
- ),
+ {
+ "short": "s",
+ "action": "store",
+ "metavar": "<association_level>",
+ "type": "int",
+ "default": None,
+ "help": "show <association_level> levels of associated classes not in <projects>",
+ },
),
(
"all-associated",
- dict(
- short="S",
- default=None,
- action="store_true",
- help="show recursively all associated off all associated classes",
- ),
+ {
+ "short": "S",
+ "default": None,
+ "action": "store_true",
+ "help": "show recursively all associated off all associated classes",
+ },
),
(
"show-builtin",
- dict(
- short="b",
- action="store_true",
- default=False,
- help="include builtin objects in representation of classes",
- ),
+ {
+ "short": "b",
+ "action": "store_true",
+ "default": False,
+ "help": "include builtin objects in representation of classes",
+ },
),
(
"module-names",
- dict(
- short="m",
- default=None,
- type="yn",
- metavar="<y or n>",
- help="include module name in representation of classes",
- ),
+ {
+ "short": "m",
+ "default": None,
+ "type": "yn",
+ "metavar": "<y or n>",
+ "help": "include module name in representation of classes",
+ },
),
(
"only-classnames",
- dict(
- short="k",
- action="store_true",
- default=False,
- help="don't show attributes and methods in the class boxes; this disables -f values",
- ),
+ {
+ "short": "k",
+ "action": "store_true",
+ "default": False,
+ "help": "don't show attributes and methods in the class boxes; this disables -f values",
+ },
),
(
"output",
- dict(
- short="o",
- dest="output_format",
- action="store",
- default="dot",
- metavar="<format>",
- type="string",
- help=(
+ {
+ "short": "o",
+ "dest": "output_format",
+ "action": "store",
+ "default": "dot",
+ "metavar": "<format>",
+ "type": "string",
+ "help": (
f"create a *.<format> output file if format is available. Available formats are: {', '.join(DIRECTLY_SUPPORTED_FORMATS)}. "
f"Any other format will be tried to create by means of the 'dot' command line tool, which requires a graphviz installation."
),
- ),
+ },
),
(
"colorized",
- dict(
- dest="colorized",
- action="store_true",
- default=False,
- help="Use colored output. Classes/modules of the same package get the same color.",
- ),
+ {
+ "dest": "colorized",
+ "action": "store_true",
+ "default": False,
+ "help": "Use colored output. Classes/modules of the same package get the same color.",
+ },
),
(
"max-color-depth",
- dict(
- dest="max_color_depth",
- action="store",
- default=2,
- metavar="<depth>",
- type="int",
- help="Use separate colors up to package depth of <depth>",
- ),
+ {
+ "dest": "max_color_depth",
+ "action": "store",
+ "default": 2,
+ "metavar": "<depth>",
+ "type": "int",
+ "help": "Use separate colors up to package depth of <depth>",
+ },
),
(
"ignore",
- dict(
- type="csv",
- metavar="<file[,file...]>",
- dest="ignore_list",
- default=constants.DEFAULT_IGNORE_LIST,
- help="Files or directories to be skipped. They should be base names, not paths.",
- ),
+ {
+ "type": "csv",
+ "metavar": "<file[,file...]>",
+ "dest": "ignore_list",
+ "default": constants.DEFAULT_IGNORE_LIST,
+ "help": "Files or directories to be skipped. They should be base names, not paths.",
+ },
),
(
"project",
- dict(
- default="",
- type="string",
- short="p",
- metavar="<project name>",
- help="set the project name.",
- ),
+ {
+ "default": "",
+ "type": "string",
+ "short": "p",
+ "metavar": "<project name>",
+ "help": "set the project name.",
+ },
),
(
"output-directory",
- dict(
- default="",
- type="path",
- short="d",
- action="store",
- metavar="<output_directory>",
- help="set the output directory path.",
- ),
+ {
+ "default": "",
+ "type": "path",
+ "short": "d",
+ "action": "store",
+ "metavar": "<output_directory>",
+ "help": "set the output directory path.",
+ },
),
)
diff --git a/pylint/pyreverse/vcg_printer.py b/pylint/pyreverse/vcg_printer.py
index 7a1d2d02d..6f28a24e8 100644
--- a/pylint/pyreverse/vcg_printer.py
+++ b/pylint/pyreverse/vcg_printer.py
@@ -154,20 +154,29 @@ SHAPES: dict[NodeType, str] = {
NodeType.CLASS: "box",
NodeType.INTERFACE: "ellipse",
}
+# pylint: disable-next=consider-using-namedtuple-or-dataclass
ARROWS: dict[EdgeType, dict[str, str | int]] = {
- EdgeType.USES: dict(arrowstyle="solid", backarrowstyle="none", backarrowsize=0),
- EdgeType.INHERITS: dict(
- arrowstyle="solid", backarrowstyle="none", backarrowsize=10
- ),
- EdgeType.IMPLEMENTS: dict(
- arrowstyle="solid",
- backarrowstyle="none",
- linestyle="dotted",
- backarrowsize=10,
- ),
- EdgeType.ASSOCIATION: dict(
- arrowstyle="solid", backarrowstyle="none", textcolor="green"
- ),
+ EdgeType.USES: {
+ "arrowstyle": "solid",
+ "backarrowstyle": "none",
+ "backarrowsize": 0,
+ },
+ EdgeType.INHERITS: {
+ "arrowstyle": "solid",
+ "backarrowstyle": "none",
+ "backarrowsize": 10,
+ },
+ EdgeType.IMPLEMENTS: {
+ "arrowstyle": "solid",
+ "backarrowstyle": "none",
+ "linestyle": "dotted",
+ "backarrowsize": 10,
+ },
+ EdgeType.ASSOCIATION: {
+ "arrowstyle": "solid",
+ "backarrowstyle": "none",
+ "textcolor": "green",
+ },
}
ORIENTATION: dict[Layout, str] = {
Layout.LEFT_TO_RIGHT: "left_to_right",