Commit graph

146 commits

Author SHA1 Message Date
Winni Neessen d6ce76b1ad
Remove sudo usage for jq installation in sonarqube.yml
All checks were successful
Codecov workflow / run (push) Successful in 1m39s
golangci-lint / lint (push) Successful in 48s
REUSE Compliance Check / test (push) Successful in 4s
SonarQube / Build (push) Successful in 1m40s
The use of sudo keyword for installing 'jq' in the SonarQube workflow file, sonarqube.yml, has been removed. This change is due to the fact that the root permission is not necessary during the installation process, adhering better to the principle of least privilege.
2024-02-14 00:50:25 +01:00
Winni Neessen 072a2aed5d
Remove sudo usage for jq installation in sonarqube.yml
All checks were successful
golangci-lint / lint (push) Successful in 47s
REUSE Compliance Check / test (push) Successful in 4s
SonarQube / Build (push) Successful in 1m37s
The use of sudo keyword for installing 'jq' in the SonarQube workflow file, sonarqube.yml, has been removed. This change is due to the fact that the root permission is not necessary during the installation process, adhering better to the principle of least privilege.
2024-02-14 00:46:07 +01:00
Winni Neessen a536ac3bde
Remove sudo usage for jq installation in sonarqube.yml
Some checks failed
golangci-lint / lint (push) Successful in 47s
REUSE Compliance Check / test (push) Successful in 4s
SonarQube / Build (push) Failing after 1m12s
The use of sudo keyword for installing 'jq' in the SonarQube workflow file, sonarqube.yml, has been removed. This change is due to the fact that the root permission is not necessary during the installation process, adhering better to the principle of least privilege.
2024-02-14 00:39:16 +01:00
Winni Neessen eb675388f0
reports. Simultaneously, the installation of 'jq' has been removed from the sonarqube.yml workflow as it's no longer needed there.
Some checks failed
golangci-lint / lint (push) Successful in 48s
REUSE Compliance Check / test (push) Successful in 4s
SonarQube / Build (push) Failing after 1m12s
2024-02-14 00:36:34 +01:00
Winni Neessen e4cbab4e43
Install jq in the codecov workflow
Some checks failed
golangci-lint / lint (push) Successful in 47s
REUSE Compliance Check / test (push) Successful in 4s
SonarQube / Build (push) Failing after 1m29s
This commit adds a new step to the codecov.yml workflow. This step installs 'jq', a command-line JSON processor, which might be necessary for the processing of test results or coverage
2024-02-14 00:33:51 +01:00
Winni Neessen 8923b88e07
Simplify workflow settings and upgrade setup-go to v4
Some checks failed
REUSE Compliance Check / test (push) Successful in 4s
SonarQube / Build (push) Failing after 1m29s
golangci-lint / lint (push) Failing after 11m20s
This commit simplifies the Forgejo workflow settings by hardcoding the 'docker' and '1.22' options for the 'runs-on' and 'go-version' respectively, instead of using a matrix. The version of setup-go action is also upgraded to v4.
2024-02-13 23:33:37 +01:00
Winni Neessen 94eca2f3fe
Fix Forgejo workflows
Some checks failed
golangci-lint / lint (push) Successful in 47s
REUSE Compliance Check / test (push) Successful in 19s
SonarQube / Build (push) Failing after 1m30s
2024-02-13 22:25:23 +01:00
Winni Neessen 759300d066
Move Github workflows to Forgejo workflows
Some checks failed
REUSE Compliance Check / test (push) Waiting to run
SonarQube / Build (push) Waiting to run
golangci-lint / lint (push) Successful in 47s
Codecov workflow / run (1.20, macos-latest) (push) Has been cancelled
Codecov workflow / run (1.20, ubuntu-latest) (push) Has been cancelled
Codecov workflow / run (1.20, windows-latest) (push) Has been cancelled
2024-02-13 22:21:35 +01:00
Winni Neessen 3c69f36748
Update Go version setup in golangci-lint workflow
All checks were successful
golangci-lint / lint (push) Successful in 48s
The workflow file for golangci-lint has been updated to use the newer version of setup-go action. This change moves from version v3 to v4
2024-02-13 19:51:27 +01:00
Winni Neessen 0b88d11fdf
Update Go version setup in golangci-lint workflow
Some checks failed
golangci-lint / lint (push) Has been cancelled
The workflow file for golangci-lint has been updated to use the newer version of setup-go action. This change moves from version v3 to v4 under
2024-02-13 19:45:53 +01:00
Winni Neessen d6b551cc5e
Correct URL format in Github Actions of golangci-lint workflow
Some checks failed
golangci-lint / lint (push) Has been cancelled
The URLs in the golangci-lint workflow file have been corrected. The extraneous "https://github.com/" part of each URL has been removed in each 'uses' section to ensure the correct working of Github actions. Now, actions/setup-go@v3, actions/checkout@v3, and golangci/g
2024-02-13 19:26:11 +01:00
Winni Neessen 5297342603
Update golangci-lint workflow's 'runs-on' value
Some checks failed
golangci-lint / lint (push) Has been cancelled
The 'runs-on' value of the golangci-lint workflow file has been updated from 'ubuntu-latest' to 'docker'. This change improves the replication of the production environment conditions for linting, ensuring more accurate code quality checks.
2024-02-13 18:58:18 +01:00
Winni Neessen c3af61791e
Update golangci-lint workflow's 'runs-on' value
Some checks failed
golangci-lint / lint (push) Failing after 40s
The 'runs-on' value of the golangci-lint workflow file has been updated from 'ubuntu-latest' to 'docker'. This change improves the replication of the production environment conditions for linting, ensuring more accurate code quality checks.
2024-02-13 18:56:24 +01:00
Winni Neessen b8c117c056
Add golangci-lint workflow
Some checks are pending
golangci-lint / lint (push) Waiting to run
A new Github Actions workflow file named golangci-lint.yml has been added to the workflows directory. This will ensure that the linting tool golangci-lint is run for every push and pull request to this project, thus improving the code quality.
2024-02-13 18:55:16 +01:00
Winni Neessen 3f7cccb511 Merge pull request 'Update URLs to point to new repository domain' (#12) from switch-gh-to-forgejo into main
Reviewed-on: #12
2024-02-11 15:28:32 +01:00
Winni Neessen c9fa7eb1d7
Add mirror repository information to README
A new section called "Mirror" was added to the README.md file indicating that the Github repository is only a mirror of the main repository. The main repository is located at "https://src.neessen.cloud/wneessen/go-meteologix". This change improves project transparency and informs contributors of the primary source of the code.
2024-02-11 15:27:34 +01:00
Winni Neessen 878c4dfe71
Update URLs to point to new repository domain
The URLs in all the files that reference the old domain (github.com) have been updated to reference the new domain (src.neessen.cloud). This includes URLs in badges, links in the README.md, import paths in .go files, and module paths in go.mod and .golangci.toml.
2024-02-11 15:24:46 +01:00
Winni Neessen 27c8542f76
Merge pull request #11 from wneessen/bearer-auth
Add bearer token authentication
2023-08-02 16:13:09 +02:00
Winni Neessen a5667bb828
Add bearer token authentication
In this commit, we've added the capability to authenticate via bearer token to Meteologix's HTTP client. A new method "WithBearerToken" has been implemented, allowing a bearer token to be set in 'meteologix.go'. Additionally, in 'httpclient.go', the token is attached to the "Authorization" header for API requests. Tests asserting token setting functionality have been added in 'meteologix_test.go'. These changes open up an alternative authentication option for our API users. The bearer auth is not public yet, so there is no way for us to test this auth
2023-08-02 16:08:38 +02:00
Winni Neessen 173c6eb8ec
Update Go versions in CI workflow
Removed versions 1.18 and 1.19 from the Go matrix in the codecov.yml file. Now, CI workflow only tests for Go version '1.20'. This change simplifies the CI testing process and removes the change of running into CI failures due to rate limiting.
2023-06-28 10:23:33 +02:00
Winni Neessen a51644fbb6
Remove redundant package comment
The comment referencing bindings to the Meteologix/Kachelmann-Wetter weather API was incorrectly placed in the astroinfo.go file. This comment was irrelevant to the respective package and therefore, has been removed for accuracy and clarity.
2023-06-27 19:37:26 +02:00
Winni Neessen f48392d553
Merge pull request #10 from wneessen/more_curweather_datapoints
More CurrentWeather datapoints and refactoring
2023-06-27 19:31:44 +02:00
Winni Neessen 85c3c1aff3
Update package version in doc.go
The version constant in doc.go was incremented from "0.1.0" to "0.1.1". This reflects recent minor changes or bug fixes made to the meteologix package.
2023-06-27 19:26:02 +02:00
Winni Neessen abd200177f
Update DateTime comment for clarity
The comment explaining the function DateTime in temperature.go was modified. The original comment was inaccurate, suggesting it returned boolean when in fact it returns the exact time the temperature data was obtained. The comment was updated to accurately reflect what the function does.
2023-06-27 19:25:19 +02:00
Winni Neessen e7f8662347
Update precision constants in station.go
Refined precision constants in station.go for better clarity and maintainability. Comment descriptions for each precision level have been expanded for better understanding. Strings have been introduced as constants to represent each precision level, enhancing code readability and preventing inconsistencies. Changes are also done to the UnmarshalJSON() and String() of the Precision type to use these new string constants improving overall code quality.
2023-06-27 19:21:24 +02:00
Winni Neessen 54cc672dfc
Refine comment for DateTime function in speed.go
The comment for the DateTime function in the speed.go file was slightly confusing and inaccurate. It has been updated to more accurately reflect its purpose and functionality. It now clearly states that the function returns the DateTime when the Speed was checked, as originally intended.
2023-06-27 19:12:35 +02:00
Winni Neessen e3756a5466
Update comment for DateTime function in radiation.go
The comment for the DateTime function in radiation.go was updated to more accurately describe its functionality. The previous version of the comment suggested that the function returns a boolean value indicating the availability of a radiation value at the time of a query. However, the function actually returns a time.Time object representing the date and time of the query. The comment was thus updated to reflect this.
2023-06-27 19:01:37 +02:00
Winni Neessen 513d7b863f
Refine DateTime function description in pressure.go
The previous description of the DateTime function in pressure.go was misleading as it implied that the function would return a boolean. The function actually returns the date and time of a Pressure reading. The description has therefore been updated for clarity and accuracy.
2023-06-27 18:59:13 +02:00
Winni Neessen c9d95300c2
Refine Precipitation's DateTime method comment
The Precipitation's DateTime method comment was adjusted to better reflect its functionality. Instead of stating it returns true if the precipitation data was available at the time of the query or not, it was clarified that the method actually returns the DateTime when the Precipitation value was recorded.
2023-06-27 18:57:33 +02:00
Winni Neessen 84ba2feda9
Refine method comments in humidity.go
Comments for DateTime and Value methods in humidity.go file were updated to better describe their functionalities. This clarification should improve understandability for future maintenance/code reading.
2023-06-27 18:49:32 +02:00
Winni Neessen 65d065dd59
Improve error reporting in station_test.go
Modified the error handling sections within the StationSearchByLocation test function to also output the error messages. Changes help in debugging by providing more context whenever the test fails.
2023-06-27 18:31:41 +02:00
Winni Neessen 3eb6a76f5d
Refactor HTTP client for improved error handling and readability
A few changes were made to `httpclient.go`. We swapped the `os` package for `log` to standardize error logging. Instead of having the HTTP transport as a value, it is now a pointer in the HTTP client instantiation function, aligning it with the client itself. We also altered error handling: we now just return an error when our server response is `nil`, and changed `sr.Body.Close()` error reporting to use `log` instead of `fmt`.

To streamline the code, user authentication function `setAuthHeader` was renamed to `setAuthentication`, and the copy of our HTTP response body to buffer now only happens after the status check. We also replaced the `Flush` error to be handled properly.

Successful requests return bytes instead of the buffer itself. As a result, these changes have led to more readable and effective code.
2023-06-27 18:31:13 +02:00
Winni Neessen 9c65eca128
Fix Height conversion and update DateTime comment
- Update the comment for DateTime() to accurately describe its functionality
- Fix the Height conversion (CentiMeter and MilliMeter) calculations by changing the division to multiplication

This commit ensures that the conversion functions work as intended and improves the description for DateTime().
2023-06-27 17:18:15 +02:00
Winni Neessen a4f19380ff
Handle error in GetGeoLocationByName
Return error when fetching GeoLocations fails or the result is empty. This ensures that an error is properly returned and handled when either an error occurs during the API call or no locations are found for the given city name.
2023-06-27 17:15:07 +02:00
Winni Neessen d0905266e1
Fix typo and improve direction calculations
Correct typos related to Angle naming and update calculations for start and end ranges in direction mapping. This ensures accurate and valid directional values are used in the application.
2023-06-27 16:49:22 +02:00
Winni Neessen 28479be939
Add test for findDirection function
Add a new test file, direction_test.go, to test the findDirection function with various input cases. This change helps ensure the reliability and expected functionality of the findDirection function.
2023-06-27 16:48:29 +02:00
Winni Neessen 914327de85
Improve Density type documentation and comments
Update Density type's comments to clarify its purpose and usage, including units and methods, for better code understanding and maintainability.
2023-06-27 16:13:13 +02:00
Winni Neessen a10ec1c0f9
Update DateTime String method to use Value()
Refactor the DateTime String method to use the Value() function instead of accessing the internal field directly, for better encapsulation and readability.
2023-06-27 16:12:59 +02:00
Winni Neessen d7567d4b2b
Remove unused and redundant weather fields
Removed several unused and redundant weather fields like DewPointMean, GlobalRadiation, TemperatureMean, Temperature5cm, etc. from curweather.go to reduce complexity and improve readability.
2023-06-27 16:12:38 +02:00
Winni Neessen c1e054d9a3
Reformat ConditionMap for better readability
Refactor the ConditionMap by aligning the values, which improves code readability and adheres to the code style guidelines.
2023-06-27 16:12:22 +02:00
Winni Neessen 4318599eb0
Replace hardcoded date format with constant
Replace the hardcoded "2006-01-02" date format with the DateFormat constant in both SunsetByDateString and SunriseByDateString functions to ensure consistency and easier future updates.
2023-06-27 16:12:06 +02:00
Winni Neessen a0b67b0367
Add client timeout and improve error handling
- Set HTTPClientTimeout for HTTP client to prevent hanging requests
- Check for http.StatusOK instead of a generic error-range
- Use json.NewDecoder to decode error JSON for better memory usage
2023-06-27 15:20:16 +02:00
Winni Neessen 681c53c23d
Fix humidity check in curweather.go
Check for HumidityRelative instead of Dewpoint in the HumidityRelative() function to return correct "not available" status.
2023-06-27 15:19:41 +02:00
Winni Neessen 8cb9754f69
Added SnowHeight and corrected comments 2023-06-26 12:21:36 +02:00
Winni Neessen 7bdf2de388
Merge pull request #9 from wneessen/more-curweather
v0.1.0: More data points for current weather
2023-06-23 18:37:31 +02:00
Winni Neessen b779e0f65b
Make golangci-lint happy 2023-06-23 18:34:25 +02:00
Winni Neessen a697b13970
Move init multipliers into constants so we can reuse them 2023-06-23 16:42:06 +02:00
Winni Neessen 5dee24573a
Added SnowAmount 2023-06-23 16:38:56 +02:00
Winni Neessen fee0bc6795
Bump version to v0.1.0 2023-06-23 12:36:17 +02:00
Winni Neessen fcc7626a76
Added PressureQFE to current weather 2023-06-23 12:35:52 +02:00