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

Improve code quality #6843

Closed
mtnorthcott opened this issue Jan 19, 2021 · 0 comments
Closed

Improve code quality #6843

mtnorthcott opened this issue Jan 19, 2021 · 0 comments
Assignees
Milestone

Comments

@mtnorthcott
Copy link
Contributor

Reserved for Catalyst Academy 2021

We would like to analyse and find potential improvements in code quality throughout the GeoNode codebase. The following improvements have been proposed and should be addressed by this epic:

  • Replace body of Layer.display_type with a conditional
  • Move constants to top of file
  • Fetch dictionary keys with dict.get(...) where appropriate to provide default value
  • Remove redundant method overrides
  • Prefer sets for in-line lookups
  • Refactor long conditional statements
  • Prefer generators as input to compatible functions
  • Remove redundant enumerate calls
  • Remove duplicate function calls
  • Remove or replace dependencies
  • Replace instances of print with equivalent logger statements
  • Add docstrings to functions where it is missing
  • Investigate @cached_property and where it could be used
  • Remove python_resize_image library if we can do ops in PIL
  • Simplify conditional logic
  • Replace magic numbers and calculations where possible
  • Add helper function to perform encode-decode operations
  • Catch specific exceptions
  • Remove Python 2/3 cross-compatible code
  • Implement GET and POST handler functions
  • Close open file descriptors
  • Replace existing string formatting with f-strings
@afabiani afabiani added the Epic label Jan 19, 2021
@mtnorthcott mtnorthcott self-assigned this Jan 20, 2021
t-book added a commit that referenced this issue Jan 26, 2021
* removed use of magic numbers

* Revert changes to OpenLayers library files

* Global constant style fixes

* Revert geonode/static/geonode/js/ol-2.13/lib/deprecated.js

Co-authored-by: Matthew Northcott <[email protected]>
Co-authored-by: Alessio Fabiani <[email protected]>
Co-authored-by: Toni <[email protected]>
t-book added a commit that referenced this issue Jan 27, 2021
* Removed redundant enumerate uses.

* flake8 fixes

Co-authored-by: Alessio Fabiani <[email protected]>
Co-authored-by: Matthew Northcott <[email protected]>
Co-authored-by: Toni <[email protected]>
afabiani pushed a commit that referenced this issue Jan 28, 2021
* Removed redundant method override

* flake8 fix

Co-authored-by: Alessio Fabiani <[email protected]>
Co-authored-by: Matthew Northcott <[email protected]>
afabiani pushed a commit that referenced this issue Jan 28, 2021
* Close open file descriptors

* Syntax and style fixes

* Amend logic errors

Co-authored-by: Matthew Northcott <[email protected]>
Co-authored-by: Alessio Fabiani <[email protected]>
afabiani pushed a commit that referenced this issue Jan 28, 2021
…6838)

* Generators as parameters

* flake8 fix

Co-authored-by: Matthew Northcott <[email protected]>
Co-authored-by: Alessio Fabiani <[email protected]>
afabiani pushed a commit that referenced this issue Jan 28, 2021
…6844)

* [Fixes #6797] replace encode-decode instances with utility function

* [#6797] Fix some spaces

* Added test function for surrogate_escape_string/2

* Remove misleading header

* flake8 fix

Co-authored-by: Matthew Northcott <[email protected]>
Co-authored-by: Alessio Fabiani <[email protected]>
afabiani pushed a commit that referenced this issue Jan 28, 2021
…ate to provide default value (#6845)

* Finished replacing for inline conditionals

* Fixed undefined center in maps/tests.py

* Fixed few missing get's

Co-authored-by: Alessio Fabiani <[email protected]>
afabiani pushed a commit that referenced this issue Feb 10, 2021
* removes use of six library

* Remove remaining 'six' occurences

* Fix import in render_metrics.py

Co-authored-by: Matthew Northcott <[email protected]>
Co-authored-by: Alessio Fabiani <[email protected]>
afabiani pushed a commit that referenced this issue Feb 11, 2021
…size (#6849)

* Replaced resizeimage with PIL.Image.resize

* Removed redundant python_resize_image library

* Replaced Image.resize() with ImageOps.fit()

* Fix imports and remove python_resize_image from setup.cfg

Co-authored-by: Alessio Fabiani <[email protected]>
Co-authored-by: Matthew Northcott <[email protected]>
afabiani pushed a commit that referenced this issue Feb 11, 2021
* Simplified long conditionals

* flake8 fixes

Co-authored-by: Matthew Northcott <[email protected]>
Co-authored-by: Alessio Fabiani <[email protected]>
afabiani pushed a commit that referenced this issue Feb 11, 2021
* Split get/post handling

* flake8 fixes

Co-authored-by: Matthew Northcott <[email protected]>
Co-authored-by: Alessio Fabiani <[email protected]>
afabiani added a commit that referenced this issue Mar 16, 2021
afabiani added a commit that referenced this issue Mar 17, 2021
afabiani added a commit that referenced this issue Mar 17, 2021
afabiani added a commit that referenced this issue Mar 17, 2021
afabiani pushed a commit that referenced this issue Mar 18, 2021
… with f-strings (#7096)

* [Fixes #6843] Replace concatenated strings, %-strings, and str.format with f-strings

* [Fixes #6843] Replace concatenated strings, %-strings, and str.format with f-strings

* - Flake8 issues

* [Fixes #6843] Replace concatenated strings, %-strings, and str.format with f-strings

* [Fixes #6843] Replace concatenated strings, %-strings, and str.format with f-strings

(cherry picked from commit 6d8e654)

# Conflicts:
#	pavement.py
@afabiani afabiani added this to the 4.0.0 milestone Jul 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants