Commit 8c985d5f authored by Thanassis Tsiodras's avatar Thanassis Tsiodras

Create reproducible pylint checks via local configuration file.

parent e0aad564
...@@ -65,7 +65,7 @@ def OnEnumerated(unused_nodeTypename, unused_node, unused_leafTypeDict): ...@@ -65,7 +65,7 @@ def OnEnumerated(unused_nodeTypename, unused_node, unused_leafTypeDict):
pass # pragma: no cover pass # pragma: no cover
def OnSequenceOf(unused_nodeTypename, unused_node, _unused_leafTypeDict): def OnSequenceOf(unused_nodeTypename, unused_node, unused_leafTypeDict):
pass # pragma: no cover pass # pragma: no cover
......
...@@ -131,7 +131,7 @@ def OnStartup(unused_modelingLanguage: str, asnFile: str, outputDir: str, badTyp ...@@ -131,7 +131,7 @@ def OnStartup(unused_modelingLanguage: str, asnFile: str, outputDir: str, badTyp
g_outputGetSetC.write(' free(pBitStrm->buf);\n') g_outputGetSetC.write(' free(pBitStrm->buf);\n')
g_outputGetSetC.write(' free(pBitStrm);\n') g_outputGetSetC.write(' free(pBitStrm);\n')
g_outputGetSetC.write('}\n\n') g_outputGetSetC.write('}\n\n')
Makefile = open(outputDir + "Makefile.python", 'w') makefile = open(outputDir + "Makefile.python", 'w')
# Note that this Makefile will use a custom ASN1SCC invocation # Note that this Makefile will use a custom ASN1SCC invocation
# where "-equal" is passed - the _Equal functions will be generated # where "-equal" is passed - the _Equal functions will be generated
...@@ -139,7 +139,7 @@ def OnStartup(unused_modelingLanguage: str, asnFile: str, outputDir: str, badTyp ...@@ -139,7 +139,7 @@ def OnStartup(unused_modelingLanguage: str, asnFile: str, outputDir: str, badTyp
# mono_exe = "mono " if sys.argv[0].endswith('.py') and sys.platform.startswith('linux') else "" # mono_exe = "mono " if sys.argv[0].endswith('.py') and sys.platform.startswith('linux') else ""
mono_exe = "" mono_exe = ""
Makefile.write( makefile.write(
'''\ '''\
ASN1SCC:=asn1.exe ASN1SCC:=asn1.exe
ASN2DATAMODEL:=asn2dataModel ASN2DATAMODEL:=asn2dataModel
...@@ -173,7 +173,7 @@ clean: ...@@ -173,7 +173,7 @@ clean:
%(tab)srm -f $(BDIR)/DV.py $(BDIR)/*.pyc $(BDIR)/$(BASEGRAMMAR)_getset.? $(BDIR)/$(BASEGRAMMAR)_getset.so %(tab)srm -f $(BDIR)/DV.py $(BDIR)/*.pyc $(BDIR)/$(BASEGRAMMAR)_getset.? $(BDIR)/$(BASEGRAMMAR)_getset.so
%(tab)srm -f $(BDIR)/$(GRAMMAR)_asn.py %(tab)srm -f $(BDIR)/$(GRAMMAR)_asn.py
''' % {'tab': '\t', 'base': base, 'origGrammarBase': origGrammarBase, 'mono': mono_exe}) ''' % {'tab': '\t', 'base': base, 'origGrammarBase': origGrammarBase, 'mono': mono_exe})
Makefile.close() makefile.close()
CreateDeclarationsForAllTypes(commonPy.asnParser.g_names, commonPy.asnParser.g_leafTypeDict, badTypes) CreateDeclarationsForAllTypes(commonPy.asnParser.g_names, commonPy.asnParser.g_leafTypeDict, badTypes)
g_outputGetSetH.write('\n/* Helper functions for NATIVE encodings */\n\n') g_outputGetSetH.write('\n/* Helper functions for NATIVE encodings */\n\n')
g_outputGetSetC.write('\n/* Helper functions for NATIVE encodings */\n\n') g_outputGetSetC.write('\n/* Helper functions for NATIVE encodings */\n\n')
...@@ -300,8 +300,8 @@ class Params(object): ...@@ -300,8 +300,8 @@ class Params(object):
def GetDecl(self): def GetDecl(self):
params = CleanNameAsPythonWants(self._nodeTypeName) + "* root" params = CleanNameAsPythonWants(self._nodeTypeName) + "* root"
for v, t in zip(self._vars, self._types): for vvv, ttt in zip(self._vars, self._types):
params += ", "+t+" "+v params += ", " + ttt + " " + vvv
return params return params
......
...@@ -153,10 +153,14 @@ def RenderElements(controlString: str): ...@@ -153,10 +153,14 @@ def RenderElements(controlString: str):
if finalElementName.startswith("TEXT"): if finalElementName.startswith("TEXT"):
newElement = g_doc.createTextNode(finalElementName[4:]) newElement = g_doc.createTextNode(finalElementName[4:])
else: else:
newElement = g_doc.createElement(finalElementName) # This is a bug in pylint - scheduled to be fixed in next release, by:
# https://github.com/PyCQA/pylint/commit/6d31776454b5e308e4b869a1893b39083dca3146
newElement = g_doc.createElement(finalElementName) # pylint: disable=redefined-variable-type
if attributes != []: if attributes != []:
for atr in attributes: for atr in attributes:
newElement.setAttribute(atr.split('=')[0], atr.split('=')[1]) # This is a bug in pylint - scheduled to be fixed in next release, by:
# https://github.com/PyCQA/pylint/commit/6d31776454b5e308e4b869a1893b39083dca3146
newElement.setAttribute(atr.split('=')[0], atr.split('=')[1]) # pylint: disable=no-member
if under is not None: if under is not None:
parent = createdElements[under] parent = createdElements[under]
parent.appendChild(newElement) parent.appendChild(newElement)
......
# Change Log
## 1.2.3
- ctypes backend: emit all ENUMERATED values in DV.py
## 1.2.0
- Not using SWIG anymore for the Python mappers
## 1.1.2
- pyside_b_mapper: added combo box for the asn1 value editor
## 1.1.1
- support empty SEQUENCEs (MyType ::= SEQUENCE {}) - except for Simulink
PY_SRC:=$(wildcard asn2dataModel.py aadl2glueC.py smp2asn.py *mappers/[a-zA-Z]*py commonPy/[a-zA-Z]*py) PY_SRC:=$(wildcard asn2dataModel.py aadl2glueC.py smp2asn.py *mappers/[a-zA-Z]*py commonPy/[a-zA-Z]*py)
PY_SRC:=$(filter-out B_mappers/antlr.main.py, ${PY_SRC}) PY_SRC:=$(filter-out B_mappers/antlr.main.py A_mappers/Stubs.py, ${PY_SRC})
all: flake8 pylint mypy all: flake8 pylint mypy
...@@ -7,7 +7,7 @@ flake8: ...@@ -7,7 +7,7 @@ flake8:
flake8 ${PY_SRC} || exit 1 flake8 ${PY_SRC} || exit 1
pylint: pylint:
for i in ${PY_SRC} ; do pylint $$i || { echo $$i ; exit 1; } ; done for i in ${PY_SRC} ; do pylint --rcfile=pylint.cfg $$i || { echo $$i ; exit 1; } ; done
mypy: mypy:
mypy --check-untyped-defs ${PY_SRC} || exit 1 mypy --check-untyped-defs ${PY_SRC} || exit 1
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment