lgtm: fix Missing call to __init__ during object initialization
Either mark the missing calls as intentional, or explicetly call the right __init__ method and avoid mixing super() and explicit base calss calls.
This commit is contained in:
parent
268d59516f
commit
fe853ee516
|
@ -613,6 +613,7 @@ class GnuDCompiler(DCompiler, GnuCompiler):
|
|||
def __init__(self, exelist, version, for_machine: MachineChoice,
|
||||
info: 'MachineInfo', is_cross, exe_wrapper, arch, **kwargs):
|
||||
DCompiler.__init__(self, exelist, version, for_machine, info, is_cross, exe_wrapper, arch, **kwargs)
|
||||
GnuCompiler.__init__(self, {})
|
||||
self.id = 'gcc'
|
||||
default_warn_args = ['-Wall', '-Wdeprecated']
|
||||
self.warn_args = {'0': [],
|
||||
|
|
|
@ -1896,7 +1896,7 @@ class ExternalProgram:
|
|||
return self.name
|
||||
|
||||
|
||||
class NonExistingExternalProgram(ExternalProgram):
|
||||
class NonExistingExternalProgram(ExternalProgram): # lgtm [py/missing-call-to-init]
|
||||
"A program that will never exist"
|
||||
|
||||
def __init__(self, name='nonexistingprogram'):
|
||||
|
@ -1912,7 +1912,7 @@ class NonExistingExternalProgram(ExternalProgram):
|
|||
return False
|
||||
|
||||
|
||||
class EmptyExternalProgram(ExternalProgram):
|
||||
class EmptyExternalProgram(ExternalProgram): # lgtm [py/missing-call-to-init]
|
||||
'''
|
||||
A program object that returns an empty list of commands. Used for cases
|
||||
such as a cross file exe_wrapper to represent that it's not required.
|
||||
|
|
|
@ -137,7 +137,7 @@ class IntelVisualStudioLinker(VisualStudioLikeLinker, StaticLinker):
|
|||
class ArLinker(StaticLinker):
|
||||
|
||||
def __init__(self, exelist: typing.List[str]):
|
||||
super().__init__(exelist)
|
||||
StaticLinker.__init__(self, exelist)
|
||||
self.id = 'ar'
|
||||
pc, stdo = mesonlib.Popen_safe(self.exelist + ['-h'])[0:2]
|
||||
# Enable deterministic builds if they are available.
|
||||
|
@ -153,7 +153,7 @@ class ArLinker(StaticLinker):
|
|||
return [target]
|
||||
|
||||
|
||||
class ArmarLinker(ArLinker):
|
||||
class ArmarLinker(ArLinker): # lgtm [py/missing-call-to-init]
|
||||
|
||||
def __init__(self, exelist: typing.List[str]):
|
||||
StaticLinker.__init__(self, exelist)
|
||||
|
@ -167,7 +167,7 @@ class ArmarLinker(ArLinker):
|
|||
|
||||
class DLinker(StaticLinker):
|
||||
def __init__(self, exelist: typing.List[str], arch: str):
|
||||
super().__init__(exelist)
|
||||
StaticLinker.__init__(self, exelist)
|
||||
self.id = exelist[0]
|
||||
self.arch = arch
|
||||
|
||||
|
@ -190,7 +190,7 @@ class DLinker(StaticLinker):
|
|||
class CcrxLinker(StaticLinker):
|
||||
|
||||
def __init__(self, exelist: typing.List[str]):
|
||||
super().__init__(exelist)
|
||||
StaticLinker.__init__(self, exelist)
|
||||
self.id = 'rlink'
|
||||
|
||||
def can_linker_accept_rsp(self) -> bool:
|
||||
|
@ -682,8 +682,8 @@ class CcrxDynamicLinker(DynamicLinker):
|
|||
|
||||
def __init__(self, for_machine: mesonlib.MachineChoice,
|
||||
*, version: str = 'unknown version'):
|
||||
super().__init__(['rlink.exe'], for_machine, 'rlink', '',
|
||||
version=version)
|
||||
DynamicLinker.__init__(self, ['rlink.exe'], for_machine, 'rlink', '',
|
||||
version=version)
|
||||
|
||||
def get_accepts_rsp(self) -> bool:
|
||||
return False
|
||||
|
@ -715,8 +715,8 @@ class ArmDynamicLinker(PosixDynamicLinkerMixin, DynamicLinker):
|
|||
|
||||
def __init__(self, for_machine: mesonlib.MachineChoice,
|
||||
*, version: str = 'unknown version'):
|
||||
super().__init__(['armlink'], for_machine, 'armlink', '',
|
||||
version=version)
|
||||
DynamicLinker.__init__(self, ['armlink'], for_machine, 'armlink', '',
|
||||
version=version)
|
||||
|
||||
def get_accepts_rsp(self) -> bool:
|
||||
return False
|
||||
|
@ -773,7 +773,7 @@ class PGIDynamicLinker(PosixDynamicLinkerMixin, DynamicLinker):
|
|||
|
||||
class PGIStaticLinker(StaticLinker):
|
||||
def __init__(self, exelist: typing.List[str]):
|
||||
super().__init__(exelist)
|
||||
StaticLinker.__init__(self, exelist)
|
||||
self.id = 'ar'
|
||||
self.std_args = ['-r']
|
||||
|
||||
|
@ -796,8 +796,7 @@ class VisualStudioLikeLinkerMixin:
|
|||
'custom': [],
|
||||
} # type: typing.Dict[str, typing.List[str]]
|
||||
|
||||
def __init__(self, *args, direct: bool = True, machine: str = 'x86', **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
def __init__(self, direct: bool = True, machine: str = 'x86'):
|
||||
self.direct = direct
|
||||
self.machine = machine
|
||||
|
||||
|
@ -857,8 +856,9 @@ class MSVCDynamicLinker(VisualStudioLikeLinkerMixin, DynamicLinker):
|
|||
exelist: typing.Optional[typing.List[str]] = None,
|
||||
prefix: typing.Union[str, typing.List[str]] = '',
|
||||
machine: str = 'x86', version: str = 'unknown version'):
|
||||
super().__init__(exelist or ['link.exe'], for_machine, 'link',
|
||||
prefix, machine=machine, version=version)
|
||||
VisualStudioLikeLinkerMixin.__init__(self, machine=machine)
|
||||
DynamicLinker.__init__(self, exelist or ['link.exe'], for_machine, 'link',
|
||||
prefix, version=version)
|
||||
|
||||
|
||||
class ClangClDynamicLinker(VisualStudioLikeLinkerMixin, DynamicLinker):
|
||||
|
@ -869,8 +869,9 @@ class ClangClDynamicLinker(VisualStudioLikeLinkerMixin, DynamicLinker):
|
|||
exelist: typing.Optional[typing.List[str]] = None,
|
||||
prefix: typing.Union[str, typing.List[str]] = '',
|
||||
version: str = 'unknown version'):
|
||||
super().__init__(exelist or ['lld-link.exe'], for_machine,
|
||||
'lld-link', prefix, version=version)
|
||||
VisualStudioLikeLinkerMixin.__init__(self)
|
||||
DynamicLinker.__init__(self, exelist or ['lld-link.exe'], for_machine,
|
||||
'lld-link', prefix, version=version)
|
||||
|
||||
|
||||
class XilinkDynamicLinker(VisualStudioLikeLinkerMixin, DynamicLinker):
|
||||
|
@ -879,7 +880,8 @@ class XilinkDynamicLinker(VisualStudioLikeLinkerMixin, DynamicLinker):
|
|||
|
||||
def __init__(self, for_machine: mesonlib.MachineChoice,
|
||||
*, version: str = 'unknown version'):
|
||||
super().__init__(['xilink.exe'], for_machine, 'xilink', '', version=version)
|
||||
VisualStudioLikeLinkerMixin.__init__(self)
|
||||
DynamicLinker.__init__(self, ['xilink.exe'], for_machine, 'xilink', '', version=version)
|
||||
|
||||
|
||||
class SolarisDynamicLinker(PosixDynamicLinkerMixin, DynamicLinker):
|
||||
|
@ -936,7 +938,8 @@ class OptlinkDynamicLinker(VisualStudioLikeLinkerMixin, DynamicLinker):
|
|||
*, version: str = 'unknown version'):
|
||||
# Use optlink instead of link so we don't interfer with other link.exe
|
||||
# implementations.
|
||||
super().__init__(['optlink.exe'], for_machine, 'optlink', prefix_arg='', version=version)
|
||||
VisualStudioLikeLinkerMixin.__init__(self)
|
||||
DynamicLinker.__init__(self, ['optlink.exe'], for_machine, 'optlink', prefix_arg='', version=version)
|
||||
|
||||
def get_allow_undefined_args(self) -> typing.List[str]:
|
||||
return []
|
||||
|
|
Loading…
Reference in New Issue