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

CLI Text Styles and pre-commit configuration #609

Merged
merged 8 commits into from Mar 22, 2023

Conversation

victorgarcia98
Copy link
Contributor

@victorgarcia98 victorgarcia98 commented Mar 21, 2023

Closes #603

  • CLI Text Styles defined in class ColorCode.
  • Updating deprecated flexmeasure command in the documentation.
  • Removing language_version from the pre-commit configuration.

victorgarcia98 and others added 5 commits March 21, 2023 10:59
…e system installed version. Issue FlexMeasures#608

Signed-off-by: victor <victor@seita.nl>
…ccess, warn, error. The different styles, which are nothing but attributes of the function , are stored as dictionaries.

Signed-off-by: victor <victor@seita.nl>
Signed-off-by: victor <victor@seita.nl>
@Flix6x
Copy link
Contributor

Flix6x commented Mar 21, 2023

I think the name of this development branch is a bit confusing. @nhoening what do you suggest? Rename and recreate this PR?

@nhoening
Copy link
Contributor

I think the name of this development branch is a bit confusing. @nhoening what do you suggest? Rename and recreate this PR?

I believe the branch name is not that relevant, what we want to control is the commit message of the merge commit.

Copy link
Contributor

@nhoening nhoening left a comment

Choose a reason for hiding this comment

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

Great work. I got a few requests, but nothing serious.

Out of interest - have you checked how click.UsageError is styling the error messages?

documentation/changelog.rst Outdated Show resolved Hide resolved
documentation/host/data.rst Show resolved Hide resolved
flexmeasures/cli/utils.py Outdated Show resolved Hide resolved
flexmeasures/cli/utils.py Outdated Show resolved Hide resolved
flexmeasures/cli/data_delete.py Outdated Show resolved Hide resolved
flexmeasures/cli/data_delete.py Show resolved Hide resolved
flexmeasures/cli/data_delete.py Outdated Show resolved Hide resolved
flexmeasures/cli/data_delete.py Outdated Show resolved Hide resolved
flexmeasures/cli/data_delete.py Outdated Show resolved Hide resolved
flexmeasures/cli/data_edit.py Outdated Show resolved Hide resolved
@coveralls
Copy link
Collaborator

coveralls commented Mar 21, 2023

Pull Request Test Coverage Report for Build 4488267179

  • 11 of 120 (9.17%) changed or added relevant lines in 9 files are covered.
  • 4 unchanged lines in 3 files lost coverage.
  • Overall coverage increased (+0.04%) to 64.842%

Changes Missing Coverage Covered Lines Changed/Added Lines %
flexmeasures/cli/testing.py 0 2 0.0%
flexmeasures/cli/data_edit.py 1 4 25.0%
flexmeasures/cli/jobs.py 1 5 20.0%
flexmeasures/cli/monitor.py 1 6 16.67%
flexmeasures/cli/db_ops.py 1 11 9.09%
flexmeasures/cli/data_delete.py 1 19 5.26%
flexmeasures/cli/data_show.py 1 20 5.0%
flexmeasures/cli/data_add.py 1 49 2.04%
Files with Coverage Reduction New Missed Lines %
flexmeasures/cli/data_add.py 1 31.81%
flexmeasures/cli/db_ops.py 1 42.17%
flexmeasures/cli/data_show.py 2 24.23%
Totals Coverage Status
Change from base Build 4479947128: 0.04%
Covered Lines: 6869
Relevant Lines: 9858

💛 - Coveralls

@victorgarcia98
Copy link
Contributor Author

I'm just pushed the changes you requested. Moreover, I have harmonized the raise of exceptions (all raise click.Abort -> raise.Abort()).

By the way, I think we need to standardize the way we exit the CLI commands in case of an error. In some places, there is just a return, which exists the code with status code = 0, and others where it raises the click.Abort() exception, which exists the code with status code = 1). The cases where there were returns what were clear errors, I've replace the return by raise click.Abort().

Please, let me know if it is fine like this or we should distinguish between 'code errors' (exceptions) and 'operational errors' (invalid operations).

Copy link
Contributor

@nhoening nhoening left a comment

Choose a reason for hiding this comment

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

I approve, just one small fix left.

The danger with this one of course is that our test coverage of the CLI commands is very bad. We have flake8 etc for a little help.
It's easy to overlook one small mistake and ruin a command until someone tries it.

How many commands did you try manually, to see if they work?

flexmeasures/cli/data_add.py Outdated Show resolved Hide resolved
Signed-off-by: victor <victor@seita.nl>
@nhoening nhoening merged commit 9ecc85f into FlexMeasures:main Mar 22, 2023
3 checks passed
@victorgarcia98 victorgarcia98 linked an issue Mar 22, 2023 that may be closed by this pull request
@Flix6x Flix6x added this to the 0.13.0 milestone May 1, 2023
@Flix6x Flix6x added the CLI label May 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pre-commit python version mismatch Use green & red colors in CLI for success / failure messages
4 participants