diff --git a/.github/.mdl_style.rb b/.github/.mdl_style.rb index 8dd908879..cea9ca73a 100644 --- a/.github/.mdl_style.rb +++ b/.github/.mdl_style.rb @@ -1,5 +1,6 @@ all exclude_rule 'MD007' exclude_rule 'MD013' +exclude_rule 'MD024' exclude_rule 'MD029' exclude_rule 'MD034' diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2a563adbd..b4da67919 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,12 +2,12 @@ fail_fast: false repos: - repo: https://github.com/adrienverge/yamllint.git - rev: v1.30.0 + rev: v1.33.0 hooks: - id: yamllint args: ["--format", "parsable", "--strict"] - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.5.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer @@ -20,6 +20,6 @@ repos: hooks: - id: markdownlint_docker - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: 'v0.0.261' + rev: 'v0.1.6' hooks: - id: ruff diff --git a/Makefile b/Makefile index d97ae654a..64a2ed87b 100644 --- a/Makefile +++ b/Makefile @@ -5,8 +5,8 @@ TEST_FILES ?= tests/integration/test_*.py VERSION ?= $(shell git tag --list --sort=-version:refname "v*" | head -n 1) COMMIT ?= $(shell git rev-parse --short HEAD) -PIP_TOOLS_VERSION ?= 6.13.0 -PIP_VERSION ?= 23.1 +PIP_TOOLS_VERSION ?= 7.3.0 +PIP_VERSION ?= 23.3.1 PYTHON_PLATFORM ?= manylinux2014_x86_64 PYTHON_VERSION ?= 310 diff --git a/README.md b/README.md index 0643abb8d..a032c4774 100644 --- a/README.md +++ b/README.md @@ -895,7 +895,7 @@ For the third-party integrations explained above, in addition to the metrics col This configuration also has a filtering mechanism that allows users to specify metrics they allow or deny for the vendor they are using. To filter the ingestion of custom runtime metrics to third party APMs, users should provide a list of prefixes of the metrics they want to allow/deny using the environment variables listed below. -Note: Custom database metrics cannot be filtered by name, to turn them off, the `APPMETRICS_INCLUDE_DB` environment variable should be set to false. +Note: Custom database metrics cannot be filtered by name, to turn them off, the `APPMETRICS_INCLUDE_DB` environment variable should be set to false. #### APM_METRICS_FILTER_ALLOW @@ -909,7 +909,7 @@ cf set-env APM_METRICS_FILTER_ALLOW 'mx.runtime.stats.sessions' #### APM_METRICS_FILTER_DENY -Comma-separated list of prefixes for the metrics to be denied. +Comma-separated list of prefixes for the metrics to be denied. For example, to deny all metrics starting with jetty or mx.runtime, the environment variable should be set to `jetty,mx.runtime`: @@ -925,7 +925,6 @@ If this environment variable is set to `true`, all metrics will be denied regard cf set-env APM_METRICS_FILTER_DENY_ALL true ``` - ## Using the Buildpack without an Internet Connection If you are running Cloud Foundry without a connection to the Internet, you should specify an on-premises web server that hosts Mendix Runtime files and other buildpack dependencies. You can set the endpoint with the following environment variable: diff --git a/bin/install-python b/bin/install-python index db4161e78..3ee14d05e 100755 --- a/bin/install-python +++ b/bin/install-python @@ -48,4 +48,4 @@ function get_python_from_manifest() { echo "$python_dep_info" } -main "${@:-}" \ No newline at end of file +main "${@:-}" diff --git a/buildpack/core/java.py b/buildpack/core/java.py index d47a5519c..791d6b2e4 100644 --- a/buildpack/core/java.py +++ b/buildpack/core/java.py @@ -160,7 +160,7 @@ def stage(buildpack_path, cache_path, local_path, java_major_version): def _compose_jvm_target_dir(dependency): - return f"usr/lib/jvm/{dependency['vendor']}-{dependency['type']}-{dependency['version']}-{dependency['vendor']}-x64" # noqa: line-too-long + return f"usr/lib/jvm/{dependency['vendor']}-{dependency['type']}-{dependency['version']}-{dependency['vendor']}-x64" # noqa: C0301 def _get_java_dependency( diff --git a/buildpack/core/nginx.py b/buildpack/core/nginx.py index 9cf537f19..315610c5a 100644 --- a/buildpack/core/nginx.py +++ b/buildpack/core/nginx.py @@ -14,15 +14,15 @@ from lib.m2ee.util import strtobool ALLOWED_HEADERS = { - "X-Frame-Options": r"(?i)(^allow-from https?://([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*(:\d+)?$|^deny$|^sameorigin$)", # noqa: line-too-long - "Referrer-Policy": r"(?i)(^no-referrer$|^no-referrer-when-downgrade$|^origin|origin-when-cross-origin$|^same-origin|strict-origin$|^strict-origin-when-cross-origin$|^unsafe-url$)", # noqa: line-too-long - "Access-Control-Allow-Origin": r"(?i)(^\*$|^null$|^https?://([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*(:\d+)?$)", # noqa: line-too-long + "X-Frame-Options": r"(?i)(^allow-from https?://([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*(:\d+)?$|^deny$|^sameorigin$)", # noqa: C0301 + "Referrer-Policy": r"(?i)(^no-referrer$|^no-referrer-when-downgrade$|^origin|origin-when-cross-origin$|^same-origin|strict-origin$|^strict-origin-when-cross-origin$|^unsafe-url$)", # noqa: C0301 + "Access-Control-Allow-Origin": r"(?i)(^\*$|^null$|^https?://([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*(:\d+)?$)", # noqa: C0301 "X-Content-Type-Options": r"(?i)(^nosniff$)", "Content-Security-Policy": r"[a-zA-Z0-9:;/''\"\*_\- \.\n?=%&+]+", - "Strict-Transport-Security": r"(?i)(^max-age=[0-9]*$|^max-age=[0-9]*; includeSubDomains$|^max-age=[0-9]*; preload$)", # noqa: line-too-long - "X-Permitted-Cross-Domain-Policies": r"(?i)(^all$|^none$|^master-only$|^by-content-type$|^by-ftp-filename$)", # noqa: line-too-long + "Strict-Transport-Security": r"(?i)(^max-age=[0-9]*$|^max-age=[0-9]*; includeSubDomains$|^max-age=[0-9]*; preload$)", # noqa: C0301 + "X-Permitted-Cross-Domain-Policies": r"(?i)(^all$|^none$|^master-only$|^by-content-type$|^by-ftp-filename$)", # noqa: C0301 "Origin-Trial": r"[a-zA-Z0-9:;/''\"\*_\- \.\n?=%&+]+", - "X-XSS-Protection": r"(?i)(^0$|^1$|^1; mode=block$|^1; report=https?://([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*(:\d+)?$)", # noqa: line-too-long + "X-XSS-Protection": r"(?i)(^0$|^1$|^1; mode=block$|^1; report=https?://([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*(:\d+)?$)", # noqa: C0301 } CONFIG_FILE = "nginx/conf/nginx.conf" diff --git a/buildpack/databroker/config_generator/scripts/generators/debezium.py b/buildpack/databroker/config_generator/scripts/generators/debezium.py index ba3a98177..60f55cbc6 100644 --- a/buildpack/databroker/config_generator/scripts/generators/debezium.py +++ b/buildpack/databroker/config_generator/scripts/generators/debezium.py @@ -1,12 +1,12 @@ -from buildpack.databroker.config_generator.scripts.generators.debezium_configs.debezium_interface import ( # noqa: line-too-long +from buildpack.databroker.config_generator.scripts.generators.debezium_configs.debezium_interface import ( # noqa: C0301 DebeziumInterface, ) -from buildpack.databroker.config_generator.scripts.generators.debezium_configs.debezium_default import ( # noqa: line-too-long +from buildpack.databroker.config_generator.scripts.generators.debezium_configs.debezium_default import ( # noqa: C0301 DebeziumDefault, ) # Do not remove this import, it allows automatic class load -from buildpack.databroker.config_generator.scripts.generators.debezium_configs import * # noqa: line-too-long,F403 +from buildpack.databroker.config_generator.scripts.generators.debezium_configs import * # noqa: C0301, F403 def generate_config(config): diff --git a/buildpack/databroker/config_generator/scripts/generators/debezium_configs/debezium_default.py b/buildpack/databroker/config_generator/scripts/generators/debezium_configs/debezium_default.py index 09a713712..db2c9414f 100644 --- a/buildpack/databroker/config_generator/scripts/generators/debezium_configs/debezium_default.py +++ b/buildpack/databroker/config_generator/scripts/generators/debezium_configs/debezium_default.py @@ -1,4 +1,4 @@ -from buildpack.databroker.config_generator.scripts.generators.debezium_configs.debezium_interface import ( # noqa: line-too-long +from buildpack.databroker.config_generator.scripts.generators.debezium_configs.debezium_interface import ( # noqa: C0301 DebeziumInterface, ) diff --git a/buildpack/databroker/config_generator/scripts/generators/debezium_configs/postgres.py b/buildpack/databroker/config_generator/scripts/generators/debezium_configs/postgres.py index a36ae9718..56e4bb477 100644 --- a/buildpack/databroker/config_generator/scripts/generators/debezium_configs/postgres.py +++ b/buildpack/databroker/config_generator/scripts/generators/debezium_configs/postgres.py @@ -1,4 +1,4 @@ -from buildpack.databroker.config_generator.scripts.generators.debezium_configs.debezium_interface import ( # noqa: line-too-long +from buildpack.databroker.config_generator.scripts.generators.debezium_configs.debezium_interface import ( # noqa: C0301 DebeziumInterface, ) from buildpack.databroker.config_generator.scripts.constants import ( diff --git a/buildpack/databroker/config_generator/templates/jmx/consumer.py b/buildpack/databroker/config_generator/templates/jmx/consumer.py index 73835cd56..86f81629e 100644 --- a/buildpack/databroker/config_generator/templates/jmx/consumer.py +++ b/buildpack/databroker/config_generator/templates/jmx/consumer.py @@ -18,7 +18,7 @@ }, { "include": { - "bean_regex": "kafka\.consumer:type=consumer-coordinator-metrics,client-id=.*", # noqa: line-too-long + "bean_regex": "kafka\.consumer:type=consumer-coordinator-metrics,client-id=.*", # noqa: C0301 "attribute": { "commit-latency-avg": { "alias": "kafka.consumer.coordinator.commit-latency-avg" @@ -82,10 +82,10 @@ "alias": "kafka.consumer.coordinator.partitions-revoked-latency-max" }, "partitions-assigned-latency-avg": { - "alias": "kafka.consumer.coordinator.partitions-assigned-latency-avg" # noqa: line-too-long + "alias": "kafka.consumer.coordinator.partitions-assigned-latency-avg" # noqa: C0301 }, "partitions-assigned-latency-max": { - "alias": "kafka.consumer.coordinator.partitions-assigned-latency-max" # noqa: line-too-long + "alias": "kafka.consumer.coordinator.partitions-assigned-latency-max" # noqa: C0301 }, "partitions-lost-latency-avg": { "alias": "kafka.consumer.coordinator.partitions-lost-latency-avg" @@ -98,7 +98,7 @@ }, { "include": { - "bean_regex": "kafka\.consumer:type=consumer-fetch-manager-metrics,client-id=.*", # noqa: line-too-long + "bean_regex": "kafka\.consumer:type=consumer-fetch-manager-metrics,client-id=.*", # noqa: C0301 "attribute": { "bytes-consumed-rate": { "alias": "kafka.consumer.fetch.manager.bytes-consumed-rate" @@ -146,7 +146,7 @@ }, { "include": { - "bean_regex": "kafka\.consumer:type=consumer-fetch-manager-metrics,client-id=.*,topic=.*", # noqa: line-too-long + "bean_regex": "kafka\.consumer:type=consumer-fetch-manager-metrics,client-id=.*,topic=.*", # noqa: C0301 "attribute": { "bytes-consumed-rate": { "alias": "kafka.consumer.fetch.manager.bytes-consumed-rate" @@ -174,7 +174,7 @@ }, { "include": { - "bean_regex": "kafka\.consumer:type=consumer-fetch-manager-metrics,partition=.*,topic=.*,client-id=.*", # noqa: line-too-long + "bean_regex": "kafka\.consumer:type=consumer-fetch-manager-metrics,partition=.*,topic=.*,client-id=.*", # noqa: C0301 "attribute": { "preferred-read-replica": { "alias": "kafka.consumer.fetch.manager.preferred-read-replica" diff --git a/buildpack/infrastructure/database.py b/buildpack/infrastructure/database.py index f6ca705f0..a473b4eaf 100644 --- a/buildpack/infrastructure/database.py +++ b/buildpack/infrastructure/database.py @@ -252,8 +252,8 @@ def __init__(self, url, env_vars=None): def init(self): patterns = [ - r"(?P[a-zA-Z0-9]+)://(?P[^:]+):(?P[^@]+)@(?P[^/]+)/(?P[^?]*)(?P\?.*)?", # noqa: line-too-long - r"jdbc:(?P[a-zA-Z0-9]+)://(?P[^;]+);database=(?P[^;]*);user=(?P[^;]+);password=(?P.*)$", # noqa: line-too-long + r"(?P[a-zA-Z0-9]+)://(?P[^:]+):(?P[^@]+)@(?P[^/]+)/(?P[^?]*)(?P\?.*)?", # noqa: C0301 + r"jdbc:(?P[a-zA-Z0-9]+)://(?P[^;]+);database=(?P[^;]*);user=(?P[^;]+);password=(?P.*)$", # noqa: C0301 ] supported_databases = { @@ -465,7 +465,7 @@ def get_database_password(self): def get_database_jdbc_url(self): """Return the database jdbc url for the M2EE configuration""" url = self.credentials.get("url", "") - pattern = r"jdbc:sap://(?P[^:]+):(?P[0-9]+)/?(?P\?(?P.*))?$" # noqa:line-too-long + pattern = r"jdbc:sap://(?P[^:]+):(?P[0-9]+)/?(?P\?(?P.*))?$" # noqa:C0301 match = re.search(pattern, url) if match is None: logging.error("Unable to parse Hana JDBC url string for parameters") diff --git a/buildpack/telemetry/appdynamics.py b/buildpack/telemetry/appdynamics.py index c9e075b5b..f6c578557 100644 --- a/buildpack/telemetry/appdynamics.py +++ b/buildpack/telemetry/appdynamics.py @@ -23,7 +23,7 @@ "APPDYNAMICS_AGENT_APPLICATION_NAME", default=util.get_app_from_domain(), ), - "APPDYNAMICS_AGENT_NODE_NAME": f"{os.getenv('APPDYNAMICS_AGENT_NODE_NAME', default='node')}-{CF_APPLICATION_INDEX}", # noqa: line-too-long + "APPDYNAMICS_AGENT_NODE_NAME": f"{os.getenv('APPDYNAMICS_AGENT_NODE_NAME', default='node')}-{CF_APPLICATION_INDEX}", # noqa: C0301 "APPDYNAMICS_AGENT_TIER_NAME": os.getenv( "APPDYNAMICS_AGENT_TIER_NAME", default=CF_APPLICATION_NAME ), @@ -33,7 +33,7 @@ "APPDYNAMICS_CONTROLLER_SSL_ENABLED": os.getenv( "APPDYNAMICS_CONTROLLER_SSL_ENABLED", default="true" ), - "APPDYNAMICS_AGENT_UNIQUE_HOST_ID": f"{os.getenv('APPDYNAMICS_AGENT_UNIQUE_HOST_ID', default=CF_APPLICATION_NAME),}-{CF_APPLICATION_INDEX}", # noqa: line-too-long + "APPDYNAMICS_AGENT_UNIQUE_HOST_ID": f"{os.getenv('APPDYNAMICS_AGENT_UNIQUE_HOST_ID', default=CF_APPLICATION_NAME),}-{CF_APPLICATION_INDEX}", # noqa: C0301 } diff --git a/buildpack/telemetry/appdynamics_telegraf_output.py b/buildpack/telemetry/appdynamics_telegraf_output.py index 7179595d5..f59473158 100644 --- a/buildpack/telemetry/appdynamics_telegraf_output.py +++ b/buildpack/telemetry/appdynamics_telegraf_output.py @@ -151,7 +151,7 @@ def convert_and_push_payload(): AppDynamics Machine Agent HTTP listener. """ - # AppDynamics Docs: https://docs.appdynamics.com/22.2/en/infrastructure-visibility/machine-agent/extensions-and-custom-metrics/machine-agent-http-listener # noqa: line-too-long + # AppDynamics Docs: https://docs.appdynamics.com/22.2/en/infrastructure-visibility/machine-agent/extensions-and-custom-metrics/machine-agent-http-listener # noqa: C0301 metrics_str = input() metrics_dict = json.loads(metrics_str) diff --git a/buildpack/telemetry/datadog.py b/buildpack/telemetry/datadog.py index a7b3639a0..f08761ded 100644 --- a/buildpack/telemetry/datadog.py +++ b/buildpack/telemetry/datadog.py @@ -153,7 +153,7 @@ def get_service_tag(): def _get_service_from_tags(): - dict_filter = lambda x, y: dict( # noqa: unnecessary-lambda-assignment + dict_filter = lambda x, y: dict( # noqa: E731 [(i, x[i]) for i in x if i in set(y)] ) @@ -432,7 +432,7 @@ def _get_logging_config(): { "type": "mask_sequences", "name": "RFC_5322_email", - "pattern": r"""(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])""", # noqa: line-too-long + "pattern": r"""(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])""", # noqa: C0301 "replace_placeholder": "[EMAIL REDACTED]", } ) diff --git a/buildpack/telemetry/metering.py b/buildpack/telemetry/metering.py index ccfb8da16..603b60e54 100644 --- a/buildpack/telemetry/metering.py +++ b/buildpack/telemetry/metering.py @@ -47,7 +47,7 @@ def write_file(output_file_path, content): json.dump(content, f) except Exception as exception: raise Exception( - f"Error while trying to write the configuration to a file. Reason: '{exception}'" # noqa: line-too-long + f"Error while trying to write the configuration to a file. Reason: '{exception}'" # noqa: C0301 ) from exception diff --git a/buildpack/telemetry/metrics.py b/buildpack/telemetry/metrics.py index d8bc82685..77aee5012 100644 --- a/buildpack/telemetry/metrics.py +++ b/buildpack/telemetry/metrics.py @@ -686,7 +686,7 @@ def _get_number_of_files(self): with conn.cursor() as cursor: cursor.execute( - "SELECT COUNT(id) from system$filedocument WHERE hascontents=true;" # noqa:line-too-long + "SELECT COUNT(id) from system$filedocument WHERE hascontents=true;" # noqa:C0301 ) rows = cursor.fetchall() if len(rows) == 0: @@ -697,7 +697,7 @@ def _get_size_of_files(self): conn = self._get_db_conn() with conn.cursor() as cursor: cursor.execute( - "SELECT SUM(size) from system$filedocument WHERE hascontents=true;" # noqa:line-too-long + "SELECT SUM(size) from system$filedocument WHERE hascontents=true;" # noqa:C0301 ) rows = cursor.fetchall() if len(rows) == 0: diff --git a/buildpack/telemetry/newrelic.py b/buildpack/telemetry/newrelic.py index e03209c39..55bb42b71 100644 --- a/buildpack/telemetry/newrelic.py +++ b/buildpack/telemetry/newrelic.py @@ -55,7 +55,7 @@ def update_config(m2ee, app_name): util.upsert_javaopts( m2ee, [ - f"-javaagent:{os.path.join(_get_destination_dir(), 'newrelic', 'newrelic.jar')}", # noqa: line-too-long + f"-javaagent:{os.path.join(_get_destination_dir(), 'newrelic', 'newrelic.jar')}", # noqa: C0301 f"-Dnewrelic.config.labels=\"{_get_labels(app_name)}\"", ] ) diff --git a/buildpack/util.py b/buildpack/util.py index 7aec764fc..74f7e4ee1 100644 --- a/buildpack/util.py +++ b/buildpack/util.py @@ -118,7 +118,7 @@ def __get_dependencies(obj): if ( all( True if k in DO_NOT_RECURSE_FIELDS else _is_dependency_literal(v) - for (k, v) in obj.items() # noqa: line-too-long + for (k, v) in obj.items() # noqa: C0301 ) and DEPENDENCY_ARTIFACT_KEY in obj ): @@ -427,7 +427,7 @@ def set_up_launch_environment(deps_dir, profile_dir): files = [ f for f in os.listdir(directory) - if os.path.isfile(os.path.join(directory, f)) # noqa: line-too-long + if os.path.isfile(os.path.join(directory, f)) # noqa: C0301 ] for f in files: diff --git a/dependencies-stage.yml b/dependencies-stage.yml index 8eb4e9ec5..3737692ab 100644 --- a/dependencies-stage.yml +++ b/dependencies-stage.yml @@ -5,4 +5,4 @@ sha256: 62e69f0664e0bbb05a6351d4d96dc9ea6b959c4c2e4ccdb124f932d0bdac0e41 cf_stacks: - cflinuxfs4 - source_sha256: 848cb06a5caa85da5c45bd7a9221bb821e33fc2bdcba088c127c58fad44e6343 \ No newline at end of file + source_sha256: 848cb06a5caa85da5c45bd7a9221bb821e33fc2bdcba088c127c58fad44e6343 diff --git a/lib/m2ee/client.py b/lib/m2ee/client.py index 22f8b967b..cd35dad79 100644 --- a/lib/m2ee/client.py +++ b/lib/m2ee/client.py @@ -94,7 +94,7 @@ def get_critical_log_messages(self): errors = echo_feedback["errors"] # default to 3.0 format [{"message":"Hello, # world!","timestamp":1315316488958,"cause":""}, ...] - if type(errors[0]) != dict: + if not isinstance(errors[0], dict): return errors from datetime import datetime diff --git a/lib/m2ee/config.py b/lib/m2ee/config.py index c8eb0fe3a..46e44347f 100644 --- a/lib/m2ee/config.py +++ b/lib/m2ee/config.py @@ -327,7 +327,7 @@ def _check_runtime_config(self): # searching if not self._conf.get("mxnode", {}).get("mxjar_repo", None): self._conf["mxnode"]["mxjar_repo"] = [] - elif not type(self._conf.get("mxnode", {})["mxjar_repo"]) == list: + elif not isinstance((self._conf.get("mxnode", {})["mxjar_repo"]), list): self._conf["mxnode"]["mxjar_repo"] = [ self._conf["mxnode"]["mxjar_repo"] ] @@ -512,7 +512,7 @@ def get_java_env(self): env = os.environ.copy() elif preserve_environment is False: pass - elif type(preserve_environment) == list: + elif isinstance(preserve_environment, list): for varname in preserve_environment: if varname in os.environ: env[varname] = os.environ[varname] @@ -526,7 +526,7 @@ def get_java_env(self): custom_environment = self._conf["m2ee"].get("custom_environment", {}) if custom_environment is not None: - if type(custom_environment) == dict: + if isinstance(custom_environment, dict): env.update(custom_environment) else: logger.warn( diff --git a/lib/m2ee/core.py b/lib/m2ee/core.py index f8eca6035..9c31856c2 100644 --- a/lib/m2ee/core.py +++ b/lib/m2ee/core.py @@ -125,7 +125,7 @@ def start_appcontainer(self): ), "port": self.config.get_runtime_port(), "application_base_path": self.config.get_app_base(), - "use_blocking_connector": self.config.get_runtime_blocking_connector(), # noqa: line-too-long + "use_blocking_connector": self.config.get_runtime_blocking_connector(), # noqa: C0301 } ) response.display_error() @@ -134,7 +134,7 @@ def start_appcontainer(self): response = self.client.update_appcontainer_configuration( { "runtime_port": self.config.get_runtime_port(), - "runtime_listen_addresses": self.config.get_runtime_listen_addresses(), # noqa: line-too-long + "runtime_listen_addresses": self.config.get_runtime_listen_addresses(), # noqa: C0301 "runtime_jetty_options": self.config.get_jetty_options(), } ) diff --git a/lib/m2ee/munin.py b/lib/m2ee/munin.py index b787774e7..b4308e5b6 100644 --- a/lib/m2ee/munin.py +++ b/lib/m2ee/munin.py @@ -139,7 +139,7 @@ def _get_jre_major_version_from_version_string(version_string): def _guess_java_version(m2ee_response, runtime_version, m2ee_stats): - # type: ("lib.m2ee.client.M2EEResponse", "lib.m2ee.version.MXVersion", dict) -> "Optional[int]" # noqa: line-too-long + # type: ("lib.m2ee.client.M2EEResponse", "lib.m2ee.version.MXVersion", dict) -> "Optional[int]" # noqa: C0301 """ "This internal function has a more unit-testable API than `guess_java_version`, which enables us to preserve compatibility, whilst simultaneously adding unit testing. @@ -208,7 +208,7 @@ def get_stats_from_runtime(client, config): m2eeresponse = client.server_statistics() if not m2eeresponse.has_error(): stats.update(m2eeresponse.get_feedback()) - if type(stats["requests"]) == list: + if isinstance(stats["requests"], list): # convert back to normal, whraagh bork = {} for x in stats["requests"]: @@ -502,17 +502,17 @@ def print_connectionbus_values(name, stats): def print_sessions_config(name, stats, graph_total_named_users): - if type(stats["sessions"]) != dict: - print_sessions_pre254_config(name, stats) - else: + if isinstance(stats["sessions"], dict): print_sessions_since254_config(name, stats, graph_total_named_users) + else: + print_sessions_pre254_config(name, stats) def print_sessions_values(name, stats, graph_total_named_users): - if type(stats["sessions"]) != dict: - print_sessions_pre254_values(name, stats) - else: + if isinstance(stats["sessions"], dict): print_sessions_since254_values(name, stats, graph_total_named_users) + else: + print_sessions_pre254_values(name, stats) def print_sessions_pre254_config(name, stats): diff --git a/requirements-dev.in b/requirements-dev.in index d892199ee..dbd7bb33a 100644 --- a/requirements-dev.in +++ b/requirements-dev.in @@ -1,11 +1,11 @@ -click==8.1.3 -idna==3.4 -pytest==7.3.1 +click==8.1.7 +idna==3.6 +pytest==7.4.3 pytest-timer==0.0.11 -pytest-timeout==2.1.0 -pylint==2.17.2 -pyopenssl==23.1.1 +pytest-timeout==2.2.0 +pylint==3.0.2 +pyopenssl==23.3.0 randomname==0.2.1 -requests-mock==1.10.0 -ruff==0.0.261 +requests-mock==1.11.0 +ruff==0.1.6 parameterized==0.9.0 diff --git a/requirements.in b/requirements.in index 34d7b7027..1a4cae2ed 100644 --- a/requirements.in +++ b/requirements.in @@ -1,10 +1,10 @@ backoff==2.2.1 -certifi==2022.12.7 -cryptography==40.0.2 +certifi==2023.11.17 +cryptography==41.0.7 distro==1.8.0 httplib2==0.22.0 jinja2==3.1.2 omegaconf==2.3.0 -psycopg2-binary==2.9.6 -pyyaml==6.0 -requests==2.28.2 \ No newline at end of file +psycopg2-binary==2.9.9 +pyyaml==6.0.1 +requests==2.31.0 diff --git a/requirements.txt b/requirements.txt index 73a9487c3..d7d70af92 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,13 +2,13 @@ # This file is autogenerated by pip-compile with Python 3.11 # by the following command: # -# pip-compile --resolver=backtracking requirements.in +# pip-compile requirements.in # antlr4-python3-runtime==4.9.3 # via omegaconf backoff==2.2.1 # via -r requirements.in -certifi==2022.12.7 +certifi==2023.11.17 # via # -r requirements.in # requests @@ -16,7 +16,7 @@ cffi==1.14.4 # via cryptography charset-normalizer==2.0.3 # via requests -cryptography==40.0.2 +cryptography==41.0.7 # via -r requirements.in distro==1.8.0 # via -r requirements.in @@ -30,17 +30,17 @@ markupsafe==2.0.1 # via jinja2 omegaconf==2.3.0 # via -r requirements.in -psycopg2-binary==2.9.6 +psycopg2-binary==2.9.9 # via -r requirements.in pycparser==2.20 # via cffi pyparsing==2.4.7 # via httplib2 -pyyaml==6.0 +pyyaml==6.0.1 # via # -r requirements.in # omegaconf -requests==2.28.2 +requests==2.31.0 # via -r requirements.in urllib3==1.26.6 # via requests diff --git a/tests/integration/test_custom_headers.py b/tests/integration/test_custom_headers.py index 26b689a91..a3d734cbd 100644 --- a/tests/integration/test_custom_headers.py +++ b/tests/integration/test_custom_headers.py @@ -13,7 +13,7 @@ def test_custom_headers(self): { "X-Permitted-Cross-Domain-Policies": "by-content-type", "Access-Control-Allow-Origin": "https://this.is.mydomain.nl", - "X-XSS-Protection": "1; report=https://domainwithnewstyle.tld.consultancy", # noqa: line-too-long + "X-XSS-Protection": "1; report=https://domainwithnewstyle.tld.consultancy", # noqa: C0301 "X-Content-Type-Options": "nosniff", } ), diff --git a/tests/unit/test_custom_headers.py b/tests/unit/test_custom_headers.py index de3a09ba6..98ff47bdb 100644 --- a/tests/unit/test_custom_headers.py +++ b/tests/unit/test_custom_headers.py @@ -76,20 +76,20 @@ def test_invalid_header_contentType(self): def test_valid_header_contentSecurity(self): os.environ["HTTP_RESPONSE_HEADERS"] = json.dumps( { - "Content-Security-Policy": "default-src https: \u0027unsafe-eval\u0027 \u0027unsafe-inline\u0027; object-src \u0027none\u0027" # noqa: line-too-long + "Content-Security-Policy": "default-src https: \u0027unsafe-eval\u0027 \u0027unsafe-inline\u0027; object-src \u0027none\u0027" # noqa: C0301 } ) header_config = nginx._get_http_headers() self.assertIn( ( "Content-Security-Policy", - "default-src https: \\'unsafe-eval\\' \\'unsafe-inline\\'; object-src \\'none\\'", # noqa: line-too-long - ), # noqa: line-too-long + "default-src https: \\'unsafe-eval\\' \\'unsafe-inline\\'; object-src \\'none\\'", # noqa: C0301 + ), # noqa: C0301 header_config, ) def test_valid_header_contentSecurity_sha(self): - base64_src = r"default-src 'self'; style-src 'self' 'sha256-aBc/dEf='; script-src 'self' 'unsafe-eval' 'sha256-aBc+dEf=';" # noqa: line-too-long + base64_src = r"default-src 'self'; style-src 'self' 'sha256-aBc/dEf='; script-src 'self' 'unsafe-eval' 'sha256-aBc+dEf=';" # noqa: C0301 os.environ["HTTP_RESPONSE_HEADERS"] = json.dumps( {"Content-Security-Policy": base64_src} @@ -106,7 +106,7 @@ def test_valid_header_contentSecurity_sha(self): def test_invalid_header_contentSecurity(self): os.environ["HTTP_RESPONSE_HEADERS"] = json.dumps( { - "Content-Security-Policy": "$# default-src https://my.csp.domain.amsterdam" # noqa: line-too-long + "Content-Security-Policy": "$# default-src https://my.csp.domain.amsterdam" # noqa: C0301 } ) header_config = nginx._get_http_headers() @@ -179,7 +179,7 @@ def test_valid_header_originTrial(self): ) header_config = nginx._get_http_headers() self.assertIn( - ("Origin-Trial", + ("Origin-Trial", "ArmVE2nkyn2sDf+DNN9MJVBYCagx:+NCFIc7==", ), header_config, diff --git a/tests/unit/test_db_config_options.py b/tests/unit/test_db_config_options.py index 20a1aac21..c2b3eac03 100644 --- a/tests/unit/test_db_config_options.py +++ b/tests/unit/test_db_config_options.py @@ -30,7 +30,7 @@ def test_no_setup(self): os.environ, { "MXRUNTIME_DatabaseType": "PostgreSQL", - "MXRUNTIME_DatabaseJdbcUrl": "jdbc:postgresql://username:password@rdsbroker-testfree-nonprod-1-eu-west-1.asdbjasdg.eu-west-1.rds.amazonaws.com:5432/testdatabase", # noqa: line-too-long + "MXRUNTIME_DatabaseJdbcUrl": "jdbc:postgresql://username:password@rdsbroker-testfree-nonprod-1-eu-west-1.asdbjasdg.eu-west-1.rds.amazonaws.com:5432/testdatabase", # noqa: C0301 }, clear=True, ) diff --git a/tests/unit/test_db_rds.py b/tests/unit/test_db_rds.py index f5341ad94..5804be0e1 100644 --- a/tests/unit/test_db_rds.py +++ b/tests/unit/test_db_rds.py @@ -77,7 +77,7 @@ def test_rds_testfree_postgres(self): assert config["DatabaseType"] == "PostgreSQL" assert ( config["DatabaseHost"] - == "rdsbroker-testfree-nonprod-1-eu-west-1.asdbjasdg.eu-west-1.rds.amazonaws.com:5432" # noqa: line-too-long + == "rdsbroker-testfree-nonprod-1-eu-west-1.asdbjasdg.eu-west-1.rds.amazonaws.com:5432" # noqa: C0301 ) assert config["DatabaseName"] == "dbuajsdhkasdhaks" assert config["DatabaseJdbcUrl"].find("tcpKeepAlive") >= 0 @@ -91,7 +91,7 @@ def test_rds_testfree_postgres_urlencoded(self): assert config["DatabaseType"] == "PostgreSQL" assert ( config["DatabaseHost"] - == "rdsbroker-testfree-nonprod-1-eu-west-1.asdbjasdg.eu-west-1.rds.amazonaws.com:5432" # noqa: line-too-long + == "rdsbroker-testfree-nonprod-1-eu-west-1.asdbjasdg.eu-west-1.rds.amazonaws.com:5432" # noqa: C0301 ) assert config["DatabaseName"] == "dbuajsdhkasdhaks" assert config["DatabaseJdbcUrl"].find("tcpKeepAlive") >= 0 diff --git a/tests/unit/test_external_dependencies.py b/tests/unit/test_external_dependencies.py index e9bb6e3b9..91077d412 100644 --- a/tests/unit/test_external_dependencies.py +++ b/tests/unit/test_external_dependencies.py @@ -35,7 +35,7 @@ class TestExternalDependencies(TestCase): { "foo.bar": { "version": "1.0.0", - DEPENDENCY_ARTIFACT_KEY: "some_location/some_archive-{{ version }}.tar.gz", # noqa: line-too-long + DEPENDENCY_ARTIFACT_KEY: "some_location/some_archive-{{ version }}.tar.gz", # noqa: C0301 DEPENDENCY_NAME_KEY: ["foo", "bar"], } }, @@ -54,13 +54,13 @@ class TestExternalDependencies(TestCase): """, { "foo.bar": { - DEPENDENCY_ARTIFACT_KEY: "some_location/some_archive-{{ type }}-{{ version }}.tar.gz", # noqa: line-too-long + DEPENDENCY_ARTIFACT_KEY: "some_location/some_archive-{{ type }}-{{ version }}.tar.gz", # noqa: C0301 "type": "fizz", "version": "1.0.0", DEPENDENCY_NAME_KEY: ["foo", "bar"], }, "foo.baz": { - DEPENDENCY_ARTIFACT_KEY: "some_location/some_archive-{{ type }}-{{ version }}.tar.gz", # noqa: line-too-long + DEPENDENCY_ARTIFACT_KEY: "some_location/some_archive-{{ type }}-{{ version }}.tar.gz", # noqa: C0301 "type": "buzz", "version": "1.0.0", DEPENDENCY_NAME_KEY: ["foo", "baz"], @@ -83,28 +83,28 @@ class TestExternalDependencies(TestCase): """, { "foo.fizz-1": { - DEPENDENCY_ARTIFACT_KEY: "some_location/some_archive-{{ type }}-{{ version }}.tar.gz", # noqa: line-too-long + DEPENDENCY_ARTIFACT_KEY: "some_location/some_archive-{{ type }}-{{ version }}.tar.gz", # noqa: C0301 "type": "fizz", "version": "1.0.0", "version_key": "1", DEPENDENCY_NAME_KEY: ["foo", "fizz-1"], }, "foo.buzz-1": { - DEPENDENCY_ARTIFACT_KEY: "some_location/some_archive-{{ type }}-{{ version }}.tar.gz", # noqa: line-too-long + DEPENDENCY_ARTIFACT_KEY: "some_location/some_archive-{{ type }}-{{ version }}.tar.gz", # noqa: C0301 "type": "buzz", "version": "1.0.0", "version_key": "1", DEPENDENCY_NAME_KEY: ["foo", "buzz-1"], }, "foo.fizz-2": { - DEPENDENCY_ARTIFACT_KEY: "some_location/some_archive-{{ type }}-{{ version }}.tar.gz", # noqa: line-too-long + DEPENDENCY_ARTIFACT_KEY: "some_location/some_archive-{{ type }}-{{ version }}.tar.gz", # noqa: C0301 "type": "fizz", "version": "2.0.0", "version_key": "2", DEPENDENCY_NAME_KEY: ["foo", "fizz-2"], }, "foo.buzz-2": { - DEPENDENCY_ARTIFACT_KEY: "some_location/some_archive-{{ type }}-{{ version }}.tar.gz", # noqa: line-too-long + DEPENDENCY_ARTIFACT_KEY: "some_location/some_archive-{{ type }}-{{ version }}.tar.gz", # noqa: C0301 "type": "buzz", "version": "2.0.0", "version_key": "2", @@ -182,7 +182,7 @@ def test_external_dependency_list_generation(self): "foo", {}, { - DEPENDENCY_ARTIFACT_KEY: "some_location/some_archive-{{ version }}.tar.gz", # noqa: line-too-long + DEPENDENCY_ARTIFACT_KEY: "some_location/some_archive-{{ version }}.tar.gz", # noqa: C0301 DEPENDENCY_NAME_KEY: ["foo"], }, ), @@ -222,7 +222,7 @@ def test_external_dependency_resolution(self): ( { "version": "1.0.0", - DEPENDENCY_ARTIFACT_KEY: "https://myowncdn.com/some_location/some_archive-1.0.0.tar.gz", # noqa: line-too-long + DEPENDENCY_ARTIFACT_KEY: "https://myowncdn.com/some_location/some_archive-1.0.0.tar.gz", # noqa: C0301 DEPENDENCY_NAME_KEY: ["foo"], }, "https://myowncdn.com/some_location/some_archive-1.0.0.tar.gz",