Skip to content

Replace flake8 and black with ruff#14271

Draft
mattiagiupponi wants to merge 2 commits into
masterfrom
ruff
Draft

Replace flake8 and black with ruff#14271
mattiagiupponi wants to merge 2 commits into
masterfrom
ruff

Conversation

@mattiagiupponi
Copy link
Copy Markdown
Contributor

Checklist

Reviewing is a process done by project maintainers, mostly on a volunteer basis. We try to keep the overhead as small as possible and appreciate if you help us to do so by completing the following items. Feel free to ask in a comment if you have troubles with any of them.

For all pull requests:

  • Confirm you have read the contribution guidelines
  • You have sent a Contribution Licence Agreement (CLA) as necessary (not required for small changes, e.g., fixing typos in the documentation)
  • Make sure the first PR targets the master branch, eventual backports will be managed later. This can be ignored if the PR is fixing an issue that only happens in a specific branch, but not in newer ones.

The following are required only for core and extension modules (they are welcomed, but not required, for contrib modules):

  • There is a ticket in https://github.com/GeoNode/geonode/issues describing the issue/improvement/feature (a notable exemption is, changes not visible to end-users)
  • The issue connected to the PR must have Labels and Milestone assigned
  • PR for bug fixes and small new features are presented as a single commit
  • PR title must be in the form "[Fixes #<issue_number>] Title of the PR"
  • New unit tests have been added covering the changes, unless there is an explanation on why the tests are not necessary/implemented

Submitting the PR does not require you to check all items, but by the time it gets merged, they should be either satisfied or inapplicable.

@cla-bot cla-bot Bot added the cla-signed CLA Bot: community license agreement signed label May 27, 2026
Comment thread geonode/geoserver/helpers.py Fixed
Comment thread geonode/geoserver/helpers.py Fixed
Comment thread geonode/geoserver/helpers.py Fixed
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request performs a large-scale code formatting and import sorting cleanup across various modules of the GeoNode codebase, including base, layers, maps, documents, and harvesting. The review feedback highlights several minor issues resulting from collapsing multi-line implicitly concatenated strings into single lines, which caused missing spaces (such as 'bedeprecated', 'at least{min_digits}', and run-together log messages). Additionally, the reviewer pointed out a spelling typo ('asyncronous') and a duplicate word ('size size') in a document upload form error message along with its corresponding test. All of these comments are highly actionable and include precise code suggestions.

Comment thread geonode/base/views.py
)
if not _errors:
_message = f'The asyncronous permissions {form.cleaned_data.get("mode")} request for {", ".join(users_usernames or groups_names)} has been sent'
_message = f"The asyncronous permissions {form.cleaned_data.get('mode')} request for {', '.join(users_usernames or groups_names)} has been sent"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There is a typo in the success message: 'asyncronous' should be spelled 'asynchronous'.

Suggested change
_message = f"The asyncronous permissions {form.cleaned_data.get('mode')} request for {', '.join(users_usernames or groups_names)} has been sent"
_message = f"The asynchronous permissions {form.cleaned_data.get('mode')} request for {', '.join(users_usernames or groups_names)} has been sent"

Comment thread geonode/context_processors.py Outdated
Comment thread geonode/documents/forms.py Outdated
Comment thread geonode/documents/tests.py Outdated
Comment thread geonode/harvesting/tasks.py Outdated
Comment thread geonode/geoserver/helpers.py Outdated
Comment thread geonode/people/password_validators.py Outdated
Comment thread geonode/people/password_validators.py
Comment on lines +413 to +415
OAuth2Error(
"Invalid profile_url, falling back to id_token checks..."
)
Comment thread geonode/views.py
@@ -158,7 +196,11 @@
def moderator_contacted(request, inactive_user=None):
"""Used when a user signs up."""
user = get_user_model().objects.get(id=inactive_user)
return TemplateResponse(request, template="account/admin_approval_sent.html", context={"email": user.email})
return TemplateResponse(
request,
Comment thread geonode/api/views.py
except Exception as e:
return HttpResponse(json.dumps({"error": str(e)}), status=403, content_type="application/json")
return HttpResponse(
json.dumps({"error": str(e)}),
Comment thread geonode/proxy/views.py

content = response.content or response.reason
status = response.status_code
response_headers = response.headers
content_type = response.headers.get("Content-Type")

if status >= 400:
_response = HttpResponse(content=content, reason=content, status=status, content_type=content_type)
_response = HttpResponse(
content=content, reason=content, status=status, content_type=content_type
Comment thread geonode/security/views.py
Comment on lines +353 to +355
json.dumps(
{"success": "false", "message": f'Exception occurred: "{str(e)}"'}
),
@@ -238,12 +250,16 @@

except Exception as e:
logger.exception("XLSX Pre-processing failed")
raise InvalidInputFileException(detail=f"Failed to securely parse Excel: {str(e)}")
raise InvalidInputFileException(
detail=f"Failed to securely parse Excel: {str(e)}"
@@ -94,14 +101,18 @@
with open(files.get("base_file")) as _xml:
dlxml.fromstring(_xml.read().encode())
except Exception as err:
raise InvalidXmlException(f"Uploaded document is not XML or is invalid: {str(err)}")
raise InvalidXmlException(
f"Uploaded document is not XML or is invalid: {str(err)}"
Comment thread geonode/views.py
@@ -95,7 +121,9 @@

def err403(request, exception):
if not request.user.is_authenticated:
return HttpResponseRedirect(f"{reverse('account_login')}?next={request.get_full_path()}")
return HttpResponseRedirect(
f"{reverse('account_login')}?next={request.get_full_path()}"
Comment thread pavement.py
("java_path=", "j", "Full path to java install for Windows"),
("force_exec=", "", "Force GeoServer Start."),
]
)
Comment thread tests/pavement.py
("java_path=", "j", "Full path to java install for Windows"),
("force_exec=", "", "Force GeoServer Start."),
]
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed CLA Bot: community license agreement signed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants