Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't add autogenerated comments to deprecation files #11014

Merged
merged 6 commits into from
Jan 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)

# This file is autogenerated.
# To change this file you should edit assets/configuration/spec.yaml and then run the following commands:
# ddev -x validate config -s <INTEGRATION_NAME>
# ddev -x validate models -s <INTEGRATION_NAME>



def shared():
return {'deprecated': {'Release': '8.0.0', 'Migration': 'do this\nand that\n'}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from ...manifest_utils import Manifest
from ...testing import process_checks_option
from ...utils import (
VALIDADORS_FILE,
CUSTOM_FILES,
complete_valid_checks,
get_config_models_documentation,
get_license_header,
Expand Down Expand Up @@ -134,18 +134,18 @@ def models(ctx, check, sync, verbose):

current_model_file_lines = read_file_lines(model_file_path)

if model_file == VALIDADORS_FILE and (len(current_model_file_lines) + 1) > len(license_header_lines):
# validators.py is a custom file, it should only be rendered the first time
if model_file in CUSTOM_FILES and (len(current_model_file_lines) + 1) > len(license_header_lines):
# validators.py and deprecations.py are custom files, they should only be rendered the first time
continue

expected_model_file_lines.extend(license_header_lines)
if model_file != VALIDADORS_FILE:
if model_file not in CUSTOM_FILES:
expected_model_file_lines.extend(documentation_header_lines)
expected_model_file_lines.extend(generated_model_file_lines)
else:
if not community_check:
expected_model_file_lines.extend(license_header_lines)
if model_file != VALIDADORS_FILE:
if model_file not in CUSTOM_FILES:
expected_model_file_lines.extend(documentation_header_lines)

expected_model_file_lines.extend(generated_model_file_lines)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from datadog_checks.dev.tooling.configuration.consumers.model.model_file import build_model_file
from datadog_checks.dev.tooling.configuration.consumers.model.model_info import ModelInfo
from datadog_checks.dev.tooling.configuration.consumers.openapi_document import build_openapi_document
from datadog_checks.dev.tooling.utils import VALIDADORS_FILE

PYTHON_VERSION = PythonVersion.PY_38

Expand Down Expand Up @@ -161,7 +160,7 @@ def _build_model_files(
model_files['__init__.py'] = ('\n'.join(package_root_lines), [])

# Custom
model_files[VALIDADORS_FILE] = (VALIDATORS_DOCUMENTATION, [])
model_files['validators.py'] = (VALIDATORS_DOCUMENTATION, [])
return model_files

def _merge_instances(self, section: dict, errors: List[str]) -> dict:
Expand Down
5 changes: 2 additions & 3 deletions datadog_checks_dev/datadog_checks/dev/tooling/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@

# match integration's version within the __about__.py module
VERSION = re.compile(r'__version__ *= *(?:[\'"])(.+?)(?:[\'"])')
# These files do not have autogenerated comments because their contents are custom
CUSTOM_FILES = ['validators.py', 'deprecations.py']


def get_license_header():
Expand All @@ -48,9 +50,6 @@ def get_config_models_documentation():
)


VALIDADORS_FILE = 'validators.py' # This file is different than the others because it's contents are custom


def format_commit_id(commit_id):
if commit_id:
if commit_id.isdigit():
Expand Down
4 changes: 0 additions & 4 deletions mongo/datadog_checks/mongo/config_models/deprecations.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)

# This file is autogenerated.
# To change this file you should edit assets/configuration/spec.yaml and then run the following commands:
# ddev -x validate config -s <INTEGRATION_NAME>
# ddev -x validate models -s <INTEGRATION_NAME>

def instance():
return {
Expand Down