From 8227927c77fce40348028655bd6796249d8b4be3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 10 Jun 2024 00:10:35 +0200 Subject: [PATCH 1/2] Fix paths to toml files (missing /) --- package_linter.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package_linter.py b/package_linter.py index b366069..ac290a2 100755 --- a/package_linter.py +++ b/package_linter.py @@ -769,16 +769,16 @@ class App(TestSuite): @test() def config_panel(app): - if file_exists(app.path + "config_panel.json"): + if file_exists(app.path + "/config_panel.json"): yield Error( "JSON config panels are not supported anymore, should be replaced by a toml version" ) - if file_exists(app.path + "config_panel.toml"): + if file_exists(app.path + "/config_panel.toml"): if ( os.system( "grep -q 'version = \"0.1\"' '%s'" - % (app.path + "config_panel.toml") + % (app.path + "/config_panel.toml") ) == 0 ): @@ -800,7 +800,7 @@ class App(TestSuite): validate_schema( "config_panel", config_panel_v1_schema(), - toml.load(app.path + "config_panel.toml"), + toml.load(app.path + "/config_panel.toml"), ) @test() @@ -1218,7 +1218,7 @@ class Configurations(TestSuite): ) else: validate_schema( - "tests.toml", tests_v1_schema(), toml.load(app.path + "tests.toml") + "tests.toml", tests_v1_schema(), toml.load(app.path + "/tests.toml") ) @test() From ffd9483964ea7365b8a0e2dfc4937bed42b58d8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 10 Jun 2024 00:10:44 +0200 Subject: [PATCH 2/2] Fix linter: use json.loads() --- package_linter.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package_linter.py b/package_linter.py index ac290a2..4deb390 100755 --- a/package_linter.py +++ b/package_linter.py @@ -797,9 +797,9 @@ class App(TestSuite): "The config panel is set to version 1.x, but the config script is apparently still using some old code from 0.1 such as '$YNH_CONFIG_STUFF' or 'yunohost app action'" ) - validate_schema( + yield from validate_schema( "config_panel", - config_panel_v1_schema(), + json.loads(config_panel_v1_schema()), toml.load(app.path + "/config_panel.toml"), ) @@ -1217,8 +1217,8 @@ class Configurations(TestSuite): "The 'check_process' file that interfaces with the app CI has now been replaced with 'tests.toml' format and is now mandatory for apps v2." ) else: - validate_schema( - "tests.toml", tests_v1_schema(), toml.load(app.path + "/tests.toml") + yield from validate_schema( + "tests.toml", json.loads(tests_v1_schema()), toml.load(app.path + "/tests.toml") ) @test() @@ -2278,7 +2278,7 @@ class Manifest(TestSuite): def manifest_schema(self): if app_packaging_format <= 1: return - validate_schema("manifest", manifest_v2_schema(), self.manifest) + yield from validate_schema("manifest", json.loads(manifest_v2_schema()), self.manifest) ########################################