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

Wintest #1

Open
wants to merge 519 commits into
base: main
Choose a base branch
from
Open

Wintest #1

wants to merge 519 commits into from

Conversation

ninsbl
Copy link
Owner

@ninsbl ninsbl commented Oct 26, 2022

No description provided.

lindakarlovska and others added 30 commits February 7, 2022 23:38
* Use f-strings for simple string formatting.
* Use with statement for open.
* Simply return from main as in other parts of the function.
* Order imports better.
* Update to new import alias.
A configuration file can now be specified explicitly in the command line which is useful for providing custom configuration file, e.g., with more or less tests excluded or with different timeout for different platforms or hardware setups.

Removes a useless return from the config function. Reports OSErrors from the function without traceback.
…Geo#2152)

To avoid bias when other processes are running at the same time
This adds pytest configuration and one pytest-ready test file so that pytest can run on the source code without errors.

Notably, this does not use or run any of the existing tests and searches for tests in directories called tests (instead of testsuite).

There is no handling of GRASS session or any test data. Each test needs to set up the session by itself.

However, given that the test assume import grass will work, the command 'pytest .' will work without errors only when Python path (PYTHONPATH) is set beforehand. (The CI is using 'grass --config ...' to get it.)

The idea is to allow for writing of tests in a different style with pytest and later add functionality for easier setup or data comparison.
* contributors.csv: added new ORCID column
* wxGUI: orcid column support added, contributed by @tmszi

This PR adds a new `orcid` column (https://orcid.org/) to the file for better citation of authors.
For discussion, see https://lists.osgeo.org/pipermail/grass-psc/2022-January/002531.html

Co-authored-by: Tomas Zigo <tomas.zigo@slovanet.sk>
Replaces pygrass.utils.decode as not needed here, grass.utils.decode was internally called anyway.
This should prevent that gui crashes when loading C libraries fails, see OSGeo#2192.
grass.jupyter and grass.script tests are almost Flake8 compliant. This fixes the reported issues and removes Python 2 specific check.

A new step in the flake8 job checks explicitly for the files in the two testsuite directories. (There is no way in Flake8 itself to include previosly excluded files which is needed because testsuite directories are ignored in the main .flake8 file and here we need to check them.)
…eo#2200)

* Add missing docstrings.
* Reorder imports (with both pylint and isort).
* Use full-word variable names.
* Use f-strings if possible. Here it replaces smart, but hard to decode, dictionary usage in format, by simple, although longer, direct use of the dictionary.
Use UTF-8 as encoding for text files (JSON files here) in grass.benchmark result reading and writing. This explicitly specifies an encoding and thus it avoids unspecified-encoding warning from Pylint.
* Fix some code scanning CodeQL overflow warnings

- Multiplication result may overflow 'int' before it is converted to 'long'.
- Multiplication result may overflow 'int' before it is converted to 'unsigned long'.

Use size_t instead of long for pointer arithmetics.
…Geo#2206)

Although tempfile.TemporaryDirectory uses weakref.finalize to delete the directory and its documentation does mention deletion during garbage-collection and during interpreter shutdown, the intention in its source code is that a with statement is used or explicit cleanup call is made because otherwise it generates a warning about implicit deletion. Pylint correctly generates warning suggesting with statement (consider-using-with).

In the future, we may consider implementing context-manager and cleanup method to the render classes, but even with that we need to stretch the existence of the temporary directory beyond one method, so the with statement is not applicable. For now, the classes are using only weakref.finalize which is sufficient for a notebook where the object life time is linked with the notebook's kernel life time which is relatively short. The Pylint warning is disabled and an explanatory comment is above.
This adds Pylint check job in a new workflow. It uses the current latest Pylint and latest Python. It uses Pylint to check for minimal supported Python version.

The check runs for the grass package (python/grass) and for wxGUI (gui/wxpython). However, most of the files are ignored. Each of the directories has its own .pylintrc file.

Pylint runs for grass.jupyter and grass.benchmark with only slightly modified configuration after fixes in targeted files (OSGeo#2199, OSGeo#2200, OSGeo#2201, OSGeo#2206). The approach for future compliance is that the other sub-packages should also eventually comply with default or almost default configuration.

For wxGUI, many Pylint messages are disabled and numbers driving coding standard limits, such as max number of local variables, are greatly loosened. Many of the disabled messages show real errors, but ignoring these for now allowed for enabling the check right away at least for the least problematic directories. The approach for future compliance is that new directories can be added (removed from ignore paths) and new issues can be checked (removed from disable) when fixed.

This compiles the code. Just testing Python functions from the grass package in the python directory does not require compiled code and package on path when started from the python directory, but checking other files requires packages on path.

The config file is in the python directory because that's the focus of this PR. (In the future, GUI may have a different config file, e.g., due to different naming conventions. On the other hand, in an ideal case, the whole source code will use this file or even a more strict version of this file in the future.)

Pylint should produce warning for disabled warnings which are not generated, although that seems to not be the case right now (useless-suppression).

The only code change here is that Pylint disable comment needs to be on the same line or inside ().

It needs to install also all optional Python dependencies because Pylint checks (can check unless disabled) all imports. This change is applied also to pytest workflow.

Using workflow on settings to run on push only to main and release branches and semver tags.

It uses strategy.matrix.include to get job-level config variables without using environmental variables.
Black is no longer a beta and has a (more strict) stability policy in place.
Changes are expected to happen over years and with updating Python versions (removing the old ones to be exact).

The changes in formatting are specialized no-spaces style for simple operands of power operator and better formatting of a complex if statement.

Python 3.10 is now among target versions. File which had to be ignored by Black due to a, now fixed, bug in Black is not ignored anymore.

In CI, matrix is used to define variables for versions (as in Pylint workflow and workflows with actual matrix). Workflow's on now specifies branches and tags for push.
This aims at running Pylint on all other files except for python/grass and gui/wxpython. Checking all files in a project is hard to do with Pylint, but pytest pylint plugin can do the job.

Many messages are disabled and complexity and similarity limits are raised. Tests in testsuite directories and some additional directories such as doc or utils are ignored. Files with a lot of issues which are unique to them are ignored explicitly.

The Pylint config is in the main dir, but checks only the 'other' files, not the grass package and wxGUI.
 * fix detection of a shortcut or band identifier
 * do not modify the provided semantic label if it contains `_`
…eo#2169)

* r.watershed: Keep 0 accumulation with -a as 0 as opposed to null

* apply the same change to seg
Do not continue if all input raster maps only contain no-data.

Fixes 2217
ninsbl and others added 30 commits September 9, 2022 00:03
…Geo#2382)

* dont fail with missing range file

* handle empty range separate
* fix OSGeo#2538
* Use getencoding() where only encoding is needed; getlocale() otherwise
…OSGeo#2495)

`CheckListCtrlMixin` class is obsolete and `OnCheckItem` method doesn't work
with wxPython >= 4.1.1 version. Instead of that, an event `wx.EVT_LIST_ITEM_CHECKED`,
`wx.EVT_LIST_ITEM_UNCHECKED` is binded to the widget `LayersList` widget.
OSGeo#2586)

Current behavior:

```
GRASS nc_spm_08_grass7/landsat:~ > g.mapsets operation=set mapset=landsat

GRASS nc_spm_08_grass7/landsat:~ > cat -e "$(g.gisenv get="GISDBASE")/\
$(g.gisenv get="LOCATION_NAME")/$(g.gisenv get="MAPSET")/SEARCH_PATH"
landsat$
$
```

Expected behavior:

```
GRASS nc_spm_08_grass7/landsat:~ > g.mapsets operation=set mapset=landsat

GRASS nc_spm_08_grass7/landsat:~ > cat -e "$(g.gisenv get="GISDBASE")/\
$(g.gisenv get="LOCATION_NAME")/$(g.gisenv get="MAPSET")/SEARCH_PATH"
landsat$
```
…OSGeo#2537)

Current code creates two cat entries for each point on the same level -
one from area point is in and one matching new entry in the database.
As entries in db have new cat values, old cat value points to a random
or non-existing entry in the db thus causing a mess.
Fixes OSGeo#2475.
This PR addresses OSGeo#2589 (SEO problems on mobile devices):
- Google: addresses "Page isn't usable on mobile" - "Viewport not set"
    - https://search.google.com/search-console/mobile-usability?resource_id=http%3A%2F%2Fgrass.osgeo.org%2F&hl=en
    - see: https://support.google.com/webmasters/answer/9063469#viewport_not_configured
- Bing: addresses "The page is missing meta language information"
    - https://www.bing.com/webmasters/seoreports?siteUrl=https%3A%2F%2Fgrass.osgeo.org%2F&ruleId=39

Manual pages generated with this PR applied are validated correctly at https://validator.w3.org/
Geometric information in the VTK Polydata dataset output of the v.out.vtk function are now saved as datatype double instead of float which is more suitable considering the amount of digits in geographic coordinates.

The 'POINTS n dataType' line now uses double dataType (float, double, int and more is allowed).

Fixes OSGeo#864.

Actual code change written by Brad ReDacted.

Co-authored-by: Brad ReDacted <brad.redacted@outlook.com>
* handle missing search path file, do not write since this is only reading
* use text mode for writing/reading
* write newline after each mapset
Create <mapset>/.sudo_as_admin_successful when $HOME/.sudo_as_admin_successful exists to avoid message about sudo for the a Bash instance for each session.

Contains several unrelated Black changes.

Fixes OSGeo#753.
* linter: turn Markdown validation on
* Markdown files cleanup
…SGeo#2595)

Same date and time format `"%A %b %d %H:%M:%S %Y"` (example
Wednesday Oct 05 06:42:36 2022) inside manual page for all use cases:

1. Core modules compiled from Git repository, with date and time retrievied
from the last commit.

2. Core modules compiled from tarball without Git repository and without
applied official patch core_modules_with_last_commit.patch, with date and
time retrievied from the module source directory.

3. Core modules compiled from tarball without Git repository and with applied
official patch core_modules_with_last_commit.patch, with date and time
retrievied from the core_modules_with_last_commit.json file.

4. Official addons with date and time retrievied from the last commit
via GitHub REST API.

5. Unofficial addons with date and time retrievied from the module source
directory.
- update to Ubuntu 22.04 base image
- update to latest PDAL (to be compiled since laz-perf missing from Ubuntu)
- update to latest laz-perf

Sync Dockerfile in main directory to docker/Dockerfile (avoids current confusion)
… 1024 px (OSGeo#2606)

* utils: module HTML man page use hamburger menu TOC for screen width < 1024 px

* Fix flake8, black errors.

* g.extension: copy CSS style file into addons docs HTML dir for every addon instalation

* g.extension: copy hamburger menu SVG image files into addons docs HTML dir for every addon instalation

* utils: set CSS class for every hamburger menu link list item

To prevent the link path from being replaced with a local path during
addon installation.

Example:

`<a href="#description">DESCRIPTION</a>`

with

`<a href="file:///usr/lib64/grass83/docs/html/#description">DESCRIPTION</a>`

* utils: fix space between HTML element attributes

* man: install module HTML man page hamburger menu TOC SVG images
* add support for zones

* add support for zones

* add test for zones

* clean properly

* add test for zones

* add support for zones

* add credits

* add credits

* add zones in manual

* add check for zones map

* black

* use RasterRow context manager

* fix zones existence test

* try if centos fails because of context manager

* fix indent

* change import order

* zones check for t.rast3d.univar

* avoid RasterRow

* avoid RasterRow

* fix if

* fix if

* fix raster_info

* fix raster_info

* fix raster_info

* fix raster_info

* import as gs

* import as gs and zones

* string formating

* clean test

* add semantic labels

* black

* remove gscript

* name tests

* name tests

* move parser, use kwargs

* move parser, use kwargs, allow DCELL

* Import tgis after parser

* Import tgis after parser

* Fix typo
…class instance finish (OSGeo#2567)

* Fix copy_mapset() func doc test
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

Successfully merging this pull request may close these issues.