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

Refactoring & dependency updates #17

Merged
merged 209 commits into from
Oct 16, 2024
Merged

Refactoring & dependency updates #17

merged 209 commits into from
Oct 16, 2024

Conversation

a0x8o
Copy link
Owner

@a0x8o a0x8o commented Oct 8, 2024

ps.map: Initialize variable before using it in conditional (https://github.com/OSGeo/grass/pull/4286[)](https://github.com/a0x8o/grass/commit/9bbfd6bd65554d989f5bbbcd968946c0ebcd339b)

checks: Flake8 F841 fixes in the scripts directory part 2 (https://github.com/OSGeo/grass/pull/4241[)](https://github.com/a0x8o/grass/commit/102bc38d16df035dbb0b4caf0f16e7fda0d12273)

CI(deps): Update alpine:3.20 Docker digest to beefdbd (https://github.com/OSGeo/grass/pull/4287[)](https://github.com/a0x8o/grass/commit/39e1e11fe8349260ba5bfd3794a2e917675cfeb3)

grass.app: Move ISIS integration to the library (https://github.com/OSGeo/grass/pull/4169[)](https://github.com/a0x8o/grass/commit/83ee14690fdd465cd082a8289c5895e9bfc5c732)

r.out.png: reset file pointer to NULL after fclose (https://github.com/OSGeo/grass/pull/4220[)](https://github.com/a0x8o/grass/commit/98e3fe1f4119329fb9533e7623ea1533ccc009af)

grass.temporal.stds_export: Use pathlib Path.read_text and Path.write…

checks: flake8 F841 (local variable assigned to but never used) fixes…

v.external: Check for valid list before passing to qsort (https://github.com/OSGeo/grass/pull/4280[)](https://github.com/a0x8o/grass/commit/7c6c12bf98f5bf405372ee692b880d8b295c2177)

wxGUI/gmodeler: dialogs code refactoring (https://github.com/OSGeo/grass/pull/3816[)](https://github.com/a0x8o/grass/commit/b1c8d10e0870005ff87344a37eb4438f9daa5420)

r.univar: fix MASK check with nprocs > 1 (https://github.com/OSGeo/grass/pull/4297[)](https://github.com/a0x8o/grass/commit/cc2797c9f85afb4efb512fb755d902ecf780477f)

CI(deps): Update DeterminateSystems/nix-installer-action action to v14 (

CI(deps): Update ruff to v0.6.4 (https://github.com/OSGeo/grass/pull/4279[)](https://github.com/a0x8o/grass/commit/b9c19ab5475c7c24b617eb75adaf5851c69fec09)

(https://github.com/a0x8o/grass/commits?author=echoix) authored last month
v.out.ogr: Check for valid array before passing to qsort (https://github.com/OSGeo/grass/pull/4278[)](https://github.com/a0x8o/grass/commit/85efe798c6106a18d562799a64453787ebc5a63f)

r.proj: Create unit tests (https://github.com/OSGeo/grass/pull/4225[)](https://github.com/a0x8o/grass/commit/997624b5bfa4e8141d5b742367d51fef97273efb)

Commits on Sep 10, 2024
v.vol.rst: Initialize structure contents before passing it around (OSGeo#4282

v.generalize: Initialize all of structure contents before using it (OSGeo#4281

t.rast.accumulate: remove printing (https://github.com/OSGeo/grass/pull/4301[)](https://github.com/a0x8o/grass/commit/adcdf28bb2ff1b4602bf7df898a8040ba1f1309e)

CI: Resolve flake8 issues in utils directory (https://github.com/OSGeo/grass/pull/4303[)](https://github.com/a0x8o/grass/commit/e4fdf904c32f90c96c038d4cb2c5f67e6cc0da81)

CI(deps): Update docker/dockerfile Docker tag to v1.10 (https://github.com/OSGeo/grass/pull/4305[)](https://github.com/a0x8o/grass/commit/569c730be0eb42de9f31eae1c8e78f7ee7cb7e92)

CI: Update .flake8 configuration and fix flake8 errors in lib/init/gr…

lib/db: Fix copy into fixed size buffer issue in SQLite driver (OSGeo#4255

CI(deps): Update peter-evans/create-pull-request action to v7.0.2 (OSGeo#4311

GUI: fix ColumnSorterMixin regression (https://github.com/OSGeo/grass/pull/4310[)](https://github.com/a0x8o/grass/commit/5de8682c5bdf122f832619926010abbc811395cc)

Checks: flake8 F841 (local variable assigned to but never used) fixes…

CI: Fix Flake8 linter errors in man/ directory (https://github.com/OSGeo/grass/pull/4292[)](https://github.com/a0x8o/grass/commit/b7bcd066e99893a521019f3ef6a497163f304d9e)

contributing: update style guide for C (https://github.com/OSGeo/grass/pull/4312[)](https://github.com/a0x8o/grass/commit/9aeabc14fe862f5b7dd10ea4ca831c123eeb737c)

ps.map: Fix copy into fixed size buffer issue in do_scalebar.c (OSGeo#4307

GUI: gmodeler fix adding tool (https://github.com/OSGeo/grass/pull/4309[)](https://github.com/a0x8o/grass/commit/2c1df9f89b308b6f0bb3df45763d92ff00c986a6)

lib/gis: Add portable G_strlcat function (https://github.com/OSGeo/grass/pull/4304[)](https://github.com/a0x8o/grass/commit/cd5f1bd277c1beb7e5fdfa7f3b4db0caf26f6c51)

CI(deps): Update github/codeql-action action to v3.26.7 (https://github.com/OSGeo/grass/pull/4314[)](https://github.com/a0x8o/grass/commit/7dbb49bc701c06a2c39b1d5a7b48e85b71b914c2)

lib: Accept more newline styles in G_getl (https://github.com/OSGeo/grass/pull/3853[)](https://github.com/a0x8o/grass/commit/d2f347782adee4f9a8f7e3a3c1dd48fd65884145)

style: Fix all flake8-gettext (INT) errors (INT001, INT002, INT003) (OSGeo#4052

v.in.dwg: Avoid using same variable as parameter and destination in s…

CI(macOS): Use micromamba-shell for steps to load PATH changes (OSGeo#4325

lib/linkm: Change non-returning internal function types to void (OSGeo#4318

CI(OSGeo4W): Add -pipe to CFLAGS and CXXFLAGS to reduce build time (OSGeo#4326

CI(deps): Update peter-evans/create-pull-request action to v7.0.3 (OSGeo#4327

CI(deps): Update ruff to v0.6.5 (https://github.com/OSGeo/grass/pull/4315[)](https://github.com/a0x8o/grass/commit/560340a9c01414469996b3f94d60406d1297e2c5)

docs: add README.md to doc/development/rfc/ (https://github.com/OSGeo/grass/pull/4316[)](https://github.com/a0x8o/grass/commit/d7c126f2d844c014b79cb94bda55e97984e6445f)

r.clump: Fix unchecked return value from lseek (https://github.com/OSGeo/grass/pull/4151[)](https://github.com/a0x8o/grass/commit/7c2708027889e5c0f7f19c841839b3f9f568f7ea)

v.to.3d: Fix Resource Leak Issue in trans2.c (https://github.com/OSGeo/grass/pull/4320[)](https://github.com/a0x8o/grass/commit/fdcd8d8223fed5c1e5b05c0579f111a0325bd5ca)

r.viewshed: initialize struct member before using struct (https://github.com/OSGeo/grass/pull/4232[)](https://github.com/a0x8o/grass/commit/c840f3c43874fa8ebb52ea45ddb1c1a3fec5bf55)

i.rectify: Fix copy into fixed size buffer issue in main.c of i.recti…

i.segment: Move unused variable value into a code comment (https://github.com/OSGeo/grass/pull/4153[)](https://github.com/a0x8o/grass/commit/826ab62d781b07ac456cf0056631f39882419859)

CI(deps): Update ubuntu:22.04 Docker digest to 58b8789 (https://github.com/OSGeo/grass/pull/4331[)](https://github.com/a0x8o/grass/commit/a0486dd3a7f3d00abf4541e96f814fda8de66f2d)

style: Enable checking for SIM115 adding exclusions for existing issues

docs: update and cleanup of infrastructure.md (https://github.com/OSGeo/grass/pull/4294[)](https://github.com/a0x8o/grass/commit/df714ec1f02fef2301a7bea3c7647f39b1530b55)

docs: update Programmer's Manual's GIS lib (string) section (https://github.com/OSGeo/grass/pull/4333[)](https://github.com/a0x8o/grass/commit/a816dc1548fec62273cb3829d614f2ffb8290d67)

@nilason
nilason authored 3 weeks ago
t.rast.univar: Use pathlib Path.read_text to open test outputs in t.r…

@echoix
echoix authored 3 weeks ago
docs: update outdated trac URLs to GitHub (https://github.com/OSGeo/grass/pull/4317[)](https://github.com/a0x8o/grass/commit/5e47e41efad02e47aec2e017a07e12215ec61197)

@neteler
neteler authored 3 weeks ago

ymdatta and others added 30 commits September 6, 2024 21:35
* Fix F841 problems in `scripts` directory

* Update `.flake8` with fixes for F841

* Remove unused lines based on reviewed suggestions
Path setup for ISIS was lost in GIS variable setup. This moves it to the library, where other paths and integrations are initialized.

The variables are left as is, without further testing.
This patch continues the work from 917ba58. It's a good
practice to immediately reset the file pointer once we
do fclose on it, as it prevents using/closing descriptor
allocated to another file in the future execution paths.

Signed-off-by: Mohan Yelugoti <ymdatta.work@gmail.com>
Currently, if 'HAVE_OGR' macro is defined, as part of execution,
we order all formats by name using qsort. But, list containing
all formats is assigned based on a conditional and if the
conditional fails, it can be NULL.
Behavior of qsort is undefined when a NULL ptr is passed as array
argument. To avoid getting into that situation, check if the array
is NULL before performing qsort on it.
This issue was found using cppcheck tool.

Signed-off-by: Mohan Yelugoti <ymdatta.work@gmail.com>
* g.gui.gmodeler: start refactoring

* assign results from _getLabel() directly instead of using intermediate vars

* do not run Getlabel() if not needed

* VariableListCtrl: simplify (no need to run one loop twice)
* CI(deps): Update ruff to v0.6.4

* style: Fix List index lookup in `enumerate()` loop (PLR1736) in __writeNvizState

* style: Fix Unnecessary lookup of dictionary value by key (PLR1733) in iscatt_core.py

* style: Fix `enumerate` index is unused, use `for plane in constants` instead (FURB148) in __writeNvizState

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Edouard Choinière <27212526+echoix@users.noreply.github.com>
Currently, filling list with GDAL driver names is based on
a conditional and if the conditional fails, the list can be NULL.

We pass this list to qsort to sort the names, but behavior
of qsort with a NULL array is undefined. To avoid getting into this
situation, check if the array is NULL before performing qsort on it.

This issue was found using cppcheck tool.

Signed-off-by: Mohan Yelugoti <ymdatta.work@gmail.com>
* create unit tests for r.proj

* change the source project

* update the validation values according to the map in the project

* remove shell cmd, update doc, modify precision
)

* v.vol.rst: Initialize structure contents before passing it around

`skip_point` structure is not initialized when declared. This was
found using cppcheck tool.

Only when `cv` is true, `skip_point` contents are filled and the
structure is used. cppcheck raised the issue when 'cv' is false.
Technically, we don't need skip_point in such cases and not
initializing it won't affect the execution. Nevertheless, it's a
good practice to initialize structure contents at the time of
declaration.

Signed-off-by: Mohan Yelugoti <ymdatta.work@gmail.com>

* Use correct literal for double type

Co-authored-by: Nicklas Larsson <n_larsson@yahoo.com>

---------

Signed-off-by: Mohan Yelugoti <ymdatta.work@gmail.com>
Co-authored-by: Nicklas Larsson <n_larsson@yahoo.com>
…4281)

* v.generalize: Initialize all of structure contents before using it

Currently, in `head` which is a `POINT_LIST` structure, we are
only initializing the next pointer to NULL, but data present
in the point substructure is not initialized which implies that
it would be filled with random data. To avoid such scenario,
initialize point coordinates to zero.

This was found using cppcheck tool.

Signed-off-by: Mohan Yelugoti <ymdatta.work@gmail.com>

* Use correct literal for double type

Co-authored-by: Nicklas Larsson <n_larsson@yahoo.com>

---------

Signed-off-by: Mohan Yelugoti <ymdatta.work@gmail.com>
Co-authored-by: Nicklas Larsson <n_larsson@yahoo.com>
* resolved flake8 in utils

* updated .flake8

---------

Co-authored-by: Arohan Ajit <aajit@chirpn.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…ass.py (#4289)

* fixed flake8 errors in lib/init/grass.py

* fixed flake8 details .flake8
* drivers: copy into fixed size buffer issue

* Requested changes

* without variable

* Update db/drivers/sqlite/db.c

Co-authored-by: Nicklas Larsson <n_larsson@yahoo.com>

* Use Db statements

---------

Co-authored-by: Nicklas Larsson <n_larsson@yahoo.com>
* fixing TypeError ColumnSorterMixin #4277

* #4277 fix ColumnSorterMixin error
* resolved some more flake8 warnings

* fixed all man flake8 errors except buildhtml

* Update .flake8

---------
Co-authored-by: Arohan Ajit <aajit@chirpn.com>
* revert 2cf98da

* fix regression introduced in f99780c
Add wrapper function for strlcat(), using system function if available, otherwise
uses implementation by Todd C. Miller originated from
https://github.com/openbsd/src/blob/e291b8af02e5c2b53d7ddb1f0c9c0fd608b97d45/lib/libc/string/strlcat.c.

G_strlcat() is a safer alternative to strcat().
ShubhamDesai and others added 29 commits October 12, 2024 10:03
* Fix Resource Leak issue

* Fix Resource Leak issue
* fix Resource Leak issue

* Update display/d.vect/attr.c
…ds (#4501)

In some situations, when some conditionals fails, we would be assigning
uninitialized variables to values, which is undefined behavior. Fix that
by assigning a value to the variables.

This was found using cppcheck tool.

Signed-off-by: Mohan Yelugoti <ymdatta.work@gmail.com>
… overflow (#4512)

Fixes two new issues reported by Coverity Scan:

- Handles case of unsuccessful creation of json string
- Silences false positive issue for string copy operation to buffer of size GMAPSET_MAX from G_mapset().
Ruff rule PT004 is deprecated, so doesn't run with --preview flag, but still appears without the --preview flag.
Since the only error won't be fixed, ignore that rule for the time being.
* pytest: Collect code coverage in multiple workers too

* utils: Handle paths that already have a .py extension in coverage_mapper

* CI: Set INITIAL_GISBASE and INITIAL_PWD env vars for running pytest with multiple workers

* Coverage: Omit gui/wxpython subfolders for now

They are not covered at all and take some noticeable time to collect

* Coverage: Remove unneeded omit patten for gui/wxpython subfolders
* Fix Resource Leak issue

* requested changes
Makes the script runnable on e.g. BSD platforms, which does not ship with md5sum.

In addition fixes shellcheck warnings.
* Vlib: always write out topo files in update mode
* delete support files only when closing
* fix pygrass Vect_close

---------

Co-authored-by: Huidae Cho <grass4u@gmail.com>
Similarly to #4401, this replaces usage of MASK by mask on additional places. It also improves wording of a warning in i.fft.
… on Cray (#4363)

When the code is being compiled for CRAY HPC machines, a macro and
a function to convert IEEE single precision floating point number
to CRAY number are defined.

To adjust the base, '16258' constant is being used, which according
to C rules (C99, section 6.4.4.1, subsection semantics) fits into
an integer. Right shifting that integer, which is of 32 bits, by
48 results in integer overflow. Avoid this by defining the
literal constant with the long data type.

This comes with an extended discussion in PR #4363 and an idea to remove the code completely.

Signed-off-by: Mohan Yelugoti <ymdatta.work@gmail.com>
* CI: Create a workflow to assign milestones

* Add GH_TOKEN for gh cli

* CI: Add GH_REPO for gh cli

* CI: View PR from gh cli using html_url

* CI: Download and parse version file

* CI: Show version file

* CI: Download and parse version file using a pipe

* Show version file output

Clean up

* Pipe version file env to head

* Rename variables to milestone and title

* Edit PR with milestone

* Get milestone from gh cli

* Add comment on why API call is used for getting milestone

* Show if the PR has a milestone set or not

* Do not run steps if a milestone is already set

* Add pull_request_target closed trigger

* Add ref as url parameter

* Remove debugging steps

* CI: Handle RC followed by numbers in sed pattern replacement
* Remove Makefiles.
* Move the functioning test to the testsuite directory for the gunittest to pick it up.
* Remove the extended example how to run gunittest. Point to the CI in the README instead.
* Remove hemisphere generator because it does not test anything by itself (without further processing and a human).
* Remove GPS import tests as the tools are not in core.
* Remove division into subdirectories. The directories with the code should be used instead.
* Improve the test for gunittest loader function with some duplication but now creating an overview of .py and .sh tests.
Again, use lowercase mask and other wording instead of MASK when talking about masking, similar to #4401 and #4495.

It also adjusts the wording in r.topidx and i.segment.
@a0x8o a0x8o merged commit 362bee3 into a0x8o:main Oct 16, 2024
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.