From 61b9b05e40b408d1fd30a894b3513504ad3d10e7 Mon Sep 17 00:00:00 2001 From: "sagargurung1001@gmail.com" Date: Tue, 6 Sep 2022 15:58:42 +0545 Subject: [PATCH] Check coding standard with force error --- .drone.star | 29 +++++++------------ .../features/bootstrap/SpacesContext.php | 26 ++++++++--------- 2 files changed, 24 insertions(+), 31 deletions(-) diff --git a/.drone.star b/.drone.star index 7024506864..04b0fefcd0 100644 --- a/.drone.star +++ b/.drone.star @@ -149,9 +149,6 @@ config = { }, "litmus": True, "codestyle": True, - "branches": [ - "master", - ], } # volume for steps to cache Go dependencies between steps of a pipeline @@ -228,9 +225,9 @@ def main(ctx): test_pipelines = \ cancelPreviousBuilds() + \ + codestyle(ctx) + \ buildWebCache(ctx) + \ [buildOcisBinaryForTesting(ctx)] + \ - codestyle(ctx) + \ cacheCoreReposForTesting(ctx) + \ testOcisModules(ctx) + \ testPipelines(ctx) @@ -593,7 +590,7 @@ def codestyle(ctx): pipelines = [] if "codestyle" not in config: - return pipelines + return [] default = { "phpVersions": [DEFAULT_PHP_VERSION], @@ -633,7 +630,7 @@ def codestyle(ctx): "base": "/drone", "path": "src", }, - "steps": skipIfUnchanged(ctx, "acceptance-tests") + + "steps": skipIfUnchanged(ctx, "lint") + vendorbinCodestyle(phpVersion) + vendorbinCodesniffer(phpVersion) + [ @@ -648,15 +645,13 @@ def codestyle(ctx): "depends_on": [], "trigger": { "ref": [ + "refs/heads/master", "refs/pull/**", "refs/tags/**", ], }, } - for branch in config["branches"]: - result["trigger"]["ref"].append("refs/heads/%s" % branch) - pipelines.append(result) return pipelines @@ -2109,17 +2104,15 @@ def skipIfUnchanged(ctx, type): ] skip = [] - if type == "acceptance-tests": + if type == "acceptance-tests" or type == "e2e-tests" or type == "lint": skip = base + unit - if type == "unit-tests": + elif type == "unit-tests": skip = base + acceptance - if type == "build-binary" or type == "build-docker" or type == "litmus": + elif type == "build-binary" or type == "build-docker" or type == "litmus": skip = base + unit + acceptance - if type == "cache": + elif type == "cache": skip = base - if type == "e2e-tests": - skip = base + unit - if len(skip) == 0: + else: return [] return [{ @@ -3010,7 +3003,7 @@ def restoreWebE2EYarnCache(): "mc cp -r -a s3/$CACHE_BUCKET/ocis/web-test-runner/$WEB_COMMITID/e2e.tar.gz %s" % dirs["zip"], ], }, { - # we need to install again becase the node_modules are not cached + # we need to install again because the node_modules are not cached "name": "unzip-and-install-yarn-e2e", "image": OC_CI_NODEJS % DEFAULT_NODEJS_VERSION, "commands": [ @@ -3032,7 +3025,7 @@ def restoreWebAcceptanceYarnCache(): "mc cp -r -a s3/$CACHE_BUCKET/ocis/web-test-runner/$WEB_COMMITID/acceptance.tar.gz %s" % dirs["zip"], ], }, { - # we need to install again becase the node_modules are not cached + # we need to install again because the node_modules are not cached "name": "unzip-and-install-yarn-acceptance", "image": OC_CI_NODEJS % DEFAULT_NODEJS_VERSION, "commands": [ diff --git a/tests/acceptance/features/bootstrap/SpacesContext.php b/tests/acceptance/features/bootstrap/SpacesContext.php index 784269fc8f..6b8004a9f4 100644 --- a/tests/acceptance/features/bootstrap/SpacesContext.php +++ b/tests/acceptance/features/bootstrap/SpacesContext.php @@ -1008,8 +1008,8 @@ class SpacesContext implements Context { * @Then /^the json responded should contain a space "([^"]*)" (?:|(?:owned by|granted to) "([^"]*)" )(?:|(?:with description file|with space image) "([^"]*)" )with these key and value pairs:$/ * * @param string $spaceName - * @param string $userName - * @param string $fileName + * @param string|null $userName + * @param string|null $fileName * @param TableNode $table * * @return void @@ -1017,8 +1017,8 @@ class SpacesContext implements Context { */ public function jsonRespondedShouldContain( string $spaceName, - string $userName, - string $fileName, + ?string $userName = null, + ?string $fileName = null, TableNode $table ): void { $this->featureContext->verifyTableNodeColumns($table, ['key', 'value']); @@ -1081,8 +1081,8 @@ class SpacesContext implements Context { * * @param string $user * @param string $spaceName - * @param string $grantedUser - * @param string $fileName + * @param string|null $grantedUser + * @param string|null $fileName * @param TableNode $table * * @return void @@ -1091,8 +1091,8 @@ class SpacesContext implements Context { public function userHasSpaceWith( string $user, string $spaceName, - string $grantedUser, - string $fileName, + ?string $grantedUser = null, + ?string $fileName = null, TableNode $table ): void { $this->theUserListsAllHisAvailableSpacesUsingTheGraphApi($user); @@ -2989,15 +2989,15 @@ class SpacesContext implements Context { /** * @Given /^user "([^"]*)" has stored etag of element "([^"]*)" on path "([^"]*)" inside space "([^"]*)"$/ * - * @param $user - * @param $path - * @param $storePath - * @param $space + * @param string $user + * @param string $path + * @param string $storePath + * @param string $space * * @return void * @throws Exception | GuzzleException */ - public function userHasStoredEtagOfElementOnPathFromSpace($user, $path, $storePath, $space):void { + public function userHasStoredEtagOfElementOnPathFromSpace(string $user, string $path, string $storePath, string $space):void { $user = $this->featureContext->getActualUsername($user); $this->storeEtagOfElementInSpaceForUser( $user,