Skip to content

Commit bd58041

Browse files
authored
Remove api/client folder from codeQL scanning, fix explicit returns mixed with implicit, mismatch between signature and use of an overridden method, and confusing octal (#5703)
1 parent 9e9a5f0 commit bd58041

File tree

16 files changed

+37
-17
lines changed

16 files changed

+37
-17
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ name: "CodeQL"
22

33
on:
44
push:
5+
paths-ignore:
6+
- api/client
57
pull_request:
8+
paths-ignore:
9+
- api/client
610
schedule:
711
- cron: '0 10 * * 2'
812

@@ -27,4 +31,4 @@ jobs:
2731
languages: ${{ matrix.language }}
2832
queries: +security-and-quality
2933
- name: Perform CodeQL Analysis
30-
uses: github/codeql-action/analyze@v2
34+
uses: github/codeql-action/analyze@v2

awsbatch-cli/src/awsbatch/awsbhosts.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ def __create_host_item(container_instance, ec2_instance):
185185
)
186186
except KeyError as e:
187187
fail("Error building Host item. Key (%s) not found." % e)
188+
return None
188189

189190
@staticmethod
190191
def __get_instance_attribute(attributes, attribute_name):

awsbatch-cli/src/awsbatch/awsbqueues.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ def __new_queue(queue):
127127
)
128128
except KeyError as e:
129129
fail("Error building Queue item. Key (%s) not found." % e)
130+
return None
130131

131132

132133
def main():

cli/src/pcluster/cli/commands/configure/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ def wrapper(*args, **kwargs): # pylint: disable=inconsistent-return-statements
3333
print(f"Failed with error: {e}")
3434
if isinstance(e, ClientError) and "credentials" in str(e):
3535
print("To set the credentials, run 'aws configure' or set them as environment variables")
36+
return None
3637

3738
return wrapper
3839

cli/src/pcluster/cli/commands/ssh.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
from functools import partial
2222
from typing import List
2323

24-
import argparse
25-
from argparse import ArgumentParser, Namespace
24+
from argparse import ArgumentParser, Namespace, RawDescriptionHelpFormatter
2625

2726
from pcluster import utils
2827
from pcluster.cli.commands.common import CliCommand, to_bool
@@ -96,7 +95,7 @@ def __init__(self, subparsers):
9695
help=self.help,
9796
description=self.description,
9897
epilog=self.epilog,
99-
formatter_class=argparse.RawDescriptionHelpFormatter,
98+
formatter_class=RawDescriptionHelpFormatter,
10099
expects_extra_args=True,
101100
)
102101

cli/src/pcluster3_config_converter/pcluster3_config_converter.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,7 @@ def convert_slurm_queues(self, scheduling, param):
717717
queue = self.convert_single_slurm_queue(queue_label)
718718
_append_if(slurm_queues, queue)
719719
_add_if(scheduling, param, slurm_queues)
720+
return None
720721

721722
def convert_single_slurm_queue(self, queue_label):
722723
"""Convert single SlurmQueue."""

cli/tests/pcluster/models/test_cluster.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ def test_get_stack_events(self, cluster, mocker, set_env, stack_exists, expected
436436
"ResourceType": "AWS::CloudFormation::Stack",
437437
"StackId": "arn:aws:cloudformation:us-east-1:000000000000:stack/pc",
438438
"StackName": "pc",
439-
"Timestamp": datetime.datetime(2021, 7, 13, 2, 20, 20, 000000, tzinfo=tz.tzutc()),
439+
"Timestamp": datetime.datetime(2021, 7, 13, 2, 20, 20, 0o00000, tzinfo=tz.tzutc()),
440440
}
441441
],
442442
}

tests/integration-tests/clusters_factory.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ def wrapper(*args, **kwargs):
4040
return func(*args, **kwargs)
4141
except Exception as e:
4242
logging.error("Failed when running function %s. Ignoring exception. Error: %s", func.__name__, e)
43+
return None
4344

4445
return wrapper
4546

tests/integration-tests/conftest_resource_bucket.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def get_resource_map():
105105
def resource_bucket_shared(request, s3_bucket_factory_shared, lambda_layer_source):
106106
root = Path(pkg_resources.resource_filename(__name__, "/../.."))
107107
if request.config.getoption("resource_bucket"):
108-
return # short-circuit this fixture if a resource-bucket is provided
108+
return None # short-circuit this fixture if a resource-bucket is provided
109109

110110
for region, s3_bucket in s3_bucket_factory_shared.items():
111111
logger.info(f"Uploading artifacts to: {s3_bucket}[{region}]")

tests/integration-tests/s3_common_utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,4 @@ def get_policy_resources(config, enable_write_access):
5454
else:
5555
return [f"{bucket_name}", f"{bucket_name}/*"]
5656
logging.error("Bucket name couldn't be found in the configuration file.")
57+
return None

0 commit comments

Comments
 (0)