Skip to content

Improve code-base and coverage #31

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

Merged
merged 17 commits into from
Jan 26, 2022
Merged

Improve code-base and coverage #31

merged 17 commits into from
Jan 26, 2022

Conversation

gnikit
Copy link
Member

@gnikit gnikit commented Jan 24, 2022

An attempt to remove some of the more obvious clutter

  • not using super constructors and super method calls
  • Remove code duplication
  • Obstruct away certain methods
  • Use objects were possible
  • Simplify REGEX expressions (more can be done on this, I simply choose not to since the REGEX would be harder for me to read)
  • Disable the autoversioning commit
  • Further removal of format strings in favour of f-strings

It causes GitHub Releases to be marked as drafts
- Use super constructors and super methods
- Remove code duplications where possible
- Fixed typos
@codecov
Copy link

codecov bot commented Jan 24, 2022

Codecov Report

Merging #31 (6a71bea) into dev (80fdaa5) will increase coverage by 2.55%.
The diff coverage is 80.80%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev      #31      +/-   ##
==========================================
+ Coverage   78.46%   81.01%   +2.55%     
==========================================
  Files          10       10              
  Lines        4453     4288     -165     
==========================================
- Hits         3494     3474      -20     
+ Misses        959      814     -145     
Impacted Files Coverage Δ
fortls/jsonrpc.py 61.58% <71.42%> (-2.26%) ⬇️
fortls/objects.py 80.70% <77.02%> (+1.46%) ⬆️
fortls/langserver.py 71.80% <84.37%> (+2.06%) ⬆️
fortls/_version.py 100.00% <100.00%> (ø)
fortls/helper_functions.py 86.40% <100.00%> (ø)
fortls/intrinsics.py 91.85% <100.00%> (+0.18%) ⬆️
fortls/parse_fortran.py 86.31% <100.00%> (+5.50%) ⬆️
fortls/regex_patterns.py 100.00% <100.00%> (ø)
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 80fdaa5...6a71bea. Read the comment docs.

Still not great since we can't reliably increment the version
and produce releases but it's an improvement since we'll
only have to update the version once per release
- Adds `WHERE` block tests
- Adds max line and max comment line diagnostic tests
- Adds semicolon tests
- Adds `ENUM` tests
- Disables logging for debug calls and Python 2
@ZedThree
Copy link

Hi @gnikit, thanks for taking up the maintainership of fortls, it's a really important community tool!

I notice here you've removed some code for auto-incrementing the version. I've recently been using setuptools_scm in all my python projects, which automatically sets the version from the latest git tag, and found it very useful.

If you're interested, I can open a PR implementing it.

@gnikit
Copy link
Member Author

gnikit commented Jan 25, 2022

Hi @ZedThree, I will have a look at setuptools_scm. The code I commented out does not affect the releases of fortls just what is committed to the repo. I had to do it primarily for two reasons.

  1. Currently we release on PyPi (and any other channel if we so choose to) through GitHub Releases. A Release creates the tag, and then proceeds to to build and upload the package. Updating that tag (via force push), predictably changes the status of the Release to a pre-release since its "state" has been altered. That is pretty annoying and somewhat defeats the point of having this automated since I then have to go manually and set the Release as not a pre-release.
  2. Strictly speaking, signing the commit is actually a security vulnerability since any individual that can author a release would sign it with the key I uploaded, which really defeats the purpose of signing commits to improve security.

I suspect that setuptools_scm will run into issue 1), since GitHub will have already created the tag. I will definitely have a look though, feel free to open a PR, you can also locally test how github actions will perform by using https://github.com/nektos/act., e.g. act release.
I would suggest deleting all other yml files if you are to do this and also deleting the end part of python-publish all the PyPi release stuff.

@ZedThree
Copy link

Yep, that is how I automate releases too. setuptools_scm writes to a file that you add to .gitignore so it doesn't affect the state of the repo, and does this when you build the package, so there's no need to force push anything. It also has the added bonus that it can automatically create dev version numbers for non-tagged commits.

The downside is that using an editable install locally might not pick up changes to the version number without running setup.py or pip install -e . again. This isn't an issue if you always use the version from pypi though.

I didn't know about nektos/act, thanks!

This is for cross-platform compatibility when testing, since
os.path tends to mess up capitalisation of paths on windows
which are case-insensitive but pytest does not know that so we have
to use Path instead which yields more accurate results.
Should make it easier to write cross platform unittests.
Also, removed the `shell=True` we do not need that anymore, only
the `sys.executable`.
Some additional sanitisation of input and Path fixups
Also, fixes uri creation in diagnostic tests
Closes Keywords always sorted on Windows #36
@gnikit gnikit merged commit a7a7023 into dev Jan 26, 2022
@gnikit gnikit deleted the feature/coverage-improve branch January 26, 2022 01:28
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.

Keywords always sorted on Windows Rewrite unittests so debuggers can step into Popen call
2 participants