Skip to content

Commit a7a7023

Browse files
authored
Merge pull request #31 from gnikit/feature/coverage-improve
Improve code-base and coverage
2 parents 80fdaa5 + 6a71bea commit a7a7023

25 files changed

+488
-440
lines changed

.coveragerc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
[run]
22
dynamic_context = test_function
33
omit = fortls/__init__.py
4+
5+
[report]
6+
exclude_lines =
7+
if debug:
8+
log.debug
9+
except:
10+
if not PY3K:

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
build:
1010
strategy:
1111
matrix:
12-
os: [ubuntu-latest]
12+
os: [ubuntu-latest, windows-latest]
1313
python-version: ["3.7", "3.8", "3.9", "3.10"]
1414
fail-fast: false
1515
runs-on: ${{ matrix.os }}

.github/workflows/python-publish.yml

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,21 @@ jobs:
5555
shell: bash
5656
run: sed -i "s@\".*\"@\"${VERSION}\"@g" "fortls/_version.py"
5757

58-
- name: Commit the new version to dev
59-
shell: bash
60-
run: |
61-
git config --global user.name 'gnikit'
62-
git config --global user.email '[email protected]'
63-
git fetch origin
64-
git switch dev
65-
git commit -S fortls/_version.py -m "Auto-Update version" -v
66-
git push
67-
git tag -f "${VERSION}"
68-
git push --delete origin "${VERSION}"
69-
git push origin "${VERSION}"
58+
# Disabled the workflow because it messes up with the Releases on GitHub
59+
# releases that use tags through force-push are marked as drafts
60+
# will have to manually update the versions in _version.py
61+
# - name: Commit the new version to dev
62+
# shell: bash
63+
# run: |
64+
# git config --global user.name 'gnikit'
65+
# git config --global user.email '[email protected]'
66+
# git fetch origin
67+
# git switch dev
68+
# git commit -S fortls/_version.py -m "Auto-Update version" -v
69+
# git push
70+
# git tag -f "${VERSION}"
71+
# git push --delete origin "${VERSION}"
72+
# git push origin "${VERSION}"
7073

7174
- name: Build package
7275
run: python -m build

CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
# CHANGELONG
22

3-
## Unreleased
3+
## 2.1.0
44

55
### Added
66

77
- Added coverage metric for Codecov
8+
- Added coverage for `WHERE`, `ENUM`, max line/comment diagnostics and multilines
9+
- Adds Windows CI
10+
11+
### Fixed
12+
13+
- Fixed global `sort_keywords` option not propagating during parsing on Windows
14+
([gnikit/fortls#36](https://github.com/gnikit/fortls/issues/36))
15+
- Fixed unittests not propagating debugger state
16+
([gnikit/fortls#35](https://github.com/gnikit/fortls/issues/35))
817

918
## 2.0.1
1019

docs/conf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
sys.path.insert(0, os.path.abspath(".."))
1717

18+
from fortls._version import __version__ # noqa: E402
19+
1820
# Generate the agglomerated changes (from the CHANGELOG) between fortls
1921
# and the fortran-language-server project
2022
with open("../CHANGELOG.md", "r") as f:
@@ -57,7 +59,7 @@
5759
author = "Giannis Nikiteas"
5860

5961
# The full version, including alpha/beta/rc tags
60-
release = "2.0.0"
62+
release = __version__
6163

6264

6365
# -- General configuration ---------------------------------------------------

docs/options.rst

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ source_dirs
8484

8585
.. code-block:: json
8686
87-
"source_dirs": ["./**", "/external/fortran/src"]
87+
{
88+
"source_dirs": ["./**", "/external/fortran/src"]
89+
}
8890
8991
By default all directories under the current project will be recursively parsed
9092
for Fortran sources. Alternatively, one can define a series of directories
@@ -97,7 +99,9 @@ incl_suffixes
9799

98100
.. code-block:: json
99101
100-
"incl_suffixes": [".h", ".FYP"]
102+
{
103+
"incl_suffixes": [".h", ".FYP"]
104+
}
101105
102106
``fortls`` will parse only files with ``incl_suffixes`` extensions found in
103107
``source_dirs``. By default ``incl_suffixes`` are defined as
@@ -112,7 +116,9 @@ excl_suffixes
112116

113117
.. code-block:: json
114118
115-
"excl_suffixes": ["_tmp.f90", "_hdf5.F90"]
119+
{
120+
"excl_suffixes": ["_tmp.f90", "_hdf5.F90"]
121+
}
116122
117123
If certain files or suffixes do not need to be parsed these can be excluded by
118124
deffining ``excl_suffixes``
@@ -130,8 +136,9 @@ its subdirectories from being parsed you should define it like so
130136

131137
.. code-block:: json
132138
133-
"excl_paths": ["exclude_dir/**"]
134-
139+
{
140+
"excl_paths": ["exclude_dir/**"]
141+
}
135142
136143
Preprocessor
137144
############
@@ -141,7 +148,9 @@ pp_suffixes
141148

142149
.. code-block:: json
143150
144-
"pp_suffixes" : [".h", ".F90", ".fpp"]
151+
{
152+
"pp_suffixes" : [".h", ".F90", ".fpp"]
153+
}
145154
146155
By default preprocessor definitions are parsed for all Fortran source files
147156
with uppercase extensions e.g. ``.F90``, ``.F``, ``.F08``, etc.. However, the
@@ -153,7 +162,9 @@ include_dirs
153162

154163
.. code-block:: json
155164
156-
"include_dirs": ["include", "preprocessor", "/usr/include"]
165+
{
166+
"include_dirs": ["include", "preprocessor", "/usr/include"]
167+
}
157168
158169
By default ``fortls`` will scan the project's directories for files with extensions
159170
``PP_SUFFIXES`` to parse for **preprocessor definitions**. However, if the preprocessor
@@ -169,9 +180,11 @@ pp_defs
169180

170181
.. code-block:: json
171182
172-
"pp_defs": {
173-
"HAVE_PETSC": ""
174-
"Mat": "type(tMat)"
183+
{
184+
"pp_defs": {
185+
"HAVE_PETSC": ""
186+
"Mat": "type(tMat)"
187+
}
175188
}
176189
177190
Additional **preprocessor definitions** from what are specified in files found in

fortls.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
#!/usr/bin/env python3
2+
# file used for unit testing
23
if __name__ == "__main__":
3-
import sys
4-
import os
5-
6-
root_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
7-
sys.path.insert(0, root_dir)
84
import fortls
95

106
fortls.main()

fortls/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
from .interface import commandline_args
1515

1616

17-
def error_exit(error_str):
18-
print("ERROR: {0}".format(error_str))
17+
def error_exit(error_str: str):
18+
print(f"ERROR: {error_str}")
1919
sys.exit(-1)
2020

2121

@@ -25,7 +25,7 @@ def main():
2525
args = commandline_args(__name__).parse_args()
2626

2727
if args.version:
28-
print("{0}".format(__version__))
28+
print(__version__)
2929
sys.exit(0)
3030

3131
debug_server = (

fortls/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "v2.0.1"
1+
__version__ = "v2.1.0"

fortls/helper_functions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def expand_name(line: str, char_poss: int) -> str:
3838
regexs = [LOGICAL_REGEX, SQ_STRING_REGEX, DQ_STRING_REGEX, WORD_REGEX, NUMBER_REGEX]
3939
for r in regexs:
4040
for num_match in r.finditer(line):
41-
if num_match.start(0) <= char_poss and num_match.end(0) >= char_poss:
41+
if num_match.start(0) <= char_poss <= num_match.end(0):
4242
return num_match.group(0)
4343
return ""
4444

@@ -344,7 +344,7 @@ def get_keywords(keywords, keyword_info={}):
344344
def get_paren_substring(test_str):
345345
i1 = test_str.find("(")
346346
i2 = test_str.rfind(")")
347-
if i1 > -1 and i2 > i1:
347+
if -1 < i1 < i2:
348348
return test_str[i1 + 1 : i2]
349349
else:
350350
return None

0 commit comments

Comments
 (0)