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

Refactor zinolib config parsing #22

Merged
merged 4 commits into from
Oct 18, 2023
Merged

Conversation

hmpf
Copy link
Contributor

@hmpf hmpf commented Sep 5, 2023

Closes #11 as a bonus.

  • allow storing config file elsewhere than users' home directories
  • add tests!

The normalize-function fixes a bug (placement of globals) in parse_tcl_config and is in preparation for the new stuff.

I would especially like feedback on the tests/file handling in the tests.

@github-actions
Copy link

github-actions bot commented Sep 5, 2023

Test results

0 tests   0 ✔️  0s ⏱️
0 suites  0 💤
0 files    0

Results for commit f140df8.

♻️ This comment has been updated with latest results.

@codecov
Copy link

codecov bot commented Sep 5, 2023

Codecov Report

Merging #22 (9d586d4) into main (d344a10) will increase coverage by 3.48%.
Report is 7 commits behind head on main.
The diff coverage is 93.42%.

❗ Current head 9d586d4 differs from pull request most recent head f140df8. Consider uploading reports for the commit f140df8 to get more accurate results

@@            Coverage Diff             @@
##             main      #22      +/-   ##
==========================================
+ Coverage   67.63%   71.12%   +3.48%     
==========================================
  Files           9       13       +4     
  Lines        1029     1136     +107     
==========================================
+ Hits          696      808     +112     
+ Misses        333      328       -5     
Files Coverage Δ
src/zinolib/config/models.py 100.00% <100.00%> (ø)
src/zinolib/config/toml.py 100.00% <100.00%> (ø)
src/zinolib/controllers/base.py 96.77% <100.00%> (ø)
src/zinolib/controllers/zino1.py 70.86% <100.00%> (+0.19%) ⬆️
src/zinolib/event_types.py 99.41% <100.00%> (ø)
src/zinolib/ritz.py 57.63% <100.00%> (+1.44%) ⬆️
src/zinolib/config/tcl.py 97.82% <97.82%> (ø)
src/zinolib/config/utils.py 95.23% <95.23%> (ø)
src/zinolib/compat.py 76.47% <66.66%> (-12.42%) ⬇️
src/zinolib/config/zino1.py 81.48% <81.48%> (ø)

... and 1 file with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@sonarcloud
Copy link

sonarcloud bot commented Sep 5, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot E 1 Security Hotspot
Code Smell A 3 Code Smells

No Coverage information No Coverage information
0.3% 0.3% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

@hmpf hmpf force-pushed the refactor-config-parsing branch 4 times, most recently from a6c77fd to e92a7be Compare October 12, 2023 12:40
@hmpf hmpf force-pushed the refactor-config-parsing branch 3 times, most recently from b765b6f to cea2c4e Compare October 16, 2023 09:03
src/zinolib/config/tcl.py Outdated Show resolved Hide resolved
src/zinolib/config/models.py Outdated Show resolved Hide resolved
src/zinolib/config/zino1.py Show resolved Hide resolved
Copy link
Member

@lunkwill42 lunkwill42 left a comment

Choose a reason for hiding this comment

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

I was asked to look particularly at the tests, but I could not resist suggesting type annotations to a lot of the code - until I gave up, because there were none at all; I'm sure you can figure out the annotations yourself 😆

I think this config parsing code really is a nice touch, and the tests seem to mostly cover what is needed.

Otherwise, SonarCloud has flagged 4 potential code smells that have some merit, I'm not going to repeat those here.

pyproject.toml Show resolved Hide resolved
src/zinolib/compat.py Outdated Show resolved Hide resolved
src/zinolib/config/tcl.py Show resolved Hide resolved
src/zinolib/config/tcl.py Show resolved Hide resolved
src/zinolib/config/tcl.py Show resolved Hide resolved
src/zinolib/config/tcl.py Show resolved Hide resolved
tests/utils.py Show resolved Hide resolved
tests/test_zinolib_config_tcl.py Outdated Show resolved Hide resolved
tests/test_zinolib_config_tcl.py Outdated Show resolved Hide resolved
src/zinolib/config/zino1.py Show resolved Hide resolved
Copy link
Member

@lunkwill42 lunkwill42 left a comment

Choose a reason for hiding this comment

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

I think the config parsing code is neatly done. I've created a separate issue for type annotations (and considering adding a techdebt label ;) )

My only concern is this: The tests don't seem to actually be running in the github workflows. The test results are empty. This is likely not caused by this PR, but should be fixed. I was surprised the tests didn't catch the missing import that @johannaengland pointed out, and now I see why...

@hmpf
Copy link
Contributor Author

hmpf commented Oct 17, 2023

Joy. They run locally of course. They run on github actions too, what fails is only the last step.

- allow storing config file elsewhere than users' home directories
- add tests!
@hmpf hmpf force-pushed the refactor-config-parsing branch 2 times, most recently from 9d586d4 to f140df8 Compare October 17, 2023 13:10
@sonarcloud
Copy link

sonarcloud bot commented Oct 17, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.1% 0.1% Duplication

@hmpf
Copy link
Contributor Author

hmpf commented Oct 18, 2023

They run on github action stoo, what fails is only the last step.

@hmpf hmpf merged commit 369c655 into Uninett:main Oct 18, 2023
13 checks passed
@hmpf hmpf deleted the refactor-config-parsing branch October 18, 2023 08:37
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.

Support config in toml-format
4 participants