-
Notifications
You must be signed in to change notification settings - Fork 18
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
Use pre commit #407
Use pre commit #407
Conversation
This is a temporary fix until the issue is resolved, see PyCQA/pycodestyle#914
CONTRIBUTING.rst:60: (INFO/1) Hyperlink target "get-started" is not referenced. docs/source/introduction.rst:9: (WARNING/2) Inline emphasis start-string without end-string.
CONTRIBUTING.rst:63:Ready to contribute? Here's how to set up `pyglotaran` for local development. CONTRIBUTING.rst:65:1. Fork the `pyglotaran` repo on GitHub. CONTRIBUTING.rst:118: Check your Github Actions `https://github.com/<your_name_here>/pyglotaran/actions` HISTORY.rst:11:* Package was renamed to `pyglotaran` on PyPi HISTORY.rst:16:* Changed `nan_policiy` to `omit` docs/source/index.rst:4: contain the root `toctree` directive. docs/source/quickstart.rst:23:Like all data in `glotaran`, the dataset is a :class:`xarray:xarray.Dataset`. docs/source/quickstart.rst:24:You can find more infomation about the `xarray` library the `xarray hompage`_. docs/source/quickstart.rst:72:To analyze our data, we need to create a model. Create a file called `model.py` docs/source/quickstart.rst:150:You can check your model for problems with `model.validate`. docs/source/quickstart.rst:156:Now define some starting parameters. Create a file called `parameter.yml` with docs/source/quickstart.rst:195:You can `model.validate` also to check for missing parameters. docs/source/quickstart.rst:222:You can get the resulting data for your dataset with `result.get_dataset`.
glotaran/model/util.py:21: orginal ==> original glotaran/model/util.py:23: orginal ==> original glotaran/model/util.py:25: documenation ==> documentation glotaran/model/util.py:25: orginal ==> original glotaran/model/util.py:25: documenation ==> documentation glotaran/builtin/models/kinetic_image/initial_concentration.py:1: intial ==> initial glotaran/parameter/parameter.py:31: paramter ==> parameter glotaran/parameter/parameter.py:80: dictonary ==> dictionary docs/source/installation.rst:79: preffered ==> preferred glotaran/analysis/simulation.py:35: Conditionaly ==> Conditionally glotaran/analysis/result.py:36: dictonary ==> dictionary glotaran/builtin/models/kinetic_spectrum/spectral_constraints.py:80: documention ==> documentation glotaran/cli/commands/optimize.py:15: infered ==> inferred glotaran/cli/commands/optimize.py:112: occured ==> occurred glotaran/cli/commands/optimize.py:120: successfull ==> successful glotaran/cli/commands/optimize.py:120: follwing ==> following glotaran/cli/commands/optimize.py:124: occured ==> occurred glotaran/analysis/nnls.py:1: conditionaly ==> conditionally glotaran/analysis/nnls.py:13: conditionaly ==> conditionally glotaran/parameter/parameter_group.py:29: hirachy ==> hierarchy glotaran/parameter/parameter_group.py:373: seperator ==> separator glotaran/parameter/parameter_group.py:382: seperator ==> separator glotaran/parameter/parameter_group.py:383: seperator ==> separator glotaran/parameter/parameter_group.py:386: seperator ==> separator glotaran/parameter/parameter_group.py:390: seperator ==> separator glotaran/parameter/parameter_group.py:390: seperator ==> separator glotaran/parameter/parameter_group.py:404: seperator ==> separator glotaran/analysis/variable_projection.py:1: conditionaly ==> conditionally glotaran/analysis/variable_projection.py:13: conditionaly ==> conditionally glotaran/model/model.py:152: Conditionaly ==> Conditionally glotaran/model/model.py:156: standart ==> standard glotaran/model/model.py:186: dictonary ==> dictionary glotaran/model/model.py:221: dictonary ==> dictionary glotaran/cli/commands/explore.py:114: ouput ==> output docs/source/quickstart.rst:24: infomation ==> information
This was needed since black replaced the single quotes with double quotes
pydocstyle is very strict on how a good docstring should look like and also complains about missing docstrings. Since pre-commit, with all its hooks, is our new code quality checker the 421 issues pydocstyles finds would break the CI. Thus I leave the fixing of the docstrings to our core developers who know exactly what which function does and what the docstring should look like ;)
Codecov Report
@@ Coverage Diff @@
## master #407 +/- ##
========================================
+ Coverage 66.6% 67.0% +0.4%
========================================
Files 65 65
Lines 3019 3044 +25
Branches 603 597 -6
========================================
+ Hits 2011 2040 +29
+ Misses 884 880 -4
Partials 124 124
Continue to review full report at Codecov.
|
Should I fix the issues with |
@s-weigand feel free to make some corrections, not everything is fixable now but do what you can. |
so isort will import it after the third party imports
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed ok!
I went through the individual commits and ignored (most) of the commits tagged IGNORE which were just reformatting.
@@ -6,7 +6,7 @@ It is designed to provide a state of the art modeling toolbox to researchers, in | |||
|
|||
Its features are: | |||
|
|||
* user-friendly modeling with a custom YAML (*.yml) based modeling language | |||
* user-friendly modeling with a custom YAML (``*.yml``) based modeling language |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have seen a mix of .yml and .yaml, I know both are possible, and that the creator(s) of YAML prefer .yaml whereas the rest of the world prefers .yml but better check if we don't mix and match ourselves, that may be confusing for first time users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO that is up to a different PR + issue, just for checking the text in the docs.
|
||
__version__ = '0.1.0' | ||
__version__ = "0.1.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reminder to maintainers: to be increased to 0.2.0 in the near future
forcing import to be each on its own line
* Removed unneeded path setup * Replaced hardcoded author and title with variables * Replaced unsave http links with https * Fixed sonarcloud issues in wavelength_time_explicit_file * Made errors raised in simulate less generic * Made errors raised in IrfMultiGaussian less generic * Made errors raised in _calculate_for_k_matrix less generic * Made errors raised in Scheme less generic and combined nested if statements * Renamed set to model_set, not to overwrite builtin set * Made errors raised in Model less generic * Made errors raised in Parameter less generic * Made errors raised in ParameterGroup less generic * Made errors raised in model_attribute less generic * Made errors raised in model.decorator less generic and combined nested if * Improved some docstrings * Commented out unused variable and added TODO comment
Got the sonarcloud code smells down from 53 to 25 (some were caused by reformatting i.e. |
This can be done automatically by using 'pre-commit autoupdate'
@@ -49,7 +49,7 @@ def __init__(self, | |||
self._optimized_parameter = parameter | |||
self._nfev = nfev | |||
self._nvars = nvars | |||
self._ndata = ndata, | |||
self._ndata = (ndata,) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@s-weigand Why that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just a more obious to declare a single value tuple, since a comma can be easily overlooked.
except Exception as e: | ||
raise Exception(f"Error opening scheme: {e}") | ||
raise OSError(f"Error opening scheme: {e}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@s-weigand Are all this changes in the exceptions done by you or py black?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Exception changes are all done by me (only in this case pyupgrade changed my IOError
to an OSError
), so sonar cloud complains about less code smells see s-weigand#14 and #409 .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the OSError
see the changes in python 3.3 https://docs.python.org/3/library/exceptions.html#OSError.filename2
SonarCloud Quality Gate failed. 0 Bugs No Coverage information |
This PR adds a config for
pre-commit
, which will be used as more extensive code quality checker.New code quality features, run before each commit on the staged files:
# noqa
comments with yesqa*.rst
files with rstcheck and rst-backtickscheck-yaml
, since it doesn't support custom flags like!tuple
)All those checks will also be run by the CI on the entire code base (
pre-commit run --all
).The enforcing of proper docstrings with pydocstyle is deactivated right now.
Because there are 421 isuues to be solved, which else would break the CI.
I think the best approach will be to improve the docstring quality file by file.
To check a single file, run the following command.
The
--ignore-decorators=wrap_func_as_method
is needed sincewrap_func_as_method
, generates docstrings using f-strings, which pydocstyle doesn't likeTesting
Passing the tests is mandatory.
Closing issues
closes #388 closes #389