Skip to content

Commit

Permalink
Enable flake8-todos plugin for ruff (#2342)
Browse files Browse the repository at this point in the history
  • Loading branch information
cutwater authored Oct 25, 2024
1 parent b36d7b0 commit 0f85b33
Show file tree
Hide file tree
Showing 56 changed files with 110 additions and 96 deletions.
2 changes: 1 addition & 1 deletion galaxy_ng/app/access_control/access_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
log = logging.getLogger(__name__)


# TODO this is a function in pulpcore that needs to get moved ot the plugin api.
# TODO(newswangerd): This is a function in pulpcore that needs to get moved ot the plugin api.
# from pulpcore.plugin.util import get_view_urlpattern
def get_view_urlpattern(view):
"""
Expand Down
2 changes: 1 addition & 1 deletion galaxy_ng/app/access_control/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def to_internal_value(self, data):
class UserPermissionField(serializers.Field):

def _validate_user(self, user_data):
# FIXME - fill this in ...
# FIXME(jctanner): fill this in ...
pass

def to_representation(self, value):
Expand Down
2 changes: 1 addition & 1 deletion galaxy_ng/app/access_control/statements/standalone.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@
"effect": "allow",
},
],
# TODO: More specific permissions will be required here when pulp_container
# TODO(newswangerd): More specific permissions will be required here when pulp_container
# RBAC is added
'ContainerRepositoryViewSet': [
{
Expand Down
3 changes: 2 additions & 1 deletion galaxy_ng/app/api/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ def to_representation(self, instance):
request = self.context.get('request', None)
if request:

# TODO: Figure out how to make `include_related` show up in the open API spec
# TODO(newswangerd): Figure out how to make `include_related` show up
# in the open API spec
include_fields = request.GET.getlist('include_related')

if len(include_fields) > 0:
Expand Down
4 changes: 2 additions & 2 deletions galaxy_ng/app/api/ui/v1/serializers/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ class CollectionDetailSerializer(_CollectionSerializer):
all_versions = serializers.SerializerMethodField()
sign_state = serializers.CharField()

# TODO: rename field to "version_details" since with
# "version" query param this won't always be the latest version
# TODO(awcrosby): rename field to "version_details" since with
# "version" query param this won't always be the latest version
@extend_schema_field(CollectionVersionDetailSerializer)
def get_latest_version(self, obj):
return CollectionVersionDetailSerializer(obj, context=self.context).data
Expand Down
2 changes: 1 addition & 1 deletion galaxy_ng/app/api/ui/v1/serializers/synclist.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def create(self, validated_data):
namespaces_data = validated_data.pop("namespaces")

# Match repository to upstream_repository
# TODO: remove after SyncList no longer has FK to repositories
# TODO(awcrosby): remove after SyncList no longer has FK to repositories
repository = validated_data.pop("upstream_repository")

try:
Expand Down
2 changes: 1 addition & 1 deletion galaxy_ng/app/api/ui/v1/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from . import views, viewsets

router = routers.SimpleRouter()
# TODO: Replace with a RedirectView
# TODO(alikins): Replace with a RedirectView
router.register('namespaces', viewsets.NamespaceViewSet, basename='namespaces')
router.register('my-namespaces', viewsets.MyNamespaceViewSet, basename='my-namespaces')
router.register('my-synclists', viewsets.MySyncListViewSet, basename='my-synclists')
Expand Down
2 changes: 1 addition & 1 deletion galaxy_ng/app/api/ui/v1/views/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def _oidc_logout(self, request):
log.warning(msg)
return

# FIXME - workaround for custom json type from dynaconf
# FIXME(newswangerd): workaround for custom json type from dynaconf
if isinstance(social.extra_data, dict):
extra_data = social.extra_data
else:
Expand Down
2 changes: 1 addition & 1 deletion galaxy_ng/app/api/ui/v1/viewsets/distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ def get_queryset(self):
qs=models.SyncList.objects.all()
)

# TODO: find a better way query this data
# TODO(newswangerd): find a better way query this data
return pulp_models.AnsibleDistribution.objects.filter(
name__in=synclists.values_list('name', flat=True)).order_by('name')
2 changes: 1 addition & 1 deletion galaxy_ng/app/api/ui/v1/viewsets/my_synclist.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def get_queryset(self):
qs=models.SyncList.objects.all(),
)

# TODO: on UI click of synclist toggle the UI makes 2 calls
# TODO(awcrosby): on UI click of synclist toggle the UI makes 2 calls
# PUT /api/automation-hub/_ui/v1/my-synclists/1/
# POST /api/automation-hub/_ui/v1/my-synclists/1/curate/
# remove this method after UI stops calling curate action
Expand Down
3 changes: 1 addition & 2 deletions galaxy_ng/app/api/ui/v2/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ class UserViewSet(BaseViewSet):
permission_classes = [ComplexUserPermissions]

def get_serializer_class(self):
# FIXME - a single serializer for this viewset
# seems painful to implement.
# FIXME(jctanner): a single serializer for this viewset seems painful to implement.
if self.action in ['list', 'retrieve']:
return UserDetailSerializer
elif self.action in ['create', 'update', 'partial_update', 'destroy']:
Expand Down
2 changes: 1 addition & 1 deletion galaxy_ng/app/api/v1/filtersets.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def keywords_filter(self, queryset, name, value):
def owner_filter(self, queryset, name, value):
# find the owner on the linked v3 namespace

# FIXME - this is terribly slow
# FIXME(jctanner): this is terribly slow
pks = []
for ns1 in LegacyNamespace.objects.all():
if not ns1.namespace:
Expand Down
6 changes: 3 additions & 3 deletions galaxy_ng/app/api/v1/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def get_date_joined(self, obj):
def get_summary_fields(self, obj):
return {}

# TODO: What does this actually mean?
# TODO(jctanner): What does this actually mean?
# def get_active(self, obj):
# return True

Expand Down Expand Up @@ -324,7 +324,7 @@ def get_summary_fields(self, obj):

versions = obj.full_metadata.get('versions', [])
if versions:
# FIXME - we can't assume they're all sorted yet
# FIXME(jctanner): we can't assume they're all sorted yet
versions = sort_versions(versions)
versions = versions[::-1]
if len(versions) > 10:
Expand All @@ -340,7 +340,7 @@ def get_summary_fields(self, obj):
'pulp_href': pulp_href
}

# FIXME - repository is a bit hacky atm
# FIXME(jctanner): repository is a bit hacky atm
repository = {}
if obj.full_metadata.get('repository'):
repository = obj.full_metadata.get('repository')
Expand Down
2 changes: 1 addition & 1 deletion galaxy_ng/app/api/v1/viewsets/roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def update(self, request, pk=None):
role.full_metadata[key] = newval
changed[key] = newval

# TODO - get rid of github_reference?
# TODO(jctanner): get rid of github_reference?
if key == 'github_branch':
key = 'github_reference'
if role.full_metadata.get(key) != newval:
Expand Down
2 changes: 1 addition & 1 deletion galaxy_ng/app/api/v3/serializers/execution_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def _content_info(self, content):
"tag_name": None,
}

# TODO: Figure out if there is a way to prefetch Manifest and Tag objects
# TODO(jerabekjiri): Figure out if there is a way to prefetch Manifest and Tag objects
if content.pulp_type == "container.manifest":
manifest = container_models.Manifest.objects.get(pk=content.pk)
return_data["manifest_digest"] = manifest.digest
Expand Down
2 changes: 1 addition & 1 deletion galaxy_ng/app/api/v3/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@

# >>>> END OVERRIDDEN PULP ANSIBLE ENDPOINTS <<<<<

# TODO: Endpoints that have not been moved to pulp ansible yet
# TODO(newswangerd): Endpoints that have not been moved to pulp ansible yet
path(
"collections/<str:namespace>/<str:name>/versions/<str:version>/move/"
"<str:source_path>/<str:dest_path>/",
Expand Down
4 changes: 2 additions & 2 deletions galaxy_ng/app/api/v3/viewsets/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ def create(self, request, *args, **kwargs):
version=data['filename'].version,
)

# TODO: CollectionImport.get_absolute_url() should be able to generate this, but
# it needs the repo/distro base_path for the <path> part of url
# TODO(alikins): CollectionImport.get_absolute_url() should be able to generate this, but
# it needs the repo/distro base_path for the <path> part of url
import_obj_url = reverse("galaxy:api:v3:collection-imports-detail",
kwargs={'pk': str(task_detail.pk),
'path': path})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ def _is_shipping_configured(self):
return auth_valid

def _last_gathering(self):
# TODO: Waiting for persistent DB storage in Hub
# TODO(slemrmartin): Waiting for persistent DB storage in Hub
# https://issues.redhat.com/browse/AAH-2009
# return settings.AUTOMATION_ANALYTICS_LAST_GATHER
return None

def _load_last_gathered_entries(self):
# TODO: Waiting for persistent DB storage in Hub
# TODO(slemrmartin): Waiting for persistent DB storage in Hub
# https://issues.redhat.com/browse/AAH-2009
# from awx.conf.models import Setting
#
Expand All @@ -59,11 +59,11 @@ def _load_last_gathered_entries(self):
return last_gathered_entries

def _save_last_gathered_entries(self, last_gathered_entries):
# TODO: Waiting for persistent DB storage in Hub
# TODO(slemrmartin): Waiting for persistent DB storage in Hub
# https://issues.redhat.com/browse/AAH-2009
pass

def _save_last_gather(self):
# TODO: Waiting for persistent DB storage in Hub
# TODO(slemrmartin): Waiting for persistent DB storage in Hub
# https://issues.redhat.com/browse/AAH-2009
pass
2 changes: 1 addition & 1 deletion galaxy_ng/app/migrations/_dab_rbac.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def pulp_role_to_single_content_type_or_none(pulprole):


def create_permissions_as_operation(apps, schema_editor):
# TODO: possibly create permissions for more apps here
# TODO(jctanner): possibly create permissions for more apps here
for app_label in {'ansible', 'container', 'core', 'galaxy'}:
create_dab_permissions(global_apps.get_app_config(app_label), apps=apps)

Expand Down
4 changes: 2 additions & 2 deletions galaxy_ng/app/models/namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ class Namespace(

@property
def avatar_url(self):
# TODO: remove this once we can fix the content app on CRC
# the content app in crc doesn't work
# TODO(newswangerd): remove this once we can fix the content app on CRC
# the content app in crc doesn't work
if settings.GALAXY_DEPLOYMENT_MODE == DeploymentMode.STANDALONE.value: # noqa: SIM300
data = self.last_created_pulp_metadata
if data and data.avatar_sha256:
Expand Down
2 changes: 1 addition & 1 deletion galaxy_ng/app/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@
'galaxy_only_team_member': {'name': 'Galaxy Team Member', 'shortname': 'team_member'},
'team_member': {},
'team_admin': {},
# TODO: add organization to the registry later
# TODO(jctanner): add organization to the registry later
# 'org_admin': {},
# 'org_member': {},
}
Expand Down
10 changes: 5 additions & 5 deletions galaxy_ng/app/signals/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def copy_role_to_role_definition(sender, instance, created, **kwargs):
content_type=content_type,
description=instance.description or instance.name,
)
# TODO: other fields? like description
# TODO(jctanner): other fields? like description


@receiver(post_delete, sender=Role)
Expand Down Expand Up @@ -285,7 +285,7 @@ def copy_role_definition_to_role(sender, instance, created, **kwargs):
role = Role.objects.filter(name=role_name).first()
if not role:
Role.objects.create(name=role_name)
# TODO: other fields? like description
# TODO(jctanner): other fields? like description


@receiver(post_delete, sender=RoleDefinition)
Expand Down Expand Up @@ -365,7 +365,7 @@ def lazy_content_type_correction(rd, obj):
def copy_pulp_user_role(sender, instance, created, **kwargs):
"""When a pulp role is granted to a user, grant the equivalent dab role."""

# FIXME - this is a temporary workaround to allow on-demand
# FIXME(jctanner): this is a temporary workaround to allow on-demand
# assigment of task roles to users from pulpcore's AFTER_CREATE
# hook on the Task model which calls ...
# self.add_roles_for_object_creator("core.task_user_dispatcher")
Expand Down Expand Up @@ -416,7 +416,7 @@ def copy_pulp_group_role(sender, instance, created, **kwargs):
team = Team.objects.filter(group=instance.group)
if rd and team.exists():
team = team.first()
# FIXME - multi-type roledefs
# FIXME(jctanner): multi-type roledefs
try:
if instance.content_object:
rd.give_permission(team, instance.content_object)
Expand All @@ -436,7 +436,7 @@ def delete_pulp_group_role(sender, instance, **kwargs):
team = Team.objects.filter(group=instance.group)
if rd and team.exists():
team = team.first()
# FIXME - multi-type roledefs
# FIXME(jctanner): multi-type roledefs
try:
if instance.content_object:
rd.remove_permission(team, instance.content_object)
Expand Down
2 changes: 1 addition & 1 deletion galaxy_ng/app/tasks/publishing.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def get_created_collection_versions():
created_resources = current_task.created_resources.filter(
content_type_id=ContentType.objects.get_for_model(CollectionVersion))

# TODO: replace with values_list
# TODO(alikins): replace with values_list
created_collection_versions = []
for created_resource in created_resources:
collection_version = created_resource.content_object
Expand Down
2 changes: 1 addition & 1 deletion galaxy_ng/social/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def handle_v3_namespace(self, session_user, session_email, session_login, github
+ f' is NOT owner of {found_namespace}'
)

# FIXME - make one from the transformed name?
# FIXME(jctanner): make one from the transformed name?
if not found_namespace:
namespace, namespace_created = self._ensure_namespace(namespace_name, session_user)
logger.info(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ def private_repo_v3(user, password, expect_pass, extra):
assert_pass(expect_pass, response.status_code, 200, 403)


# TODO move logic to ReusableCollection._reset_collection()
# TODO(bmclaughlin): move logic to ReusableCollection._reset_collection()
def _reset_collection_repo(cv_pulp_href, repo, staging_repo):
requests.post(
f"{SERVER}{repo['pulp_href']}move_collection_version/",
Expand Down
4 changes: 2 additions & 2 deletions galaxy_ng/tests/integration/api/test_api_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def test_galaxy_api_root_standalone_no_auth_access(galaxy_client):
def test_galaxy_api_root(galaxy_client, artifact):
"""Test galaxy API root."""

# TODO: change to `basic_user` profile when can access pulp-v3 api root
# TODO(chr-stian): change to `basic_user` profile when can access pulp-v3 api root
gc = galaxy_client("admin")
# verify api root works
response = gc.get(gc.galaxy_root)
Expand All @@ -43,7 +43,7 @@ def test_galaxy_api_root(galaxy_client, artifact):
def test_galaxy_api_root_v_4_5(galaxy_client, artifact):
"""Test galaxy API root."""

# TODO: change to `basic_user` profile when can access pulp-v3 api root
# TODO(chr-stian): change to `basic_user` profile when can access pulp-v3 api root
gc = galaxy_client("admin")

# verify api root works
Expand Down
6 changes: 3 additions & 3 deletions galaxy_ng/tests/integration/api/test_artifact_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
logger = logging.getLogger(__name__)


# TODO Refactor get_client to provide access to bearer token
# FIXME: unskip when https://issues.redhat.com/browse/AAP-32675 is merged
# TODO(bmclaughlin): Refactor get_client to provide access to bearer token
# FIXME(jerabekjiri): unskip when https://issues.redhat.com/browse/AAP-32675 is merged
@pytest.mark.skip_in_gw
@pytest.mark.deployment_standalone
@pytest.mark.installer_smoke_test
Expand Down Expand Up @@ -72,7 +72,7 @@ def test_download_artifact(ansible_config, galaxy_client):
assert ci.version == version


# TODO: make download logic more DRY in these tests
# TODO(awcrosby): make download logic more DRY in these tests
@pytest.mark.min_hub_version("4.6dev")
@pytest.mark.all
def test_download_artifact_validated(ansible_config, galaxy_client):
Expand Down
4 changes: 2 additions & 2 deletions galaxy_ng/tests/integration/api/test_artifact_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,12 @@ def test_long_field_values(galaxy_client, field):
assert fieldname in resp["error"]["description"]


# FIXME: unskip when https://issues.redhat.com/browse/AAP-32675 is merged
# FIXME(jerabekjiri): unskip when https://issues.redhat.com/browse/AAP-32675 is merged
@pytest.mark.skip_in_gw
@pytest.mark.parametrize(
"spec",
[
# TODO: move most these to galaxy-importer unit tests
# TODO(awcrosby): move most these to galaxy-importer unit tests
("2eq", "==2.10", "completed"),
# ("gt", ">2.10.0", "completed"),
# ("gteq", ">=2.10", "completed"),
Expand Down
4 changes: 2 additions & 2 deletions galaxy_ng/tests/integration/api/test_collection_delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def test_delete_collection(galaxy_client, uncertifiedv2):
get_collection(gc, cnamespace, cname, ckey[2])


# FIXME: unskip when https://issues.redhat.com/browse/AAP-32675 is merged
# FIXME(jerabekjiri): unskip when https://issues.redhat.com/browse/AAP-32675 is merged
@pytest.mark.skip_in_gw
@pytest.mark.galaxyapi_smoke
@pytest.mark.delete
Expand Down Expand Up @@ -90,7 +90,7 @@ def test_delete_collection_version(galaxy_client, uncertifiedv2):
get_collection(gc, cnamespace, cname, ckey[2])


# FIXME: unskip when https://issues.redhat.com/browse/AAP-32675 is merged
# FIXME(jerabekjiri): unskip when https://issues.redhat.com/browse/AAP-32675 is merged
@pytest.mark.skip_in_gw
@pytest.mark.delete
@pytest.mark.min_hub_version("4.7dev")
Expand Down
Loading

0 comments on commit 0f85b33

Please sign in to comment.