Skip to content

Commit

Permalink
[CI] Re-enable pylint for newer distributions and resolve warnings
Browse files Browse the repository at this point in the history
Re-enabling pylint checks for distributions newer than Ubuntu 18.04.
This commit addresses the following pylint warnings:
- Ignored warnings for imports outside toplevel.
- Updated code to use `subprocess.run(check=True)` which
  raises an exception on non-zero return codes.

Signed-off-by: Mariusz Zaborski <oshogbo@invisiblethingslab.com>
  • Loading branch information
oshogbo authored and mkow committed Nov 13, 2023
1 parent 487000c commit ee6cbb3
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
5 changes: 1 addition & 4 deletions .ci/lib/stage-lint.jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
stage('lint') {
sh '''
./scripts/gitignore-check-files
if .ci/isdistro bionic
then
./.ci/run-pylint -f text
fi
./.ci/run-pylint -f text
./.ci/run-shellcheck
'''
}
5 changes: 3 additions & 2 deletions libos/test/ltp/test_ltp.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,9 @@ def test_ltp(cmd, section):

def test_lint():
cmd = ['./contrib/conf_lint.py', '--scenario', LTP_SCENARIO, *LTP_CONFIG]
p = subprocess.run(cmd)
if p.returncode:
try:
subprocess.run(cmd, check=True)
except subprocess.CalledProcessError:
pytest.fail('conf_lint.py failed, see stdout for details')


Expand Down
2 changes: 1 addition & 1 deletion python/gramine-sgx-get-token
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ from graminelibos import Sigstruct, get_token, is_oot
@click.option('--verbose/--quiet', '-v/-q', default=True, help='Display details (on by default)')
def main(sig, output, verbose):
if not is_oot():
import warnings
import warnings # pylint: disable=import-outside-toplevel
warnings.warn(
'gramine-sgx-get-token is deprecated on upstream SGX driver, '
'and calling it will be a hard error in the future',
Expand Down
2 changes: 1 addition & 1 deletion python/graminelibos/sgx_get_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def p64(x):
def connect_aesmd(mrenclave, modulus, flags, xfrms):
'''Connect with AESMD.'''

from . import aesm_pb2 # pylint: disable=import-error,no-name-in-module
from . import aesm_pb2 # pylint: disable=import-error,no-name-in-module,import-outside-toplevel

req_msg = aesm_pb2.GetTokenReq()
req_msg.req.signature = mrenclave
Expand Down

0 comments on commit ee6cbb3

Please sign in to comment.